/* ── トレーディングカード用フォント（app/card-render.js） ── */
@font-face {
  font-family: "KuroHanaMincho";
  src: url("../fonts/KuroHanaMincho/KuroHanaMincho-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "BIZUDPMincho";
  src: url("../fonts/BIZ_UDPMincho/BIZUDPMincho-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "BIZUDPMincho";
  src: url("../fonts/BIZ_UDPMincho/BIZUDPMincho-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "YDWNightShader";
  src: url("../fonts/YDW_nightshader/YDWNightShader.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: hidden;
}
.hero {
  padding: 20px 16px;
  background: linear-gradient(135deg, #1a1622, #2f2a44);
}
.hero .brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.hero .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.hero .brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
}
.hero .brand-wordmark {
  height: 30px;
  display: block;
}
.site-nav { display: flex; gap: 14px; }
.site-nav a { font-size: 13px; font-weight: 700; color: #94a3b8; text-decoration: none; }
.site-nav a.active { color: #f59e0b; }
.site-nav a:hover { color: #f8fafc; }
.hero h1 { margin: 0 0 8px; font-size: clamp(22px, 4vw, 32px); }
.hero p { margin: 0; color: #dbeafe; }
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.panel {
  background: #111827;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px;
  min-width: 0; /* grid item既定のmin-width:autoを無効化し、長い文字列でページが横に広がるのを防ぐ */
}
.panel h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.panel h3 {
  margin: 14px 0 6px;
  font-size: 15px;
  color: #e2e8f0;
}
.player-panel hr {
  border: 0;
  border-top: 1px solid #334155;
  margin: 14px 0;
}
.player-panel .hint {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: #94a3b8;
}
.player-panel .hint a {
  color: #f59e0b;
  text-decoration: underline;
}
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: #94a3b8;
}
.checkbox input {
  margin-top: 2px;
  flex-shrink: 0;
}
.checkbox a {
  color: #f59e0b;
  text-decoration: underline;
}
.policy h2 { margin-bottom: 16px; }
.policy h3 { font-size: 14px; margin: 20px 0 6px; color: #f59e0b; }
.policy p, .policy li { font-size: 13.5px; line-height: 1.85; color: #cbd5e1; }
.policy ul, .policy ol { padding-left: 1.4em; margin: 6px 0; }
.policy .updated { font-size: 12px; color: #64748b; margin-top: 24px; }
.panel.muted { color: #cbd5e1; }
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
/* クレジット残高とデイリー受け取りボタンの行（M2 Phase 1） */
.credits-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px dashed #334155;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.4);
}
.credits-row #credits-label {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24; /* クレジット（ゴールド） */
}
.credits-row button {
  margin-left: auto;
}
/* クレジットパック購入（M2 Phase 1 Stripe） */
.purchase-section {
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.3);
}
.packs-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.pack-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
}
.pack-name {
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
}
.pack-meta {
  font-size: 12px;
  color: #94a3b8;
}
.pack-item .btn-buy-pack {
  margin-top: 4px;
}
.pack-item .btn-buy-pack:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pack-item.campaign {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.06);
}
.pack-campaign {
  align-self: flex-start;
  font-size: 11.5px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
}
/* ── クレジット残高チップ（生成ページ上部・2026-08-07） ── */
.credits-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.credits-chip #credits-chip-label {
  font-size: 14px;
  font-weight: 700;
  color: #fbbf24; /* クレジット（ゴールド） */
}
.credits-chip a {
  margin-left: auto;
}

/* クレジット増減の強調アニメーション（credit-fx.js から使用） */
.credit-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transform-origin: center;
}
.credit-num.credit-up {
  animation: creditPulseUp 700ms ease;
}
.credit-num.credit-down {
  animation: creditPulseDown 700ms ease;
}
@keyframes creditPulseUp {
  0% { transform: scale(1); color: inherit; text-shadow: none; }
  30% { transform: scale(1.4); color: #22c55e; text-shadow: 0 0 10px rgba(34, 197, 94, 0.65); }
  100% { transform: scale(1); color: inherit; text-shadow: none; }
}
@keyframes creditPulseDown {
  0% { transform: scale(1); color: inherit; text-shadow: none; }
  30% { transform: scale(1.2); color: #f87171; text-shadow: 0 0 10px rgba(248, 113, 113, 0.55); }
  100% { transform: scale(1); color: inherit; text-shadow: none; }
}
.credit-delta {
  display: inline-block;
  margin-left: 6px;
  font-weight: 800;
  font-size: 0.82em;
  opacity: 0;
  pointer-events: none;
  vertical-align: middle;
}
.credit-delta.show-up {
  color: #22c55e;
  animation: creditDeltaFloat 1300ms ease forwards;
}
.credit-delta.show-down {
  color: #f87171;
  animation: creditDeltaFloat 1300ms ease forwards;
}
@keyframes creditDeltaFloat {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(-2px); }
  75% { opacity: 1; transform: translateY(-11px); }
  100% { opacity: 0; transform: translateY(-18px); }
}
@media (prefers-reduced-motion: reduce) {
  .credit-num.credit-up, .credit-num.credit-down, .credit-delta.show-up, .credit-delta.show-down {
    animation: none;
  }
}
/* ── 月間購入上限・超過警告（未成年購入制限 2026-08-07） ── */
.monthly-limit {
  display: block;
  margin-bottom: 0.8rem; padding: 0.6rem 0.8rem; border-radius: 10px;
  background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 0.82rem;
}
.monthly-limit.warn { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.5); color: #fbbf24; }
.pack-warn { display: block; margin-top: 0.35rem; font-size: 0.75rem; color: #fbbf24; }
.pack-item.over-limit .btn-buy-pack { opacity: 0.45; }
/* ── 年齢区分の確認モーダル（最大2段階・ショップ 2026-08-07） ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 8, 16, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  width: min(480px, 100%); max-height: 90vh; overflow-y: auto;
  background: #111827; border: 1px solid #334155; border-radius: 16px;
  padding: 1.4rem 1.5rem;
}
.radio-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.8rem;
  margin: 0.4rem 0; border: 1px solid #334155; border-radius: 12px; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.radio-row:hover { border-color: #f59e0b; }
.radio-row input[type="radio"] { accent-color: #f59e0b; width: 18px; height: 18px; flex-shrink: 0; }
/* ── ニックネーム未設定ゲート（ホーム・2026-08-07） ── */
.nav-pulse {
  animation: navPulse 0.9s ease-in-out 3;
}
@keyframes navPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.55); }
}
.nav-gate-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; max-width: min(92vw, 520px);
  background: #1e293b; border: 1px solid #f59e0b; border-radius: 12px;
  color: #fde68a; padding: 12px 16px; font-size: 13px; font-weight: 700;
  text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.nav-gate-toast.hidden { display: none; }
label, fieldset {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #94a3b8;
}
fieldset {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
}
legend {
  color: #cbd5e1;
  font-weight: 700;
  padding: 0 6px;
}
input, select, button, textarea {
  border-radius: 8px;
  border: 1px solid #475569;
  background: #0b1220;
  color: #f8fafc;
  padding: 9px 10px;
  font-size: 14px;
}
textarea {
  width: 100%;
  font-family: inherit;
  resize: vertical;
}
button {
  cursor: pointer;
  border-color: #0ea5e9;
  background: #0284c7;
  font-weight: 700;
  min-height: 44px;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out, filter 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button.sub {
  border-color: #64748b;
  background: #334155;
}
button.sub.active {
  border-color: #f59e0b;
  background: #92400e;
}
button:active {
  transform: scale(0.96);
  filter: brightness(1.15);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.35);
}
button.sub:active {
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.3);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  filter: none;
  box-shadow: none;
}
.buttons {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* <a>要素をボタン風の導線として表示（編成/対戦への遷移など） */
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid #64748b;
  background: #334155;
  color: #f8fafc;
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 700;
  min-height: 44px;
  cursor: pointer;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out, filter 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-link:active {
  transform: scale(0.96);
  filter: brightness(1.15);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.3);
}
.nav-panel h2 {
  margin-bottom: 12px;
}
.detail-toggle-row {
  margin-top: 8px;
}
.card {
  border: 1px solid #1e293b;
  background: #0b1220;
  border-radius: 10px;
  padding: 10px;
  color: #cbd5e1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.card code {
  overflow-wrap: anywhere;
  word-break: break-all;
}
.monster-art {
  display: block;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 auto 8px;
  background: #0f172a;
}
.monster-art-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 12px;
  border: 1px dashed #334155;
}
.compact { font-size: 13px; }
.hidden { display: none; }
.hint {
  margin: 8px 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}
.save-status {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.save-status.ok { background: #052e16; border: 1px solid #16a34a; color: #86efac; }
.save-status.err { background: #450a0a; border: 1px solid #dc2626; color: #fca5a5; }

/* ── トレーディングカード風ビジュアルカード（app/card-render.js） ── */
.tcard-mount {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  perspective: 900px;
}
.tcard-mount.hidden { display: none; }

.tcard {
  --rarity-color: #9ca3af;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  --holo-opacity: 0.12;
  position: relative;
  width: min(320px, 100%);
  /* カードの縦横比は固定。幅の変化に応じて高さも同じ比率でスケールするだけで、
     内部レイアウトが崩れたり再配置されたりはしない。 */
  aspect-ratio: 5 / 7;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1622 0%, #2f2a44 100%);
  border: 2px solid var(--rarity-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-family: "YDWNightShader", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f1f5f9;
}

/* 触った/なぞった位置に応じて傾く物理カード風インタラクション（app/card-tilt.js） */
.tcard--tilt {
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 240ms ease-out, box-shadow 240ms ease-out;
  touch-action: none;
  cursor: grab;
}
.tcard--tilt.tcard--active {
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  cursor: grabbing;
}
.tcard--tilt.tcard--capturing {
  transition: none;
}

/* 光沢バンド: header/art/world/footerの各エリアに対応する帯。JS(computeGlossyRegions)が
   top/height(px)を計算して設定し、対象外のエリア（★1〜2のworld/footer等）はdisplay:noneにする。
   artバンドは--holo-opacityを個別に上書きして他エリアより1段階暗くする。 */
.tcard-glossy-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  display: none;
}

/* レアリティ別の虹色ホロ光沢。指/マウス位置(--mx,--my)に追従して動く */
.tcard-holo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--holo-opacity);
  mix-blend-mode: color-dodge;
  background: repeating-linear-gradient(
    115deg,
    #ff5ea8 0%,
    #ffd75e 12%,
    #7dffb3 24%,
    #5ec9ff 36%,
    #b57dff 48%,
    #ff5ea8 60%
  );
  background-size: 200% 200%;
  background-position: var(--mx) var(--my);
  transition: opacity 240ms ease-out;
}
.tcard--tilt.tcard--active .tcard-holo { opacity: calc(var(--holo-opacity) * 1.8); }

/* ★3: ゴールドの光沢（金色ハイライトが流れる） */
.tcard--gloss-gold .tcard-holo {
  background-image: linear-gradient(
    115deg,
    #b8860b 0%,
    #ffd700 25%,
    #fff6c8 50%,
    #ffd700 75%,
    #b8860b 100%
  );
}

/* ★2: シルバーの光沢（銀色ハイライトが流れる） */
.tcard--gloss-silver .tcard-holo {
  background-image: linear-gradient(
    115deg,
    #8b96a8 0%,
    #e3e6ee 25%,
    #ffffff 50%,
    #e3e6ee 75%,
    #8b96a8 100%
  );
}

/* ★1: 光沢(ホロ帯のスイープ)なし。属性グロー(枠の淡い発光)のみ残す */
.tcard--gloss-none .tcard-holo,
.tcard--gloss-none .tcard-shine {
  display: none !important;
}
.tcard--gloss-none {
  box-shadow: 0 0 10px 1px var(--element-glow-color, transparent);
}

/* ポインタ位置に追従する鏡面ハイライト（カードを傾けた時のガラスの反射感） */
.tcard-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at var(--mx) var(--my),
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.12) 30%,
    transparent 60%
  );
  transition: opacity 240ms ease-out;
}
.tcard--tilt.tcard--active .tcard-shine { opacity: 1; }

