/* ════════════════════════════════════════════════════════
   トロフィー機能のスタイル
   ・#trophy-modal   … トロフィー一覧モーダル
   ・#trophy-detail-overlay … トロフィー詳細モーダル
   ・.trophy-toast   … Steam風の右上解除通知
   ・.trophy-btn-badge … 未確認（NEW）黄色ドット
   ════════════════════════════════════════════════════════ */

#trophy-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.62); z-index: 800;
  align-items: center; justify-content: center; padding: 16px;
}
#trophy-modal.open { display: flex; }

#trophy-box {
  background: #fff; border-radius: 24px;
  padding: 22px 18px 18px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: popIn .35s cubic-bezier(.34,1.56,.64,1);
}

#trophy-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
#trophy-header h2 { font-size: 1.2rem; color: #e07b39; }
#trophy-summary { font-size: .82rem; color: #999; font-weight: bold; white-space: nowrap; }

#trophy-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; margin-top: 12px; }
.trophy-tab {
  padding: 7px 14px; border-radius: 18px; border: 2px solid #eee;
  background: #fafafa; color: #777; font-family: inherit; font-size: .82rem;
  font-weight: bold; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.trophy-tab.active {
  background: #fff3e8; border-color: var(--orange); color: var(--orange);
}
.trophy-tab-icon {
  width: 24px; height: 24px; flex: 0 0 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.trophy-tab-icon-image {
  display: block; width: 100%; height: 100%; object-fit: contain;
}

#trophy-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.trophy-empty { padding: 30px 10px; text-align: center; color: #aaa; font-size: .88rem; }

.trophy-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  background: #f7f7f7; border: 2px solid transparent; border-radius: 16px;
  padding: 10px 12px; cursor: pointer; transition: transform .12s;
  text-align: left; width: 100%; font-family: inherit;
}
.trophy-item:active { transform: scale(.97); }
.trophy-item.unlocked { background: #fffaf3; border-color: #ffe1bb; }
.trophy-item.locked { color: #999; }

.trophy-item-icon {
  flex: 0 0 46px; width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; background: #fff; border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.05);
  overflow: hidden;
}
.trophy-item-icon-image,
.trophy-item-silhouette-canvas {
  display: block; width: 100%; height: 100%; object-fit: contain;
}
.trophy-item-silhouette-canvas { opacity: .55; }
.trophy-item-body { flex: 1 1 auto; min-width: 0; }
.trophy-item-title { font-size: .95rem; font-weight: bold; color: #555; }
.trophy-item.unlocked .trophy-item-title { color: #e07b39; }
.trophy-item-desc { font-size: .78rem; color: #999; margin-top: 2px; line-height: 1.35; }

.trophy-item-progress { flex: 0 0 auto; text-align: right; }
.trophy-item-count { font-size: .8rem; font-weight: bold; color: #b98c5a; white-space: nowrap; }
.trophy-item-date { font-size: .66rem; color: #bbb; margin-top: 2px; white-space: nowrap; }

.trophy-item-bar {
  width: 74px; height: 7px; border-radius: 999px; background: #eee;
  overflow: hidden; margin-top: 4px; margin-left: auto;
}
.trophy-item-bar-fill {
  height: 100%; background: linear-gradient(90deg, #ffc94d, #ff9b3d);
  border-radius: 999px;
}

.trophy-new-badge {
  position: absolute; top: -7px; right: -5px;
  background: #ffd54d; color: #7a4a00;
  font-size: .62rem; font-weight: bold; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 999px;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
  animation: trophyNewPulse 1.4s ease-in-out infinite;
}
@keyframes trophyNewPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

#trophy-close {
  display: block; margin: 4px auto 0; padding: 10px 34px;
  border: none; border-radius: 20px; background: var(--orange);
  color: #fff; font-family: inherit; font-size: .95rem; font-weight: bold;
  cursor: pointer;
}
#trophy-close:active { transform: scale(.95); }

/* ─── Issue #845: trophy detail modal ─────────────────── */
#trophy-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(17,24,39,.58);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}
#trophy-detail-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.trophy-detail-card {
  position: relative;
  width: min(92vw, 520px);
  max-height: min(86vh, 700px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 3px solid #ffd54f;
  border-radius: 28px;
  background: linear-gradient(180deg, #fffdf7 0%, #fff7df 100%);
  box-shadow: 0 22px 60px rgba(0,0,0,.28);
  padding: 34px 26px 28px;
  text-align: center;
  transform: translateY(10px) scale(.985);
  transition: transform .18s ease;
}
#trophy-detail-overlay.open .trophy-detail-card { transform: translateY(0) scale(1); }
.trophy-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--orange, #e07b39);
  color: #fff;
  font-family: inherit;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.16);
}
.trophy-detail-close:focus-visible { outline: 4px solid #60a5fa; outline-offset: 2px; }
.trophy-detail-close:active { transform: scale(.94); }
.trophy-detail-visual {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 18px;
  pointer-events: none;
}
.trophy-detail-visual > * { max-width: 100%; }
.trophy-detail-locked-visual {
  width: min(58vw, 220px);
  height: min(58vw, 220px);
  max-width: 220px;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 22px;
  border: 3px solid #d1d5db;
  background: #f3f4f6;
}
.trophy-detail-locked-canvas {
  width: 90%;
  height: 90%;
  opacity: .55;
}
.trophy-detail-unlocked-fallback {
  font-size: clamp(64px, 20vw, 112px);
}
.trophy-detail-name {
  margin: 0 0 10px;
  color: #5b3b10;
  font-size: clamp(24px, 6vw, 34px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.trophy-detail-description {
  margin: 0 auto;
  max-width: 36rem;
  color: #5f6368;
  font-size: clamp(17px, 4.4vw, 21px);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

#btn-open-trophy { position: relative; }
.trophy-btn-badge {
  position: absolute; top: 6px; right: 10px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #ffd233; box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0,0,0,.25);
  animation: trophyNewPulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

#trophy-toast-container {
  position: fixed; top: 14px; right: 14px; z-index: 3000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}

.trophy-toast {
  display: flex; align-items: center; gap: 12px;
  min-width: 240px; max-width: 320px;
  background: linear-gradient(135deg, #fffdf7, #fff3dc);
  border: 2px solid #ffd88f; border-radius: 18px;
  padding: 12px 16px 12px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  transform: translateX(120%);
}
.trophy-toast.trophy-toast-in {
  animation: trophyToastIn .55s cubic-bezier(.34,1.45,.55,1) forwards;
}
.trophy-toast.trophy-toast-out {
  animation: trophyToastOut .45s ease-in forwards;
}
@keyframes trophyToastIn {
  0%   { transform: translateX(120%); opacity: 0; }
  70%  { transform: translateX(-6%);  opacity: 1; }
  100% { transform: translateX(0);    opacity: 1; }
}
@keyframes trophyToastOut {
  0%   { transform: translateX(0);    opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.trophy-toast-icon {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; background: #fff; border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(224,123,57,.18);
  overflow: hidden;
}
.trophy-toast-icon-image {
  display: block; width: 100%; height: 100%; object-fit: contain;
}
.trophy-toast-body { min-width: 0; }
.trophy-toast-heading { font-size: .72rem; font-weight: bold; color: #b98c5a; }
.trophy-toast-title {
  font-size: .95rem; font-weight: bold; color: #e07b39; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trophy-toast-desc {
  font-size: .74rem; color: #999; margin-top: 1px; line-height: 1.3;
}

@media (max-width: 480px) {
  .trophy-toast { min-width: 200px; max-width: 78vw; }
  .trophy-tab { padding: 6px 10px; }
  .trophy-tab-icon { width: 22px; height: 22px; flex-basis: 22px; }
  #trophy-detail-overlay { padding: 14px 12px; }
  .trophy-detail-card { width: min(94vw, 520px); padding: 30px 18px 22px; border-radius: 24px; }
  .trophy-detail-visual { min-height: 190px; margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #trophy-detail-overlay,
  .trophy-detail-card,
  .trophy-detail-close,
  .trophy-item { transition: none !important; }
}
