@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=Bai+Jamjuree:wght@400;500;600;700&display=swap');

/* =========================================================================
   DUEL MASTERS ASIA — DESIGN SYSTEM v2 "NEO ARCADE"
   -------------------------------------------------------------------------
   色の役割分担（これがこのサイトの配色ルール）:
     ・5文明色（水/光/闇/火/自然）= コンテンツの意味を表す色。UIには使わない。
     ・アクセント = ティールシアン。5文明が占めていない唯一の色相なので、
       「操作できるもの・インターフェース」の意味を独占できる。
       旧版の赤(#e8384f)は火文明と衝突していたため廃止。
   質感の原則:
     ・影とグラデーションで立体を作らない。1pxの線と余白で構造を作る。
     ・角丸は 2〜4px。アプリ風の大きな角丸は使わない。
   書体:
     ・Chakra Petch（見出し・ラベル・数値）/ Bai Jamjuree（本文）
     ・どちらもタイ文字を持つ。TH版が別書体に落ちないことがこの選定の理由。
   ========================================================================= */

:root {
  /* ---- ground（ニュートラルはアクセント側へわずかに寄せる） ---- */
  --c-bg:        #07090a;
  --c-bg-2:      #0b0f10;
  --c-surface:   #101516;
  --c-surface-2: #151c1d;

  /* ---- structure：影の代わりに線で構造を作る ---- */
  --c-line:      #1d2628;
  --c-line-2:    #2a3639;
  --c-line-hot:  #2de2c5;

  /* ---- ink ---- */
  --c-text:      #ecf2f1;
  --c-muted:     #7e8d8e;
  --c-faint:     #4e5a5c;

  /* ---- accent：UI専用。文明色とは絶対に混ぜない ---- */
  --c-accent:    #2de2c5;
  --c-accent-dim:#1aa38d;
  --c-accent-ink:#03110e;

  /* ---- 5 civilizations：コンテンツの意味を担う色 ---- */
  --c-water:     #3e8cff;
  --c-light:     #f6c445;
  --c-dark:      #9c6bff;
  --c-fire:      #ff5a4e;
  --c-nature:    #3cd16b;
  --c-gold:      #f6c445;

  /* ---- type ---- */
  --f-display: 'Chakra Petch', 'Bai Jamjuree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-body:    'Bai Jamjuree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ---- radius / metrics ---- */
  --r-sm: 2px;
  --r:    3px;
  --r-lg: 4px;
  --nav-h: 60px;
  --shell: 1200px;
  --pad:   20px;
  --measure: 68ch;

  /* 旧トークンの互換（既存ページが参照している名前を殺さない） */
  --c-border:      var(--c-line);
  --c-border-soft: var(--c-line);
  --c-accent-2:    var(--c-accent-dim);
  --shadow-card:   none;
  --shadow-raised: none;
  --glow-accent:   none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; background: var(--c-bg); }

body {
  font-family: var(--f-body);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: var(--nav-h);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--c-accent); color: var(--c-accent-ink); }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

/* =========================================================================
   NAV — モバイルでは下部バー、デスクトップでは上部固定バー。
   HTMLの位置に関係なく効くよう position:fixed のまま切り替える。
   ========================================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(7,9,10,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--c-line);
  display: flex;
  z-index: 999;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--c-faint);
  font-family: var(--f-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  transition: color .18s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bn-item.active { color: var(--c-accent); }
.bn-item:hover { color: var(--c-text); }
.bn-item.active::after {
  content: "";
  position: absolute; top: 0; left: 18%; right: 18%;
  height: 2px; background: var(--c-accent);
}
.bn-icon { font-size: 19px; line-height: 1; }

/* =========================================================================
   PAGE HEADER
   ========================================================================= */
.page-header {
  background: var(--c-bg-2);
  border-bottom: 1px solid var(--c-line);
  padding: 34px var(--pad) 26px;
}
.breadcrumb {
  font-family: var(--f-display);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-faint);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--c-faint); text-decoration: none; transition: color .15s; }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb-sep { opacity: .4; }