/* ★4限定: 名前・クラン情報エリアを金文字にする */
.tcard--legendary-gold .tcard-name,
.tcard--legendary-gold .tcard-world-line,
.tcard--legendary-gold .tcard-realm-panel {
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.35);
}
.tcard--legendary-gold .tcard-world-label {
  color: #f0c05a;
}
.tcard--legendary-gold .tcard-world-line rt,
.tcard--legendary-gold .tcard-realm-panel rt {
  color: #cbd5e1;
  text-shadow: none;
}

/* ★3限定: ★4と同じ構成だが、金文字ではなくシルバー文字にする */
.tcard--legendary-silver .tcard-name,
.tcard--legendary-silver .tcard-world-line,
.tcard--legendary-silver .tcard-realm-panel {
  color: #e3e6ee;
  text-shadow: 0 0 6px rgba(226, 232, 240, 0.35);
}
.tcard--legendary-silver .tcard-world-label {
  color: #b9bfcc;
}
.tcard--legendary-silver .tcard-world-line rt,
.tcard--legendary-silver .tcard-realm-panel rt {
  color: #cbd5e1;
  text-shadow: none;
}

/* ── カード拡大ビューア（app/card-zoom.js）: 画面幅に合わせて最大120%まで自動スケール、
   ピンチで144%まで追加拡大でき、指を離すと自動スケールへ戻る軽量モーダル ── */