.page-header h1 {
  font-family: var(--f-display);
  font-size: clamp(28px, 4.4vw, 52px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.06;
  color: var(--c-text);
  margin-bottom: 10px;
  text-wrap: balance;
  max-width: 20ch;
}
.page-header .tagline {
  font-size: 14.5px;
  color: var(--c-muted);
  max-width: var(--measure);
}

/* =========================================================================
   LANG BAR
   ========================================================================= */
.lang-bar {
  background: rgba(7,9,10,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-line);
  padding: 10px var(--pad);
  display: flex;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.lang-btn {
  padding: 6px 16px;
  border-radius: var(--r-sm);
  font-family: var(--f-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-decoration: none;
  border: 1px solid var(--c-line);
  color: var(--c-muted);
  transition: border-color .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.lang-btn:hover { border-color: var(--c-line-2); color: var(--c-text); }
.lang-btn.active,
.lang-btn.lang-active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-ink);
}

/* =========================================================================
   SECTION
   ========================================================================= */
.section { padding: 30px var(--pad); }
.section + .section { border-top: 1px solid var(--c-line); }
.section-label {
  font-family: var(--f-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-line);
}
.section h2 {
  font-family: var(--f-display);
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--c-text);
  margin-bottom: 12px;
  line-height: 1.18;
  text-wrap: balance;
  max-width: 24ch;
}
.section h3 {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 8px;
}
.section p {
  font-size: 15.5px;
  color: var(--c-muted);
  line-height: 1.75;
  margin-bottom: 12px;
  max-width: var(--measure);
}
.section p:last-child { margin-bottom: 0; }
.section ul, .section ol { color: var(--c-muted); max-width: var(--measure); padding-left: 20px; margin-bottom: 12px; }
.section li { margin-bottom: 6px; font-size: 15.5px; }
.section a { color: var(--c-accent); }

/* =========================================================================
   CARD GRID — デスクトップで実際に横に並ぶのが今回の主眼
   ========================================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

/* =========================================================================
   KEYWORD CARD
   ========================================================================= */
.keyword-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 10px;
  display: block;
  text-decoration: none;
  color: var(--c-text);
  position: relative;
  transition: border-color .16s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.keyword-card::before {
  content: "";
  position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 2px; background: var(--c-accent);
  opacity: 0; transition: opacity .16s ease;
}
.keyword-card:hover { border-color: var(--c-line-2); background: var(--c-surface-2); }
.keyword-card:hover::before { opacity: 1; }
.card-grid .keyword-card { margin-bottom: 0; }

.keyword-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.keyword-badge {
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.keyword-card h3 {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--c-text);
  margin-bottom: 6px;
}
.keyword-card p {
  font-size: 13.5px;
  color: var(--c-muted);
  line-height: 1.6;
  margin: 0;
}
.keyword-arrow { font-size: 15px; color: var(--c-accent); flex-shrink: 0; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 18px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  border-radius: var(--r);
  border: 1px solid var(--c-accent);
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover { background: transparent; color: var(--c-accent); }

.btn-secondary {
  display: block;
  width: 100%;
  padding: 15px 18px;
  background: transparent;
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  text-align: center;
  text-decoration: none;
  border-radius: var(--r);
  border: 1px solid var(--c-line);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-secondary:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* =========================================================================
   TABLE
   ========================================================================= */
.table-scroll { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 14px;
  border: 1px solid var(--c-line);
  font-variant-numeric: tabular-nums;
}
.compare-table th {
  background: var(--c-surface);
  color: var(--c-muted);
  font-family: var(--f-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--c-line);
}
.compare-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--c-line);
  vertical-align: top;
  color: var(--c-text);
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table td:first-child { color: var(--c-muted); font-size: 13px; }

/* =========================================================================
   NOTICE / HIGHLIGHT
   ========================================================================= */
.notice {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 2px solid var(--c-accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 13px 16px;
  font-size: 13.5px;
  color: var(--c-muted);
  margin: 0 var(--pad) 18px;
  max-width: var(--measure);
}
.notice strong { color: var(--c-accent); font-weight: 600; }

.highlight {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 2px solid var(--c-gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 15px 17px;
  margin: 15px 0;
  font-size: 14.5px;
  color: var(--c-text);
  line-height: 1.7;
  max-width: var(--measure);
}

/* =========================================================================
   PRODUCT CARD
   ========================================================================= */
.product-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 12px;
  text-decoration: none;
  display: block;
  color: var(--c-text);
  transition: border-color .16s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.product-card:hover { border-color: var(--c-line-2); background: var(--c-surface-2); }
.card-grid .product-card { margin-bottom: 0; }

.product-card-thumb {
  height: 96px;
  background: var(--c-bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border-bottom: 1px solid var(--c-line);
}
.product-card-body { padding: 15px 16px; }
.product-card-code {
  font-family: var(--f-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--c-accent);
  margin-bottom: 6px;
}
.product-card-name {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 6px;
  line-height: 1.25;
}
.product-card-meta { font-size: 12.5px; color: var(--c-muted); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-family: var(--f-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-left: 6px;
}
.badge-new     { background: var(--c-accent); color: var(--c-accent-ink); }
.badge-starter { background: transparent; color: var(--c-water);  border: 1px solid currentColor; }
.badge-booster { background: transparent; color: var(--c-nature); border: 1px solid currentColor; }

/* =========================================================================
   BACK TO TOP
   ========================================================================= */
.back-to-top {
  display: block;
  text-align: center;
  margin: 30px var(--pad) 10px;
  padding: 15px 20px;
  border: 1px solid var(--c-line);
  border-radius: var(--r);
  color: var(--c-muted);
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  max-width: 320px;
  transition: border-color .16s ease, color .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* =========================================================================
   ICONS
   ========================================================================= */
.icn {
  width: 1em; height: 1em;
  display: inline-block;
  vertical-align: -0.14em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bn-icon { display: inline-flex; align-items: center; justify-content: center; }
.bn-icon .icn { width: 21px; height: 21px; stroke-width: 1.6; }
.entry-icon .icn { width: 21px; height: 21px; }
h1 .icn, h2 .icn, h3 .icn { margin-right: .35em; }
.btn-primary .icn, .btn-secondary .icn, .back-to-top .icn, .exit-btn .icn { margin-right: .4em; }
.quiz-opt .icn { margin-right: .55em; }

/* 文明色：コンテンツの意味を表す色。UIには使わない */
.icn-fire   { color: var(--c-fire); }
.icn-water  { color: var(--c-water); }
.icn-nature { color: var(--c-nature); }
.icn-light  { color: var(--c-light); }
.icn-dark   { color: var(--c-dark); }

/* =========================================================================
   TABLET — 2カラムへ
   ========================================================================= */
@media (min-width: 700px) {
  :root { --pad: 32px; }
  body { font-size: 16.5px; }
}

/* =========================================================================
   DESKTOP — 旧版の「body max-width:480px」を撤廃。
   幅は使う。ただし本文の行長は --measure で抑える。
   ========================================================================= */
@media (min-width: 900px) {
  :root { --pad: 40px; }

  body {
    max-width: var(--shell);
    margin: 0 auto;
    padding-top: var(--nav-h);
    padding-bottom: 60px;
    border-left: 1px solid var(--c-line);
    border-right: 1px solid var(--c-line);
    font-size: 17px;
  }

  /* 下部タブバー → 上部固定ナビへ */
  .bottom-nav {
    top: 0; bottom: auto;
    height: var(--nav-h);
    max-width: var(--shell);
    margin: 0 auto;
    border-top: none;
    border-bottom: 1px solid var(--c-line);
    justify-content: flex-start;
    padding: 0 calc(var(--pad) - 14px);
  }
  .bn-item {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 9px;
    padding: 0 14px;
    font-size: 12px;
  }
  .bn-item.active::after { top: auto; bottom: 0; left: 14px; right: 14px; }

  .lang-bar { top: var(--nav-h); }

  .page-header { padding: 56px var(--pad) 40px; }
  .section { padding: 44px var(--pad); }

  .notice, .back-to-top { margin-left: var(--pad); margin-right: var(--pad); }

  /* ボタンは全幅に伸ばさない */
  .btn-primary, .btn-secondary { display: inline-block; width: auto; min-width: 260px; margin-right: 10px; }
}

@media (min-width: 1240px) {
  body { border-left: 1px solid var(--c-line); border-right: 1px solid var(--c-line); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