.tcard-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(circle at 50% 40%, rgba(50, 40, 70, 0.95), rgba(5, 4, 10, 0.98));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.tcard-zoom-stage {
  /* overlayのpadding分を除いた利用可能幅いっぱいを基準に、JS側で--zoom-scaleを算出する。
     .tcard自体はwidth:min(320px,100%)のまま、ここでは幅の基準(100%)だけを提供する。 */
  width: 100%;
  display: flex;
  justify-content: center;
  /* .tcard-mountと同じ値のperspectiveを持たせないと3D傾きの奥行きが失われ、
     傾きの向きが実物(生成画面上のカード)と逆に見えてしまう。 */
  perspective: 900px;
  transform: scale(var(--zoom-scale, 1));
  transform-origin: center center;
  transition: transform 220ms ease-out;
  touch-action: none;
}
.tcard-zoom-stage--pinching {
  /* ピンチ操作中は指の動きに即座に追従させるためトランジションを切る */
  transition: none;
}
/* ピンチ中はcard-tilt.jsが計算するrotateX/Yを一時的に無効化し、傾きアニメを止める
   （ピンチ操作と3D傾きが同時に動くと視覚的に混乱するため）。 */
.tcard--pinch-locked {
  transform: none !important;
  transition: none !important;
}
.tcard-zoom-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.tcard-zoom-hint {
  margin-top: 28px;
  font-size: 12px;
  color: #cbd5e1;
  text-align: center;
}
.tcard-zoom-info {
  margin-top: 14px;
  font-size: 13px;
  color: #fde68a;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.tcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  /* 調整#6: 半透明にして下段のイラストを透けさせ、ネーム下部をイラストに被せる。 */
  background: rgba(26, 22, 34, 0.72);
  backdrop-filter: blur(2px);
  /* 常に内容が必要とする高さを保つ（伸縮しない）。イラストだけが余白を吸収する。 */
  flex: 0 0 auto;
  /* 引き上げられたイラストより手前に表示し、ネームを常に読めるようにする。 */
  position: relative;
  z-index: 4;
}
.tcard-name {
  font-family: "KuroHanaMincho", "YDWNightShader", sans-serif;
  font-size: 18.7px;
  font-weight: 800;
  text-align: left;
  flex: 1;
  letter-spacing: 0.02em;
}
.tcard-hp {
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tcard-hp span { font-size: 14px; margin-left: 3px; }
.tcard-hp .tcard-stat-buffed, .tcard-hp .tcard-stat-debuffed { color: #fff; }
.tcard-hp .tcard-stat-diff {
  display: inline-block;
  margin-left: 2px;
  padding: 0 3px;
  border-radius: 4px;
  font-weight: 800;
}
.tcard-hp .tcard-stat-buffed .tcard-stat-diff { background: #34d399; color: #06281d; }
.tcard-hp .tcard-stat-debuffed .tcard-stat-diff { background: #f87171; color: #3a0a0a; }

.tcard-art {
  position: relative;
  background: #262034;
  overflow: hidden;
  /* イラストエリアはヘッダー・ボディ・フッターが必要とする高さを差し引いた
     残りスペースをすべて吸収する（＝カード下半分のインフォメーションエリアと
     同じ幅のまま、上端はヘッダー直下に固定）。 */
  flex: 1 1 auto;
  min-height: 0;
}
.tcard-art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  /* 属性アイコン・レア度・クラン情報帯より必ず下に敷く */
  z-index: 0;
}
.tcard-art-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 13px;
  background: #262034;
  z-index: 0;
}
.tcard-element {
  font-family: "KuroHanaMincho", "YDWNightShader", sans-serif;
  position: absolute;
  /* 調整#6: イラスト上端がネーム中心まで上がるため、上部バッジもネーム下端より下へ。 */
  top: calc(var(--name-overlap, 26px) + 8px);
  left: 8px;
  background: rgba(15, 12, 22, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  /* イラスト画像より必ず手前に表示する */
  z-index: 2;
}
.tcard-element small { font-size: 12px; color: #cbd5e1; }
.tcard-rarity {
  position: absolute;
  /* 調整#6: ネーム下端より下へ（属性バッジと高さを揃える）。 */
  top: calc(var(--name-overlap, 26px) + 8px);
  right: 8px;
  background: rgba(15, 12, 22, 0.75);
  border: 1px solid var(--rarity-color);
  color: var(--rarity-color);
  border-radius: 10px;
  padding: 5px 8px;
  font-size: 13px;
  text-align: center;
  line-height: 1.3;
  z-index: 2;
}
.tcard-rarity small { display: block; font-size: 9px; letter-spacing: 0.06em; color: #cbd5e1; }

.tcard-world {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(63, 58, 82, 0.55);
  backdrop-filter: blur(2px);
  color: #e2e8f0;
  z-index: 2;
}
.tcard-world-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.tcard-world-line {
  font-family: "KuroHanaMincho", "YDWNightShader", sans-serif;
  font-size: 13px;
  line-height: 1.8;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
}
.tcard-world-label {
  color: #cbd5e1;
  font-weight: 600;
}
.tcard-world-line rt,
.tcard-realm-panel rt {
  font-size: 0.5em;
  color: #cbd5e1;
  font-family: "YDWNightShader", sans-serif;
}
.tcard-realm-panel {
  font-family: "KuroHanaMincho", "YDWNightShader", sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 8px;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.tcard-body {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 8px;
  /* 調整#4: フッター1行化に合わせてスキル・PSTパネルを数px下部寄りに（イラストを広げる）。 */
  margin-top: 5px;
  padding: 9px 14px 8px;
  /* 常に内容が必要とする高さを保つ（伸縮しない）。縮小するのはpadding/min-heightのみで、
     フォントサイズ・フォントファミリーは一切変更しない。 */
  flex: 0 0 auto;
}
.tcard-skill {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 6px 10px;
  min-height: 56px;
}
.tcard-skill-name {
  font-family: "BIZUDPMincho", "YDWNightShader", sans-serif;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.tcard-skill-flavor1 {
  font-family: "BIZUDPMincho", "YDWNightShader", sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 3px;
}
.tcard-skill-effect {
  font-family: "BIZUDPMincho", "YDWNightShader", sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: #fef3c7;
  line-height: 1.4;
  margin-bottom: 3px;
}
.tcard-skill-flavor2 {
  font-family: "BIZUDPMincho", "YDWNightShader", sans-serif;
  font-weight: 400;
  font-style: italic;
  /* 30〜35文字まで許容するため、元の11pxから10%縮小 */
  font-size: 10px;
  color: #cbd5e1;
  line-height: 1.4;
}
.tcard-stats { display: grid; gap: 5px; }
.tcard-stat {
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 5px 4px;
  font-weight: 700;
  font-size: 13px;
}
.tcard-stat-label {
  display: block;
  text-align: left;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
}
.tcard-stat-value {
  display: block;
  text-align: center;
}
.tcard-stat-buffed { color: #34d399; }
.tcard-stat-debuffed { color: #f87171; }
.tcard-stat-diff { font-size: 9px; margin-left: 1px; opacity: 0.85; }

.tcard-footer {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* M5.6: おや・初発見者バッジのみ。paddingを詰めてフッターを薄くし、パネル・ベルトを下部寄せに。 */
  padding: 4px 14px 7px;
  font-size: 10px;
  color: #94a3b8;
  text-align: center;
  /* 常に内容が必要とする高さを保つ（伸縮しない）。 */
  flex: 0 0 auto;
}

/* おや・初発見者バッジ群（フッター内・M5.6 #1/#2） */
.tcard-footer-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* 「おや：〇〇」バッジ（青メタリック） */
.tcard-origin-name-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border: 1px solid #7fb0ff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

/* 初発見者バッジ（origin.isMine のとき表示） */
.tcard-origin-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.5;
  color: #78350f;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  border: 1px solid #f59e0b;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
  white-space: nowrap;
}

/* ── スマホ最適化（〜600px）: 余白・タップ領域・1カラム化を調整 ── */
@media (max-width: 600px) {
  body {
    /* ノッチ/ホームインジケーター領域とUIが被らないようにする */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .hero {
    padding: 14px 12px;
  }
  .hero .brand-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .hero .brand-wordmark {
    height: 24px;
  }
  .site-nav {
    gap: 10px;
  }
  .hero p {
    font-size: 13px;
  }
  .container {
    padding: 12px;
    gap: 10px;
  }
  .panel {
    padding: 12px;
    border-radius: 10px;
  }
  .panel h2 {
    font-size: 16px;
  }
  .row {
    grid-template-columns: 1fr;
  }
  .row.buttons {
    grid-template-columns: 1fr;
  }
  input, select, button {
    font-size: 16px; /* iOSでの自動ズームを防止 */
  }
  .tcard-mount {
    margin: 12px 0;
  }
}

/* ── M5: Font Awesome ナビ・ボタンアイコン ── */
.site-nav a { display: inline-flex; align-items: center; gap: 0.32rem; }
.site-nav a i { font-size: 0.78rem; opacity: 0.85; }
.share-btn i, .del-btn i, .feed-like i, .feed-summon i, .feed-del i {
  font-size: 0.7rem;
}

/* ── M5: 押下フィードバック（iOSは振動API非対応のため視覚で代替） ── */
button:active, a.btn-link:active { transform: scale(0.96); filter: brightness(0.92); }
button, a.btn-link { -webkit-tap-highlight-color: transparent; }

/* ── M5: 共有ボーナスダイアログ（bonus-dialog.js が注入） ── */
.bonus-dialog {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,8,15,0.72); padding: 1rem;
}
.bonus-dialog-box {
  width: min(340px, 92vw); background: var(--card, #1a1622);
  border: 1px solid rgba(251,191,36,0.5); border-radius: 18px;
  padding: 1.4rem 1.2rem; text-align: center;
  box-shadow: 0 0 40px rgba(251,191,36,0.18);
}
.bonus-dialog-icon { font-size: 2.6rem; margin-bottom: 0.5rem; }
.bonus-dialog-msg {
  font-size: 0.92rem; font-weight: 800; color: var(--text, #f1f5f9);
  line-height: 1.7; margin-bottom: 1rem;
}
.bonus-dialog-ok {
  background: linear-gradient(135deg, #f59e0b, #fbbf24); border: none;
  color: #1a1305; border-radius: 999px; padding: 0.55rem 2.2rem;
  font-size: 0.9rem; font-weight: 800; cursor: pointer;
}

/* ── M5.9 #4: カード長押し時にテキストが選択されてしまうのを無効化 ── */
.tcard, .tcard *,
.mini-card, .mini-card *,
.tcard-mount, .tcard-mount * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ── M5.9 #5/6: 拡大表示（openCardZoomViewer）下部の操作ボタン ── */
.tcard-zoom-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}
.tcard-zoom-act {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.tcard-zoom-act:disabled { opacity: 0.5; cursor: default; }
.tcard-zoom-act i { font-size: 0.9rem; }
.tcard-zoom-act.act-danger {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.tcard-zoom-act.act-share {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
}
.tcard-zoom-act.act-share.shared {
  border-color: rgba(74, 222, 128, 0.55);
  background: rgba(74, 222, 128, 0.16);
  color: #4ade80;
}
.tcard-zoom-act.act-info {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

/* ── M5.9 #3: 全ページ共通のサイトヘッダー（ホームのindex.htmlと同一デザイン） ── */
/* CSS変数（--muted等）はHTMLごとに値が異なるため、実色で固定する。 */
header {
  background: linear-gradient(135deg, #1a1622, #2f2a44);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
header .brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
header .brand-icon { width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; }
header .brand-wordmark { height: 18px; display: block; }
header .site-nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}
header .site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #a3a0ad;
  text-decoration: none;
  white-space: nowrap;
}
header .site-nav a i { font-size: 0.78rem; opacity: 0.85; }
header .site-nav a.active { color: #f59e0b; }
header .site-nav a:hover { color: #f1f5f9; }
header .home-account {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
header .home-account .home-login-btn { padding: 0.45rem 1rem; font-size: 0.78rem; }
.home-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.home-user-email {
  font-size: 0.72rem;
  font-weight: 700;
  color: #a3a0ad;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-logout-btn { padding: 0.35rem 0.8rem; font-size: 0.72rem; }
.home-user-state { display: none; }
.home-role-badge {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #1a1305;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}
.home-admin-link {
  margin-left: 0.4rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #f59e0b;
  text-decoration: none;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.home-admin-link:hover { background: rgba(245, 158, 11, 0.12); text-decoration: none; }

/* ── 管理コンソール（admin.html） ─────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}
.admin-table th { color: #a3a0ad; font-weight: 600; white-space: nowrap; }
.admin-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; }
.admin-code-row { cursor: pointer; }
.admin-code-row:hover td { background: rgba(255, 255, 255, 0.04); }
.admin-list { margin-top: 0.5rem; overflow-x: auto; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.admin-tab {
  min-height: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #475569;
  background: transparent;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.85rem;
}
.admin-tab.active {
  background: #0284c7;
  border-color: #0ea5e9;
  color: #fff;
}
.admin-tab-panel.hidden { display: none; }
.admin-stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem 0;
}
.admin-stat-card {
  flex: 1 1 140px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
}
.admin-stat-card .label { display: block; font-size: 0.75rem; color: #94a3b8; }
.admin-stat-card .value { display: block; font-size: 1.2rem; font-weight: 700; color: #f8fafc; }
.msg-unread { border-color: #f59e0b; }
.lock-badge { color: #f87171; font-weight: 700; }

@media (max-width: 640px) {
  header { padding: 0.6rem 0.75rem; gap: 0.5rem; flex-wrap: wrap; }
  header .brand-icon { width: 24px; height: 24px; }
  header .brand-wordmark { height: 14px; }
  header .site-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 0.55rem 1rem;
    flex-wrap: wrap;
  }
  header .site-nav a { font-size: 0.7rem; }
  .home-user-email { display: none; }
  .home-user-state {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.66rem;
    font-weight: 800;
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.5);
    border-radius: 999px;
    padding: 0.16rem 0.5rem;
    background: rgba(74, 222, 128, 0.12);
  }
  .home-user-state::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.8);
  }
  .home-login-btn { padding: 0.35rem 0.8rem; font-size: 0.72rem; }
  .home-logout-btn { padding: 0.28rem 0.55rem; font-size: 0.66rem; }
}
