/* 潮間相望（Tideline）單人介面：極簡塔羅。
   夜海牌桌；難題是細長的整面塗色卡：數字、分數菱形、插畫或剪影、名稱，下緣三色圓圈表示誰打了多少；
   行動卡是米白卡面、雙角數字；兩族各有一枚徽章。 */
:root {
  /* 牌桌 */
  --night: #0f1b21;
  --sea: #13262e;
  --land: #2a2219;
  --felt: #0b1519;
  /* 卡面與文字 */
  --cream: #efe6d2;
  --cream-2: #ddd1b6;
  --ink: #1c1a17;          /* 米白卡面上的字 */
  --muted: #c2ccc9;        /* 夜色上的次要字（≥ 7:1） */
  --line: rgba(239, 230, 210, .22);
  --line-2: rgba(239, 230, 210, .45);
  /* 功能色 */
  --gold: #e3b65c;         /* 可操作、已選取 */
  --gold-deep: #c99a3f;
  --warn: #e2475a;         /* 淺灘：快要出事（帶藍的血紅；爆發用偏橘的 --danger） */
  --danger: #ef6a52;       /* 爆發：已經出事 */
  --tide: #8fcfa4;         /* 繁榮 */
  /* 四色難題：低彩度塔羅底色，一律附文字 */
  --dis: #92381f;          /* 與災害插畫底色一致 */
  --mon: #3c3a5d;          /* 與怪獸插畫底色一致 */
  --ill: #4c5c3d;          /* 與疾病插畫底色一致 */
  --res: #74551c;          /* 與資源插畫底色一致 */
  /* 難題卡進度圓圈：誰打的（暫定） */
  --src-island: #d9b48a;
  --src-sea: #7fc4c9;
  --src-precedent: var(--gold);

  --serif: "LXGW WenKai TC", "Kaiti TC", "DFKai-SB", "BiauKai", var(--sans-stack);
  --num: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --sans-stack: system-ui, -apple-system, "Microsoft JhengHei", sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40'%3E%3Cpath d='M0 20c10-6 20-6 30 0s20 6 30 0 20-6 30 0 20 6 30 0' fill='none' stroke='%23efe6d2' stroke-opacity='.07' stroke-width='1.2'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-color: #3a4a50 var(--night); }
body {
  background: var(--grain), var(--night);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--gold); color: var(--ink); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; font-family: var(--serif); font-weight: 400; text-wrap: balance; }
p { margin: 0 0 8px; }
.bad { color: var(--danger); }

/* ---------- 按鈕 ---------- */
button { font: inherit; color: inherit; }
:where(.actions, .modal-box, .phrases, .log, .seat, .title-card, .role-card) button:where(:not(.term, .choice, .hcard, .mini)) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 6px 18px; margin: 4px 8px 4px 0;
  background: transparent; color: var(--cream);
  border: 1px solid var(--line-2); border-radius: 999px;
  cursor: pointer; transition: border-color .15s, background-color .15s, color .15s;
}
:where(.actions, .modal-box, .phrases, .seat) button:where(:not(.term, .choice, .hcard, .mini, .primary)):hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
button.primary { background: var(--gold) !important; color: var(--ink) !important; border-color: var(--gold) !important; font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--gold-deep) !important; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.term {
  background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; cursor: help;
  text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-thickness: 1px; text-decoration-color: var(--line-2);
}
.tip {
  position: absolute; z-index: 60; max-width: 320px;
  background: var(--cream); color: var(--ink);
  padding: 12px 14px; border-radius: 10px; font-size: 15px; line-height: 1.6;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.ctag { display: inline-block; font-size: 13px; padding: 0 6px; border-radius: 4px; color: var(--cream); margin-right: 4px; }
.ctag.c-dis { background: var(--dis); } .ctag.c-mon { background: var(--mon); } .ctag.c-ill { background: var(--ill); } .ctag.c-res { background: var(--res); }

/* ---------- 徽章 ---------- */
.medal {
  display: inline-grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--cream); color: var(--cream);
}
.medal.r-island { background: var(--land); }
.medal.r-sea { background: var(--sea); }
.medal svg { width: 30px; height: 30px; }
/* 角色徽章插畫本身就有圓框：不再加外框，圖片裁成圓形 */
.medal { border: 0; overflow: hidden; }
.medal img { width: 100%; height: 100%; display: block; border-radius: 50%; user-select: none; }

/* ---------- 起始畫面 ---------- */
.start { max-width: 980px; margin: 0 auto; padding: 40px 20px 56px; }
.title-screen {
  max-width: none; min-height: 100vh; margin: 0; padding: 24px 16px;
  display: grid; place-items: center;
  background: var(--grain), var(--waves), radial-gradient(ellipse at 50% 120%, #22383f 0%, var(--night) 60%);
}
.title-card {
  max-width: 520px; text-align: center; padding: 48px 44px 40px;
  border: 1px solid var(--line-2); border-radius: 18px; position: relative;
}
.title-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--line); border-radius: 12px; pointer-events: none; }
.title-card h1 { font-size: 52px; letter-spacing: .2em; margin: 0 0 4px; padding-left: .2em; }
.title-card .en { display: block; font-size: 13px; letter-spacing: .5em; color: var(--muted); margin-bottom: 28px; padding-left: .5em; }
.title-card .scale { display: flex; justify-content: center; gap: 10px; margin: 24px 0; }
.title-card .scale i { width: 4px; height: 4px; border-radius: 50%; background: var(--line-2); }
.story p { margin: 0 0 14px; line-height: 2; color: var(--cream-2); }
button.big { font-size: 18px; min-height: 52px !important; padding: 10px 56px !important; }

/* 角色選擇：兩張直立的大卡 */
.start > h1 { font-size: 32px; text-align: center; letter-spacing: .12em; }
.shared-intro { max-width: 640px; margin: 0 auto; text-align: center; color: var(--cream-2); }
.shared-intro p { margin: 4px 0; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin: 32px 0; }
.role-card {
  padding: 28px 28px 24px; min-width: 0; border-radius: 18px; position: relative;
  border: 6px solid var(--cream); box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.role-card.r-island { background: var(--grain), var(--land); }
.role-card.r-sea { background: var(--grain), var(--waves), var(--sea); }
.role-card .medal { width: 96px; height: 96px; margin-bottom: 12px; }
.role-card .medal svg { width: 40px; height: 40px; }
.role-card h2 { font-size: 34px; letter-spacing: .14em; margin-bottom: 2px; }
.tagline { font-family: var(--serif); font-size: 17px; color: var(--gold); margin: 0 0 14px; }
.role-card .intro { color: var(--cream-2); }
.role-card .feel { border-top: 1px dotted var(--line-2); border-bottom: 1px dotted var(--line-2); padding: 10px 0; margin: 14px 0; }
.role-card details { margin: 12px 0 16px; }
.role-card summary { cursor: pointer; color: var(--gold); list-style: none; }
.role-card summary::-webkit-details-marker { display: none; }
.role-card summary::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s; }
.role-card details[open] summary::before { transform: rotate(45deg); }
.role-card h3 { font-size: 16px; margin-top: 12px; }
.role-card ul { margin: 4px 0; padding-left: 20px; }
.stats { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0; }
.stats th, .stats td { border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top; }
.stats th:nth-child(-n+2), .stats td:nth-child(-n+2) { white-space: nowrap; }
.stats tr.key td { color: var(--gold); }
.seed-note { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- 主畫面：夜海牌桌 ---------- */
.game { max-width: 1440px; margin: 0 auto; padding: 0 24px 24px; }
.pacts { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.seat-opp .backs + .pacts, .seat-opp .revealed + .pacts { margin-left: 16px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 10px; font-size: 14px; color: var(--cream); }
.chip.used { opacity: .55; border-style: dashed; }
.table {
  border-radius: 22px; overflow: hidden; position: relative;
  background: var(--grain), linear-gradient(var(--sea), #112027 45%, #1c1d18 80%, var(--land));
  box-shadow: inset 0 0 0 1px var(--line), 0 24px 60px rgba(0, 0, 0, .4);
}

/* 座位 */
.seat { display: flex; align-items: center; gap: 22px; padding: 14px 24px; position: relative; flex-wrap: nowrap; }
.seat-opp { background: var(--waves); border-bottom: 1px dotted var(--line-2); }
.seat-me { border-top: 1px dotted var(--line-2); }
.seat-head { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.seat-title { display: grid; line-height: 1.15; }
.seat-name { font-family: var(--serif); font-size: 24px; letter-spacing: .14em; }
.seat-who { font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.seat-me .seat-who { color: var(--gold); }
.seat > .stats { display: flex; align-items: center; gap: 26px; }
.stat { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.stat-name { font-size: 15px; color: var(--muted); }
.stat-num { font-family: var(--serif); font-size: 34px; line-height: 1; font-weight: 700; min-width: 1.1em; }
.stat:not(.sens) .stat-num { font-size: 24px; font-weight: 400; color: var(--cream-2); }
/* 插栓軌：1–3 是淺灘 */

.flag { font-size: 14px; font-weight: 700; color: var(--night); background: var(--warn); padding: 3px 12px; border-radius: 999px; }
.flag .term { text-decoration-color: rgba(0, 0, 0, .4); }
.stat.warn .flag { animation: pulse 1.6s var(--ease-out) 3; }
@keyframes pulse { 50% { opacity: .55; } }
.pros { display: flex; align-items: baseline; gap: 8px; margin-left: auto; color: var(--muted); white-space: nowrap; }
.pros b { font-family: var(--serif); font-size: 34px; color: var(--tide); line-height: 1; }
.seat-opp .backs { margin-left: auto; }
.backs { display: flex; align-items: center; padding-left: 8px; }
.back {
  width: 22px; height: 32px; margin-left: -8px; border-radius: 4px;
  background: var(--waves), var(--sea); border: 2px solid var(--cream);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.revealed { display: flex; gap: 6px; }
.details {
  position: absolute; z-index: 8; right: 24px; top: calc(100% - 6px);
  display: grid; grid-template-columns: auto auto; gap: 6px 16px; margin: 0;
  background: var(--cream); color: var(--ink); border-radius: 12px; padding: 14px 18px; font-size: 15px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
}
.seat-me .details { top: auto; bottom: calc(100% - 6px); }
.details dt { color: #5a5348; }
.details dd { margin: 0; font-weight: 700; }

/* 航道 */
.rows { display: grid; gap: 4px; padding: 14px 24px; }
.lane { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: center; padding: 6px 0; }
.lane + .lane { border-top: 1px dotted var(--line); }
.lane-head { display: grid; gap: 4px; padding: 8px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.lane-head:hover { border-color: var(--line); }
.lane-head.selected { border-color: var(--gold); background: rgba(227, 182, 92, .1); }
.lane-name { font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: .06em; }
.lane-sum { font-size: 15px; color: var(--muted); }
.lane-sum b { font-family: var(--serif); font-size: 20px; color: var(--cream); }
.lane-cards { display: flex; gap: 14px; overflow-x: auto; padding: 6px 4px 12px; }
.empty { color: var(--muted); font-size: 15px; padding: 8px; }

/* 難題卡：細長直式，比例約 1:1.85。上半是實體卡面（數字、分數、圖案、名稱），下緣是數位版專用的進度區 */
.pcard {
  --card-bg: var(--dis); --w: 92px;
  flex: 0 0 var(--w); width: var(--w); aspect-ratio: 1 / 1.7; position: relative; cursor: pointer;
  display: flex; flex-direction: column; overflow: hidden; border-radius: 5px;
  background: var(--card-bg); color: var(--cream);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .45);
  transition: transform .2s var(--ease-out), box-shadow .2s;
}
/* 顆粒疊在最上層，插畫和卡面才會是同一個質地，看不出圖片邊界 */
.pcard::after { content: ""; position: absolute; inset: 0; background: var(--grain); pointer-events: none; }
.pcard.c-dis { --card-bg: var(--dis); } .pcard.c-mon { --card-bg: var(--mon); } .pcard.c-ill { --card-bg: var(--ill); } .pcard.c-res { --card-bg: var(--res); }
/* --ft 外框上緣的位置、--bd 數字半圓的寬度、--nh 名稱牌高度（下框線穿過名稱牌中心） */
/* 內框 --fl 較清楚、外框 --fo 較淡，兩層才有前後關係，不會擠成一團 */
.pcard .pface { --fr: 7px; --fl: rgba(239, 230, 210, .5); --fo: rgba(239, 230, 210, .26); --ft: 5px; --bd: 54px; --nh: 18px; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 2px 0; position: relative; }
/* 實體卡面的細裝飾框：四個角是向內凹的四分之一圓（::before 畫直線並挖掉角落，::after 畫凹弧）。
   數字、圖案、名稱都在框內；數位版的進度區在框外 */
.pcard .pface::before, .pcard .pface::after { content: ""; position: absolute; inset: calc(var(--ft) + 3px) 8px calc(2px + var(--nh) / 2); pointer-events: none; z-index: 1; }
/* 外層框：比內框往外 3px 的第二道線，四個角各一個小圓點 */
.pcard .pdeco {
  position: absolute; inset: calc(var(--ft) - 3px) 2px calc(var(--nh) / 2 - 4px); pointer-events: none; z-index: 1;
  --dot: var(--fo) 1.6px, transparent 2.2px;
  background:
    radial-gradient(circle at 3.5px 3.5px, var(--dot)) 0 0 / 7px 7px no-repeat,
    radial-gradient(circle at 3.5px 3.5px, var(--dot)) 100% 0 / 7px 7px no-repeat,
    radial-gradient(circle at 3.5px 3.5px, var(--dot)) 0 100% / 7px 7px no-repeat,
    radial-gradient(circle at 3.5px 3.5px, var(--dot)) 100% 100% / 7px 7px no-repeat;
}
.pcard .pdeco::before { content: ""; position: absolute; inset: 3px; border: 1px solid var(--fo); }
.pcard .pface::before {
  border: 1px solid var(--fl);
  --hole: transparent calc(var(--fr) + .5px), #000 calc(var(--fr) + 1px);
  -webkit-mask-image: radial-gradient(circle at 0 0, var(--hole)), radial-gradient(circle at 100% 0, var(--hole)), radial-gradient(circle at 0 100%, var(--hole)), radial-gradient(circle at 100% 100%, var(--hole));
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(circle at 0 0, var(--hole)), radial-gradient(circle at 100% 0, var(--hole)), radial-gradient(circle at 0 100%, var(--hole)), radial-gradient(circle at 100% 100%, var(--hole));
  mask-composite: intersect;
}
.pcard .pface::after {
  --ring: transparent calc(var(--fr) - .5px), var(--fl) calc(var(--fr) - .5px), var(--fl) calc(var(--fr) + .5px), transparent calc(var(--fr) + .5px);
  background:
    radial-gradient(circle at 0 0, var(--ring)) 0 0 / calc(var(--fr) + 1px) calc(var(--fr) + 1px) no-repeat,
    radial-gradient(circle at 100% 0, var(--ring)) 100% 0 / calc(var(--fr) + 1px) calc(var(--fr) + 1px) no-repeat,
    radial-gradient(circle at 0 100%, var(--ring)) 0 100% / calc(var(--fr) + 1px) calc(var(--fr) + 1px) no-repeat,
    radial-gradient(circle at 100% 100%, var(--ring)) 100% 100% / calc(var(--fr) + 1px) calc(var(--fr) + 1px) no-repeat;
}
/* 數字放在上框線中央向下的雙層半圓裡；名稱嵌在下框線中央的名牌裡 */
.pcard .pdiff {
  position: relative; z-index: 2; flex: none; width: var(--bd); height: calc(var(--bd) / 2 + 3px); box-sizing: border-box;
  margin-top: calc(var(--ft) - 2px); padding-bottom: 3px; display: grid; place-items: center;
  border: 1px solid var(--fo); border-top: 0; border-radius: 0 0 999px 999px;
  font-family: var(--serif); font-size: 22px; line-height: 1; font-weight: 700;
}
/* 內層半圓：接在內框線上；用卡面底色蓋掉穿過半圓內部的內框線 */
.pcard .pdiff::before {
  content: ""; position: absolute; z-index: -1; top: 3px; left: 4px; right: 4px; bottom: 4px;
  border: 1px solid var(--fl); border-top: 0; border-radius: 0 0 999px 999px; background: var(--card-bg);
}
.pcard .pts { display: flex; justify-content: center; gap: 2px; min-height: 8px; margin-top: 4px; }
.pcard .pts .pt { width: 8px; height: 8px; fill: var(--gold); }
/* 圖案收在內框裡，靠上對齊（中間偏上）；方圖、直式圖都依原比例縮進可用空間；名稱貼底 */
.pcard .part { flex: 1 1 0; min-height: 0; width: 100%; box-sizing: border-box; padding: 0 11px; margin: 4px 0 3px; display: flex; justify-content: center; align-items: flex-start; overflow: hidden; }
.pcard .part img {
  width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none;
  /* 邊緣淡出，蓋掉插畫與卡面之間的細微色差 */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent);
  mask-composite: intersect;
}
.pcard .part .emb { width: 58%; height: auto; aspect-ratio: 1; opacity: .95; }
.pcard .pname {
  position: relative; z-index: 2; margin-top: auto; height: var(--nh); box-sizing: border-box; padding: 0 7px; display: grid; place-items: center;
  border: 1px solid var(--fl); border-radius: 3px; background: var(--card-bg);
  font-family: var(--serif); font-size: 12px; line-height: 1; font-weight: 400; letter-spacing: .04em; white-space: nowrap;
}
.pcard .ptrack {
  flex: 0 0 auto; display: flex; flex-wrap: nowrap; justify-content: center; gap: 2px; padding: 5px 2px 6px;
  background: rgba(0, 0, 0, .3); border-top: 1px solid var(--line-2);
}
.pcard .ptrack i { width: 5px; height: 5px; border-radius: 50%; border: 1px solid var(--cream); opacity: .6; }
.pcard .ptrack i[class] { opacity: 1; }
.pcard .ptrack i.src-island { background: var(--src-island); border-color: var(--src-island); }
.pcard .ptrack i.src-sea { background: var(--src-sea); border-color: var(--src-sea); }
.pcard .ptrack i.src-precedent { background: var(--src-precedent); border-color: var(--src-precedent); }
.pcard:hover { transform: translateY(-3px); }
.pcard.selected { transform: translateY(-6px); box-shadow: 0 0 0 3px var(--gold), 0 14px 26px rgba(0, 0, 0, .55); }
.pcard.blocked { filter: grayscale(.7) brightness(.6); }

/* 托盤：扇形手牌與操作 */

.hand { display: flex; align-items: flex-end; padding: 22px 0 4px 14px; overflow-x: auto; min-height: 160px; }
.hcard {
  flex: 0 0 auto; background: none; border: 0; padding: 0; margin-left: -14px; cursor: pointer; border-radius: 10px;
  transform: rotate(var(--r, 0deg)) translateY(var(--y, 0px)); transform-origin: 50% 120%;
  transition: transform .22s var(--ease-out);
}
.hcard[aria-disabled="true"] { cursor: default; }
.hcard:not([aria-disabled="true"]):hover { transform: rotate(var(--r, 0deg)) translateY(calc(var(--y, 0px) - 8px)); z-index: 2; }
.hcard.on { transform: rotate(0deg) translateY(-22px); z-index: 3; }
.hand-count { align-self: center; margin-left: 18px; color: var(--muted); font-size: 14px; white-space: nowrap; }

/* 行動卡：米白卡面，固定 88 × 126 */
.acard {
  --c: var(--dis);
  width: 88px; height: 126px; position: relative; display: grid; place-items: center;
  background: var(--cream); color: var(--c); border-radius: 10px;
  border: 3px solid var(--cream); outline: 1.5px solid var(--c); outline-offset: -8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
}
.acard.c-dis { --c: var(--dis); } .acard.c-mon { --c: var(--mon); } .acard.c-ill { --c: var(--ill); } .acard.c-res { --c: var(--res); }
.acard .idx { position: absolute; top: 9px; left: 11px; display: grid; justify-items: center; line-height: 1; }
.acard .idx b { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.acard .idx small { font-size: 12px; margin-top: 2px; letter-spacing: .05em; color: var(--ink); }
.acard .emb { width: 36px; height: 36px; margin-top: 12px; }
.acard.special .emb { margin-top: -6px; }
.hcard.on .acard { box-shadow: 0 0 0 3px var(--gold), 0 16px 26px rgba(0, 0, 0, .55); }
.acard.small { width: 60px; height: 86px; outline-offset: -6px; }
.acard.small .idx b { font-size: 18px; }
.acard.small .idx small { display: none; }
.acard.small .emb { width: 26px; height: 26px; margin-top: 10px; }

.actions { display: flex; flex-direction: column; gap: 8px; padding-left: 24px; border-left: 1px dotted var(--line-2); min-height: 126px; justify-content: flex-end; }
.act-body { display: flex; flex-wrap: wrap; align-items: center; }
.act-body p { flex-basis: 100%; }
.ask { font-family: var(--serif); font-size: 19px; margin: 0 0 4px; }
.flavor { display: block; font-family: var(--sans); font-size: 15px; color: var(--muted); margin-top: 2px; }
.result { font-size: 17px; margin: 0 0 4px; }
.note { font-size: 15px; color: var(--muted); margin: 0 0 4px; }
.status { font-size: 15px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status b { color: var(--gold); margin-right: 6px; font-weight: 700; }
.status.err { color: var(--danger); }
.order { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; margin-bottom: 4px; flex-basis: 100%; }
.oi { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; padding: 1px 10px; }
.oi .mini { border: 0; background: none; color: var(--gold); cursor: pointer; padding: 0 0 0 6px; font-size: 15px; }

/* 紀錄 */

.log { flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; }
.log h3 { font-size: 20px; letter-spacing: .2em; color: var(--cream); border-bottom: 1px dotted var(--line-2); padding-bottom: 8px; }
.entries { list-style: none; margin: 0; padding: 0; }
.entry { font-size: 15px; line-height: 1.55; padding: 7px 0; color: var(--cream-2); border-bottom: 1px solid rgba(239, 230, 210, .08); }
.k-round { font-family: var(--serif); color: var(--gold); padding-top: 14px; letter-spacing: .08em; }
.k-burst, .k-err { color: var(--danger); }
.k-pact { color: #c3b6f0; }
.k-skill { color: var(--gold); }   /* 行動方針（揭曉、拿牌）：玩家的選擇用金色；血紅只留給淺灘預警 */
.k-talk-bot { color: var(--cream); }
.k-talk-me { color: var(--gold); }
.k-over { font-weight: 700; color: var(--cream); }
.phrases { border-top: 1px dotted var(--line-2); padding-top: 10px; }
.phrase-list { display: flex; flex-wrap: wrap; }
.phrase-list .note { flex-basis: 100%; margin-top: 8px; }
.phrase-list button { min-height: 34px !important; font-size: 14px; padding: 3px 12px !important; }

/* ---------- 對話框：米白的大卡 ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 11, 14, .72); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box {
  background: var(--grain), var(--cream); color: var(--ink);
  border-radius: 18px; padding: 30px 32px 26px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; position: relative;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
  animation: rise .4s var(--ease-out);
}
.modal-box::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(28, 26, 23, .25); border-radius: 12px; pointer-events: none; }
@keyframes rise { from { transform: translateY(16px) scale(.98); opacity: .3; } to { transform: none; opacity: 1; } }
.modal-box h2 { font-size: 28px; letter-spacing: .08em; }
.modal-box h3 { font-size: 17px; margin-top: 14px; }
.modal-box .term { text-decoration-color: rgba(28, 26, 23, .4); }
.modal-box button:where(:not(.term, .choice, .hcard, .mini)) { color: var(--ink); border-color: rgba(28, 26, 23, .4); }
.modal-box button.primary { background: var(--ink) !important; color: var(--cream) !important; border-color: var(--ink) !important; }
.modal-box .lines { padding-left: 20px; margin: 8px 0; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.choice {
  display: flex; flex-direction: column; gap: 6px; text-align: left; min-height: 120px;
  background: transparent; border: 1.5px solid rgba(28, 26, 23, .35); border-radius: 14px; padding: 16px; cursor: pointer; color: var(--ink);
  transition: border-color .15s, transform .2s var(--ease-out);
}
.choice:hover { border-color: var(--ink); transform: translateY(-2px); }
.choice b { font-family: var(--serif); font-size: 26px; letter-spacing: .1em; }
.choice.static { cursor: default; min-height: 0; margin: 6px 0 10px; }
.burst-log { font-size: 15px; color: #6b2b1f; }

.flip-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 14px; perspective: 900px; }
.flip { height: 190px; position: relative; transform-style: preserve-3d; animation: flip .9s var(--ease-out) both; }
.flip:nth-child(2) { animation-delay: .08s; }
.flip > div { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px; border: 5px solid var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.flip .back { background: var(--waves), var(--sea); color: var(--cream); letter-spacing: .4em; font-family: var(--serif); }
.flip > .back { width: auto; height: auto; margin: 0; border: 5px solid var(--ink); border-radius: 14px; }   /* 不吃電腦手牌牌背 .back 的 18×26 尺寸 */
.flip .face { transform: rotateY(180deg); color: var(--cream); }
.flip .face.f-island { background: var(--grain), var(--land); }
.flip .face.f-sea { background: var(--grain), var(--waves), var(--sea); }
.flip .face .who { font-size: 14px; color: var(--cream-2); }
.flip .face b { font-family: var(--serif); font-size: 36px; letter-spacing: .2em; }
.flip .face.c-talk b { color: var(--gold); }
@keyframes flip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.outcome { font-family: var(--serif); font-size: 18px; text-align: center; margin: 4px 0 12px; }

.modal-box .statecard h2 { font-size: 34px; color: #8e2433; }
.helpdoc p { font-size: 15px; }
.bands { width: 100%; border-collapse: collapse; font-size: 15px; }
.bands td { padding: 4px 6px; border-bottom: 1px solid rgba(28, 26, 23, .15); }
.bands tr.now td { font-weight: 700; color: #6b4b10; }

/* 結局 */
.modal.m-end { background: var(--grain), var(--waves), radial-gradient(ellipse at 50% 120%, #22383f 0%, var(--night) 60%); }
.modal.m-end .modal-box { max-width: 560px; text-align: center; padding: 44px 40px 30px; }
.end-kicker-line { display: flex; justify-content: center; gap: 10px; margin: 0 auto 18px; }
.end-kicker-line i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); opacity: .5; }
.modal-box .end-title { font-size: 52px; letter-spacing: .18em; line-height: 1.2; margin: 0 0 8px; padding-left: .18em; }
.modal-box .end-title.fail { color: #8e2a1f; }
.end-reason { color: #5a5348; margin-bottom: 22px; }
.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 20px; text-align: center; border-top: 1px dotted rgba(28, 26, 23, .4); border-bottom: 1px dotted rgba(28, 26, 23, .4); }
.end-stats div { padding: 10px 6px; font-size: 14px; color: #5a5348; }
.end-stats div b { display: block; font-family: var(--serif); font-size: 24px; color: var(--ink); }
.end-foot { margin-top: 18px; font-size: 13px; color: #5a5348; }
.end-foot code, .seed code { background: rgba(28, 26, 23, .08); padding: 0 5px; border-radius: 4px; user-select: all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 平板 ---------- */
@media (max-width: 1180px) {
  .actions { border-left: 0; padding-left: 0; border-top: 1px dotted var(--line-2); padding-top: 12px; min-height: 0; }
  .seat { flex-wrap: wrap; gap: 12px 20px; }
}

/* ---------- 手機 ---------- */
@media (max-width: 900px) {
  body { font-size: 15px; }
  .game { padding: 0 0 66px; }
  .table { border-radius: 0; }
  .seat { padding: 10px 14px; gap: 8px 14px; flex-wrap: wrap; }
  .medal { width: 38px; height: 38px; } .medal svg { width: 24px; height: 24px; }
  .seat-name { font-size: 20px; }
  .seat > .stats { gap: 14px; flex-wrap: wrap; }
  .stat-num { font-size: 26px; }
  .seat-opp .backs { display: none; }
  .pros b { font-size: 26px; }
  .details { right: 12px; left: 12px; }
  .rows { padding: 8px 14px; }
  .lane { grid-template-columns: 1fr; gap: 6px; }
  .lane-head { grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; padding: 4px 6px; }
  .lane-name { font-size: 20px; }
  .hand { min-height: 0; padding: 14px 0 2px 14px; }
  .acard { width: 70px; height: 100px; }
  .acard .idx b { font-size: 20px; }
  .acard .emb { width: 28px; height: 28px; }
  .actions { padding-top: 8px; }
  .actions button { min-height: 44px; }
  .status { -webkit-line-clamp: 1; font-size: 14px; }
  .flavor { display: none; }
  .badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 6px; margin-left: 6px; }
  .choices, .role-pick { grid-template-columns: 1fr; }
  .title-card { padding: 36px 22px 30px; }
  .title-card h1 { font-size: 40px; }
  .modal-box { padding: 24px 20px 20px; }
  .modal-box .end-title { font-size: 40px; }
  .end-stats { grid-template-columns: 1fr 1fr; }
  .flip { height: 150px; }
}

/* 第一屏收在 900px 內 */
@media (min-width: 901px) {
  .seat { padding: 10px 24px; }
  .rows { padding: 8px 24px; gap: 0; }
  .lane { padding: 4px 0; }
  .lane-cards { padding: 4px 4px 10px; }
  .hand { min-height: 0; padding-top: 18px; }
}
.back { margin-left: -12px; border-width: 1.5px; border-color: rgba(239, 230, 210, .75); }
@media (max-width: 900px) {
  .table { overflow: visible; }
}
.hand { padding-left: 22px; padding-bottom: 10px; overflow: visible; flex-wrap: nowrap; }
@media (max-width: 900px) { .hand { overflow-x: auto; } }

/* 數字用無襯線粗體，好讀；文字標題用文楷 */
.pcard .pdiff, .stat-num, .pros b, .acard .idx b, .lane-sum b, .end-stats div b, .flip .face b.num { font-family: var(--num); font-weight: 700; letter-spacing: 0; }
.stat:not(.sens) .stat-num { font-weight: 600; }
h1, h2, h3, .seat-name, .lane-name, .ask, .tagline, .choice b, .outcome { font-weight: 700; }

/* ================= 第六輪：破版、手機、座位與卡片、紀錄 ================= */

/* 行動卡：與難題卡同一骨架（數字左上、剪影中央、類型在下），不再有倒置角標 */
.acard { overflow: hidden; grid-template-rows: 1fr auto; place-items: center; padding: 8px 6px 7px; outline-offset: -7px; }
.acard .idx { position: absolute; top: 8px; left: 10px; height: auto; font-family: var(--num); font-size: 24px; font-weight: 700; line-height: 1; }
.acard .emb { width: 34px; height: 34px; margin: 10px 0 0; }
.acard .aname { display: grid; justify-items: center; line-height: 1.15; color: var(--ink); }
.acard .aname b { font-family: var(--serif); font-size: 14px; }
.acard.small { padding: 4px; }
.acard.small .idx { font-size: 17px; top: 5px; left: 7px; }
.acard.small .aname b { font-size: 12px; letter-spacing: 0; white-space: nowrap; }

/* 手牌：下方預留扇形旋轉的空間 */

.hand { padding-bottom: 14px; }
.hand-count { font-size: 14px; }

/* 對手牌背：一疊小牌，不是空框 */
.back { width: 18px; height: 26px; margin-left: -9px; border: 1.5px solid var(--cream); border-radius: 3px;
  background: radial-gradient(circle, var(--cream) 0 1.6px, transparent 2.2px), var(--sea); }

/* 爆發量表單行 */

/* 座位：同一順序，繁榮緊跟在自己的數值後 */
.pros { margin-left: 0; padding-left: 22px; border-left: 1px dotted var(--line-2); }
.seat-opp .backs { margin-left: auto; }

/* 紀錄：本回合一行一件，較早的收起來 */
.entry { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; padding: 5px 0; }
.log-old { margin-top: 10px !important; min-height: 34px !important; font-size: 14px; }
.entries.old .entry { opacity: .7; }
.k-talk-bot { display: none; }

/* 對比 */
.badge { background: var(--cream) !important; color: var(--ink) !important; }

/* 手機：三張卡塞得下、座位兩行、手牌不打架、狀態兩行 */
@media (max-width: 900px) {
  .lane-cards { gap: 8px; }
  .pcard { --w: calc((100% - 16px) / 3); }
  .pcard .pface { --bd: 60px; --nh: 20px; }
  .pcard .pdiff { font-size: 25px; }
  .pcard .pname { font-size: 12px; padding: 0 4px; letter-spacing: 0; }
  .seat { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; padding-right: 76px; }
  .seat .medal { display: none; }
  .seat > .stats { grid-column: 1 / -1; gap: 8px 16px; }
  .pros { grid-column: 1 / -1; padding-left: 0; border-left: 0; }
  .hcard { margin-left: 6px; transform: none; }
  .hcard:not([aria-disabled="true"]):hover { transform: translateY(-4px); }
  .hcard.on { transform: translateY(-10px); }
  .hand { padding-top: 12px; padding-left: 0; }
  .acard { width: 66px; height: 94px; }
  .acard .emb { width: 26px; height: 26px; }
  .acard .idx { font-size: 19px; }
  .acard .aname b { font-size: 12px; letter-spacing: 0; white-space: nowrap; }
  .status { -webkit-line-clamp: 2; }
}

@media (min-width: 901px) {
  .lane-cards { padding-bottom: 6px; }
}

/* ================= 第七輪 ================= */
/* 座位完全對稱：兩條軌同樣大小，都有插栓 */
.stat .stat-num, .stat:not(.sens) .stat-num { font-family: var(--num); font-size: 30px; font-weight: 700; color: var(--cream); }
.stat-name { display: grid; line-height: 1.15; }
.stat-name small { font-size: 12px; color: var(--warn); letter-spacing: .1em; }
.seat > .stats { gap: 22px; }

/* 牌背：錯開的三張加張數 */
.backs { gap: 10px; padding-left: 0; }
.ask, .note, .result { text-wrap: balance; }

/* 紀錄：最多兩行，不再單行截斷 */
.entry { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.k-talk-bot { display: -webkit-box; color: var(--cream); }
.log-old { min-height: 0 !important; padding: 2px 0 !important; border: 0 !important; color: var(--gold) !important; text-decoration: underline dotted; text-underline-offset: 4px; }

/* 行動卡類型小字對比 */

/* 結局編號：與紙張同字型 */
.end-foot code { font-family: var(--sans); background: none; padding: 0; font-weight: 700; }

/* 手機 */
@media (max-width: 900px) {
  .hand-count { display: none; }
  .acard { width: 72px; height: 102px; }
  .stat .stat-num, .stat:not(.sens) .stat-num { font-size: 24px; }
}

/* ================= 第八輪：填滿的牌桌、海岸背景、置中手牌、固定行動列、抽屜 ================= */
:root { --coast: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 1000' preserveAspectRatio='none'%3E %3Cdefs%3E %3ClinearGradient id='sea' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%230c2a35'/%3E%3Cstop offset='1' stop-color='%2314495a'/%3E%3C/linearGradient%3E %3ClinearGradient id='flat' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%231f5f63'/%3E%3Cstop offset='.75' stop-color='%232f6a5d'/%3E%3Cstop offset='1' stop-color='%234b6a4f'/%3E%3C/linearGradient%3E %3ClinearGradient id='sand' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%236e5a37'/%3E%3Cstop offset='1' stop-color='%235a4a2e'/%3E%3C/linearGradient%3E %3ClinearGradient id='land' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%233b3020'/%3E%3Cstop offset='1' stop-color='%23241d14'/%3E%3C/linearGradient%3E %3C/defs%3E %3Crect width='1000' height='1000' fill='url(%23sea)'/%3E %3Cg fill='none' stroke='%23efe6d2' stroke-opacity='.10' stroke-width='1.5'%3E %3Cpath d='M0 40c40-10 80 10 120 0s80-10 120 0 80 10 120 0 80-10 120 0 80 10 120 0 80-10 120 0 80 10 120 0 80-10 120 0'/%3E %3Cpath d='M-60 80c40-10 80 10 120 0s80-10 120 0 80 10 120 0 80-10 120 0 80 10 120 0 80-10 120 0 80 10 120 0 80-10 120 0 80 10 120 0'/%3E %3C/g%3E %3Cpath d='M0 118C90 96 170 132 260 112S430 86 520 110 700 140 800 114 930 92 1000 108V1000H0Z' fill='url(%23flat)'/%3E %3Cpath d='M0 118C90 96 170 132 260 112S430 86 520 110 700 140 800 114 930 92 1000 108' fill='none' stroke='%23efe6d2' stroke-opacity='.55' stroke-width='3'/%3E %3Cpath d='M0 132C90 112 170 146 260 126S430 102 520 124 700 152 800 128 930 108 1000 122' fill='none' stroke='%23efe6d2' stroke-opacity='.18' stroke-width='2' stroke-dasharray='6 10'/%3E %3Cg fill='none' stroke='%23efe6d2' stroke-opacity='.07' stroke-width='1.5'%3E %3Cpath d='M0 260c60-12 120 12 180 0s120-12 180 0 120 12 180 0 120-12 180 0 120 12 180 0 120-12 180 0'/%3E %3Cpath d='M0 400c60-12 120 12 180 0s120-12 180 0 120 12 180 0 120-12 180 0 120 12 180 0 120-12 180 0'/%3E %3Cpath d='M0 520c60-12 120 12 180 0s120-12 180 0 120 12 180 0 120-12 180 0 120 12 180 0 120-12 180 0'/%3E %3C/g%3E %3Cpath d='M0 606C120 586 230 622 360 600S580 574 700 598 880 624 1000 596V1000H0Z' fill='url(%23sand)'/%3E %3Cpath d='M0 606C120 586 230 622 360 600S580 574 700 598 880 624 1000 596' fill='none' stroke='%23efe6d2' stroke-opacity='.45' stroke-width='3'/%3E %3Cpath d='M0 742C140 722 260 756 400 736S640 712 780 734 920 752 1000 730V1000H0Z' fill='url(%23land)'/%3E %3Cg fill='none' stroke='%23a08a5a' stroke-opacity='.22' stroke-width='1.5'%3E %3Cpath d='M60 820c60-20 140-20 200 0M340 860c80-26 170-24 240 0M680 830c70-22 160-22 230 0M150 920c90-24 200-24 280 0M560 940c80-22 190-22 260 0'/%3E %3C/g%3E %3C/svg%3E"); }
.game { max-width: none; padding: 0; height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.table {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 0; box-shadow: none;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; min-height: 0;
  background: none;
}
/* 海岸：你在島上時海在上方；你是海人時整片翻轉，海在你這側 */
.table::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--grain), var(--coast) center / 100% 100% no-repeat;
}
.table[data-me="sea"]::before { transform: scaleY(-1); }
.seat { padding: 10px 28px; border: 0 !important; background: none !important; }
.seat-opp { padding-right: 96px; }
.rows { overflow-y: auto; padding: 4px 96px 4px 28px; align-content: center; gap: 2px; }
.lane { border-top: 0 !important; padding: 4px 0; }
.lane-head { background: rgba(9, 22, 26, .55); border: 1px solid rgba(239, 230, 210, .18); backdrop-filter: blur(2px); }
.lane-cards { padding: 6px 4px 8px; }

/* 固定高度的行動列：一行說明 + 按鈕，不跟著出牌跳動 */
.actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: min(920px, calc(100% - 56px)); height: 56px; min-height: 0; margin: 6px auto 0; padding: 0 8px 0 20px;
  border: 1px solid rgba(239, 230, 210, .25) !important; border-radius: 999px;
  background: rgba(9, 18, 22, .78); backdrop-filter: blur(6px); flex-direction: row;
}
.act-info { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.act-info .muted { color: var(--muted); }
.act-info b { font-family: var(--num); }
.act-info .order { margin-left: 10px; display: inline-flex; gap: 4px; font-size: 13px; vertical-align: middle; }
.act-btns { display: flex; align-items: center; gap: 0; flex: none; }
.act-btns button { margin: 0 0 0 8px !important; min-height: 40px; }

/* 手牌：置中、像拿在手上 */
.hand {
  justify-content: center; align-items: flex-end; overflow: visible !important;
  height: 176px; min-height: 0; padding: 26px 20px 18px !important; margin: 0;
}
.hcard { margin-left: -12px; }
.hcard:first-child { margin-left: 0; }

/* 浮動按鈕與抽屜 */
.fabs { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); display: grid; gap: 10px; z-index: 6; }
.fab {
  width: 60px; height: 60px; border-radius: 50%; border: 1.5px solid var(--cream); background: rgba(9, 18, 22, .82); color: var(--cream);
  font-family: var(--serif); font-size: 15px; cursor: pointer; position: relative; box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}
.fab:hover, .fab.on { background: var(--cream); color: var(--ink); }
.fab .badge { position: absolute; top: -4px; right: -4px; margin: 0; background: var(--gold) !important; color: var(--ink) !important; border-radius: 10px; font-size: 12px; padding: 0 6px; font-family: var(--num); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 12; width: min(360px, 100%);
  display: flex; flex-direction: column; background: rgba(9, 18, 22, .96); border-left: 1px solid var(--line-2);
  box-shadow: -18px 0 40px rgba(0, 0, 0, .45); animation: slide .25s var(--ease-out);
}
@keyframes slide { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 4px; padding: 12px 14px; border-bottom: 1px dotted var(--line-2); }
.dtab { background: none; border: 0; color: var(--muted); font-family: var(--serif); font-size: 18px; padding: 4px 10px; cursor: pointer; border-bottom: 2px solid transparent; }
.dtab.on { color: var(--cream); border-bottom-color: var(--gold); }
.dclose { margin-left: auto; background: none; border: 1px solid var(--line-2); color: var(--cream); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.drawer .log, .drawer .phrases { flex: 1; overflow-y: auto; padding: 8px 18px 18px; border: 0; }
.drawer .phrase-list button { margin: 4px 6px 4px 0; }
:where(.drawer) button:where(:not(.dtab, .dclose, .term)) {
  display: inline-flex; align-items: center; min-height: 36px; padding: 4px 14px; background: transparent; color: var(--cream);
  border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer;
}

@media (max-width: 900px) {
  .game { padding: 0; }
  .seat { padding: 8px 14px; padding-right: 76px; }
  .seat-opp, .seat-me { padding-right: 14px; }
  .rows { padding: 4px 76px 4px 14px; align-content: start; }
  .actions { width: calc(100% - 20px); height: 52px; padding-left: 14px; }
  .act-info { font-size: 14px; }
  .act-btns button { padding: 4px 12px !important; min-height: 40px !important; }
  .hand { height: 132px; justify-content: safe center; overflow-x: auto !important; padding: 18px 10px 12px !important; }
  .hcard { margin-left: 6px; }
  .fabs { right: 10px; top: auto; bottom: 200px; transform: none; }
  .fab { width: 52px; height: 52px; font-size: 14px; }
  .drawer { width: 100%; }
}

/* 手機：整頁自然捲動，行動列與手牌固定在底部 */
@media (max-width: 900px) {
  .game { height: auto; min-height: 100dvh; display: block; }
  .table { display: block; overflow: visible; min-height: calc(100dvh - 90px); padding-bottom: 8px; }
  .table::before { position: fixed; }
  .rows { overflow: visible; padding-right: 14px; }
  .actions { position: sticky; bottom: 132px; z-index: 8; }
  .hand { position: sticky; bottom: 0; z-index: 8; background: linear-gradient(transparent, rgba(9, 18, 22, .92) 30%); }
  .fabs { position: fixed; bottom: 196px; }
}

/* ================= 內容限定在好閱讀的容器寬度；背景照樣滿版 ================= */
:root { --wrap: 1120px; --gutter: max(28px, calc((100% - var(--wrap)) / 2)); }
@media (min-width: 901px) {
  .seat { padding-left: var(--gutter); padding-right: var(--gutter); }
  .seat-opp { padding-right: var(--gutter); }
  .rows { padding-left: var(--gutter); padding-right: var(--gutter); }
  .actions { width: min(var(--wrap), calc(100% - 56px)); }
  .hand { padding-left: var(--gutter) !important; padding-right: var(--gutter) !important; }
  /* 浮動按鈕貼在容器右緣外側 */
  .fabs { right: max(14px, calc(var(--gutter) - 78px)); }
}

/* 背景：柔和的海岸漸層（取代硬邊曲線） */
.table::before {
  background:
    var(--grain),
    linear-gradient(180deg, transparent 13%, rgba(239, 230, 210, .07) 15.5%, transparent 18.5%),
    linear-gradient(180deg, transparent 62%, rgba(239, 230, 210, .06) 65%, transparent 68%),
    linear-gradient(180deg,
      #0b2731 0%, #0f3743 8%, #154a55 16%,
      #1a5659 26%, #1d5b58 46%, #285f52 57%,
      #45583c 64%, #57492f 69%, #4b3d27 74%,
      #33291b 84%, #211a12 100%);
}

/* ================= 第九輪：乾淨的漸層、攤開的座位、分段條、無虛線 ================= */
.table::before {
  background: linear-gradient(180deg, #0e222a 0%, #12303a 30%, #153a42 52%, #1c2c2a 70%, #2a2219 100%);
}
/* 用語不畫虛線底線；滑過時才提示可以點 */
.term { text-decoration: none; }
.term:hover { color: var(--gold); }
/* 座位：全部攤開 */
.seat > .stats { gap: 28px; }
.stat { gap: 10px; }
.stat-name { font-size: 15px; color: var(--muted); }
.stat .stat-num, .stat:not(.sens) .stat-num { font-size: 28px; }
/* 10 格分段條：等寬等距 */
.stat.low .stat-num { color: var(--warn); }
/* 對手牌背：實際張數的一排小牌 */
.backs { display: flex; padding-left: 10px; }
.backs .back { width: 16px; height: 24px; margin-left: -8px; border: 1.5px solid var(--cream); border-radius: 3px; background: radial-gradient(circle, var(--cream) 0 1.4px, transparent 2px), var(--sea); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.seat-opp .backs { margin-left: auto; }
.pros { margin-left: auto; border-left: 0; padding-left: 0; }
@media (max-width: 900px) {
  .stat .stat-num, .stat:not(.sens) .stat-num { font-size: 22px; }
  .seat { padding-right: 14px; }
}

.seat .backs { gap: 0; }
.seat .backs .back { margin-left: -9px; }
.seat .backs .back:first-child { margin-left: 0; }

/* ================= 紀錄：難題色塊、行動卡彩色字 ================= */
:root { --dis-hi: #f0a088; --mon-hi: #b9adf0; --ill-hi: #a6d48f; --res-hi: #e6c06e; }
.li-ico { width: 1.05em; height: 1.05em; vertical-align: -.15em; margin-right: 3px; flex: none; }
.lt-prob { display: inline-flex; align-items: center; gap: 1px; padding: 0 6px 0 4px; margin: 0 3px; border-radius: 4px; color: #fff; font-weight: 700; white-space: nowrap; line-height: 1.6; }
.lt-prob.c-dis { background: var(--dis); } .lt-prob.c-mon { background: var(--mon); } .lt-prob.c-ill { background: var(--ill); } .lt-prob.c-res { background: var(--res); }
.lt-card { display: inline-flex; align-items: center; margin: 0 3px; font-weight: 700; white-space: nowrap; }
.lt-card.c-dis { color: var(--dis-hi); } .lt-card.c-mon { color: var(--mon-hi); } .lt-card.c-ill { color: var(--ill-hi); } .lt-card.c-res { color: var(--res-hi); }
/* 泡泡是米白底：行動卡改用原本的深色 */
.entry { -webkit-line-clamp: 3; line-height: 1.75; }

/* ================= 紀錄分隔線、短語分組 ================= */
.drawer .entry { border-bottom: 1px solid rgba(239, 230, 210, .16); padding: 9px 0; }
.drawer .entry b { color: var(--cream); font-weight: 700; }
.pgroup { padding: 12px 0 14px; border-bottom: 1px solid rgba(239, 230, 210, .16); }
.pgroup h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--cream); }
.pgroup h4 span { font-family: var(--sans); font-size: 15px; font-weight: 400; }
.pg-hint { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.pg-warn { margin: 10px 0 0; color: var(--danger); font-weight: 700; }
.drawer button.phrase {
  display: flex !important; width: 100%; justify-content: flex-start; text-align: left;
  margin: 0 0 6px !important; padding: 8px 14px !important; min-height: 42px !important;
  border-radius: 10px !important; font-size: 15px; line-height: 1.5;
  background: rgba(239, 230, 210, .05) !important;
}
.drawer button.phrase:hover:not(:disabled) { border-color: var(--gold) !important; background: rgba(227, 182, 92, .1) !important; }
.pgroup.off button.phrase { opacity: .4; }

/* ================= 背景：版畫線刻＋月相弧線 ================= */
.table::before { background: linear-gradient(180deg, #0d2129 0%, #10303a 38%, #14343a 58%, #1f2a26 72%, #272017 100%); }
.backdrop { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop svg { position: absolute; left: 0; top: 0; display: block; }
.moons .arc { fill: none; stroke: rgba(239, 230, 210, .18); stroke-width: 1; stroke-dasharray: 1 5; stroke-linecap: round; }
.moon .ring { fill: rgba(9, 22, 26, .6); stroke: rgba(239, 230, 210, .35); stroke-width: 1; }
.moon .lit { fill: rgba(239, 230, 210, .2); }
.moon.past .lit { fill: rgba(239, 230, 210, .62); }
.moon.past .ring { stroke: rgba(239, 230, 210, .55); }
.moon.now .ring { stroke: var(--gold); stroke-width: 1.5; filter: drop-shadow(0 0 6px rgba(227, 182, 92, .7)); }
.moon.now .lit { fill: var(--gold); }
.moon text { fill: var(--gold); font-family: var(--serif); text-anchor: middle; letter-spacing: .1em; }
@media (max-width: 900px) { .moons { display: none; } }

/* ================= 背景第二版：高對比海岸、苔綠陸地、流動的夜浪、直排月相 ================= */
/* 深海 → 亮青的淺灘帶（海岸）→ 苔綠的陸地，交界處刻意拉開明度 */
.table::before {
  background: linear-gradient(180deg,
    #071820 0%, #0a2530 22%, #0f3540 42%, #16505a 56%,
    #2a7a7a 62.5%, #3f8f84 64.5%,
    #2b4a2c 66.5%, #223c22 74%, #172c18 88%, #10200f 100%);
}
.table[data-me="sea"]::before { transform: scaleY(-1); }
/* 夜浪：一層重複的細波紋，緩慢往海岸推進；靠岸處淡出 */
.sea-waves {
  position: absolute; left: 0; right: 0; top: 0; height: 64%; overflow: hidden;
  -webkit-mask: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.55) 60%, transparent);
          mask: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.55) 60%, transparent);
}
.table[data-me="sea"] .sea-waves { top: auto; bottom: 0; transform: scaleY(-1); }
.sea-waves-move {
  position: absolute; left: 0; right: 0; top: -36px; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='18'%3E%3Cpath d='M0 9q22.5 -3 45 0t45 0 45 0 45 0' fill='none' stroke='%23efe6d2' stroke-opacity='.16' stroke-width='1'/%3E%3C/svg%3E") 0 0 / 180px 18px repeat;
  animation: tide-in 4.5s linear infinite;
  will-change: transform;
}
.sea-waves-move::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='36'%3E%3Cpath d='M0 18q32.5 4 65 0t65 0 65 0 65 0' fill='none' stroke='%23efe6d2' stroke-opacity='.07' stroke-width='1'/%3E%3C/svg%3E") 70px 0 / 260px 36px repeat;
}
@keyframes tide-in { from { transform: translateY(0); } to { transform: translateY(36px); } }
@media (prefers-reduced-motion: reduce) { .sea-waves-move { animation: none; } }
/* 月相直排：容器左側外 */
.moons .arc { fill: none; stroke: rgba(239, 230, 210, .2); stroke-width: 1; stroke-dasharray: 1 5; stroke-linecap: round; }
.moon text { text-anchor: start; font-size: 14px; fill: rgba(239, 230, 210, .45); }
.moon.past text { fill: rgba(239, 230, 210, .7); }
.moon.now text { fill: var(--gold); font-weight: 700; font-size: 16px; }

/* 陸地改回大地色；海岸過渡約 5% 高度：不是硬邊，也不糊 */
.table::before {
  background: linear-gradient(180deg,
    #071820 0%, #0a2530 22%, #0f3540 42%, #16505a 55%,
    #26696b 59.5%,
    #4c5a48 62%, #6b5a3c 64.5%,
    #5c4a30 70%, #46382a 80%, #30261a 92%, #231b12 100%);
}

/* 細沙顆粒：只在陸地範圍 */
.sand-grain {
  position: absolute; left: 0; right: 0; bottom: 0; top: 62%; pointer-events: none; opacity: .55; mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .95 0 0 0 0 .85 0 0 0 0 .65 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-mask: linear-gradient(180deg, transparent, #000 6%); mask: linear-gradient(180deg, transparent, #000 6%);
}
.table[data-me="sea"] .sand-grain { top: 0; bottom: 62%; -webkit-mask: linear-gradient(0deg, transparent, #000 6%); mask: linear-gradient(0deg, transparent, #000 6%); }

/* 海岸邊界：較寬、較柔的過渡（約 52%–70%） */
.table::before {
  background: linear-gradient(180deg,
    #071820 0%, #0a2530 22%, #0f3540 40%, #155058 52%,
    #23646a 57%, #3e6560 61%, #5a5e48 65%, #6b5a3c 69%,
    #5c4a30 74%, #46382a 83%, #30261a 93%, #231b12 100%);
}
.sand-grain { top: 56%; -webkit-mask: linear-gradient(180deg, transparent, #000 22%); mask: linear-gradient(180deg, transparent, #000 22%); }
.table[data-me="sea"] .sand-grain { bottom: 56%; -webkit-mask: linear-gradient(0deg, transparent, #000 22%); mask: linear-gradient(0deg, transparent, #000 22%); }
.sea-waves { height: 66%; -webkit-mask: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.5) 55%, transparent); mask: linear-gradient(180deg, rgba(0,0,0,.95), rgba(0,0,0,.5) 55%, transparent); }

/* 雙方區塊的遮色片：和中央的航道區隔開 */
.scrim { position: absolute; left: 0; right: 0; pointer-events: none; background: rgba(4, 11, 14, .52); }
.scrim-opp { border-bottom: 1px solid rgba(239, 230, 210, .14); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.scrim-me { border-top: 1px solid rgba(239, 230, 210, .14); box-shadow: 0 -10px 24px -12px rgba(0, 0, 0, .5); }
.rows { padding-top: 10px; padding-bottom: 10px; }

/* 遮色片改成淡淡的半透明亮片：背景照樣透出來，只做區隔 */
.scrim { background: rgba(239, 230, 210, .07); box-shadow: none !important; }
.scrim-opp { border-bottom: 1px solid rgba(239, 230, 210, .22); }
.scrim-me { border-top: 1px solid rgba(239, 230, 210, .22); }

/* 遮色片：獨立的圖板，圓角、四周留邊 */
.scrim { border-radius: 18px; border: 1px solid rgba(239, 230, 210, .2) !important; }

/* ================= 版面第十一輪：小圖板、浮動手牌、右側繁榮、右下角紀錄 ================= */
@media (min-width: 901px) {
  /* 牌桌：對手 / 航道 / 你的圖板（左：座位，右：說明與按鈕） */
  .table { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; }
  #seat-opp, #rows { grid-column: 1 / -1; }
  #seat-me { grid-column: 1; grid-row: 3; padding-top: 12px; padding-bottom: 26px; padding-right: 12px; }
  .actions {
    grid-column: 2; grid-row: 3; align-self: center; width: auto; max-width: 520px; height: auto; min-height: 0;
    margin: 0 var(--gutter) 14px 0; padding: 0; background: none !important; border: 0 !important; border-radius: 0; backdrop-filter: none;
    gap: 14px;
  }
  .act-info { max-width: 300px; text-align: right; font-size: 15px; }
  /* 手牌：浮在你的圖板上方靠右 */
  .hand {
    position: absolute; right: var(--gutter); left: auto; height: auto; z-index: 4;
    width: auto; padding: 18px 0 0 !important; margin: 0; justify-content: flex-end;
  }
  .hcard { margin-left: -20px; }
  .acard { width: 80px; height: 114px; }
  /* 上下對稱讓三列置中；矮螢幕留白跟著縮，避免列高小於列名框 */
  .rows { padding-top: clamp(8px, calc((100vh - 700px) * .25), 44px); padding-bottom: clamp(8px, calc((100vh - 700px) * .25), 44px); }
  /* 紀錄、短語：畫面右下角 */
  .fabs { top: auto; bottom: 20px; right: 20px; transform: none; display: flex; gap: 10px; }
  .fab { width: 56px; height: 56px; }
}
/* 繁榮直排量表 */
.pros-track .p-track { stroke: rgba(239, 230, 210, .22); stroke-width: 2; stroke-linecap: round; }
.pros-track .p-fill { stroke: var(--tide); stroke-width: 4; stroke-linecap: round; }
.pros-track .p-tick { stroke: rgba(239, 230, 210, .35); stroke-width: 1; }
.pros-track .p-lab { fill: rgba(239, 230, 210, .62); font-size: 12px; text-anchor: end; font-family: var(--num); }
.pros-track .p-now { fill: var(--tide); stroke: var(--night); stroke-width: 2; filter: drop-shadow(0 0 6px rgba(143, 207, 164, .6)); }
.pros-track .p-val { fill: var(--tide); font-size: 20px; font-weight: 700; font-family: var(--num); }
.moons .p-title { fill: rgba(239, 230, 210, .7); font-size: 16px; text-anchor: middle; font-family: var(--serif); letter-spacing: .15em; }

:root { --gutter: max(28px, calc((100vw - var(--wrap)) / 2)); }
.table { --gutter: max(28px, calc((100vw - var(--wrap)) / 2)); }
@media (min-width: 901px) {
  #seat-me { min-width: 0; }
  #seat-me > .stats { gap: 18px; }
  .act-info { max-width: 210px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; font-size: 14px; }
}

/* 桌面：三列平分牌桌高度，難題卡的高度跟著列高走（寬度由比例算出），整個牌桌不捲動 */
@media (min-width: 901px) {
  .rows { grid-template-rows: repeat(3, minmax(0, 1fr)); overflow: hidden; }
  .lane { min-height: 0; }
  .lane-cards { height: 100%; min-height: 0; box-sizing: border-box; align-items: center; }
  .pcard { --w: auto; flex: 0 0 auto; width: auto; height: 100%; max-height: 250px; }
}
/* 選取時卡片上浮 6px 加 3px 金框：上方留足空間，不被捲動容器裁掉 */
.lane-cards { padding-top: 12px; }

/* 數字字型：大數字用 Philosopher（離線退回系統字）；紀錄等小字裡的數字維持內文字型 */
:root { --num: "Philosopher", system-ui, -apple-system, "Segoe UI", sans-serif; }
.moon text { font-family: var(--num); }

/* ================= 航道計數卡：潮位計 ================= */
.lane { align-items: stretch; }
.lane-head {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 118px; padding: 10px 14px 10px; gap: 0;
  border-radius: 12px; border: 1.5px solid rgba(239, 230, 210, .35) !important;
  background: rgba(6, 16, 20, .72) !important; backdrop-filter: blur(2px);
}
.lane-head.selected { border-color: var(--gold) !important; box-shadow: 0 0 0 2px var(--gold); }
/* 爆發線：卡片頂端一條虛線 */
.lane-head::after { content: ""; position: absolute; left: 0; right: 0; top: 0; border-top: 1.5px dashed rgba(239, 99, 82, .55); z-index: 1; }
.tide { position: absolute; inset: 0; z-index: -1; }
.tide-water {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--lv);
  background: linear-gradient(180deg, #2f8f8f, #17555a);
  transition: transform .6s var(--ease-out), background .4s;
}
/* 水面：一道緩緩起伏的浪頂 */
.tide-water::before {
  content: ""; position: absolute; left: -50%; right: -50%; top: -6px; height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8'%3E%3Cpath d='M0 6q10-6 20 0t20 0V8H0z' fill='%232f8f8f'/%3E%3C/svg%3E") 0 0 / 40px 8px repeat-x;
}

.lane.near .tide-water { background: linear-gradient(180deg, #c2477d, #6e1d44); }
.lane.near .tide-water::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8'%3E%3Cpath d='M0 6q10-6 20 0t20 0V8H0z' fill='%23c2477d'/%3E%3C/svg%3E"); }
.lane.danger .tide-water { background: linear-gradient(180deg, #e2553f, #7a1f14); }
.lane.danger .tide-water::before { display: none; }
.lane.danger .lane-head { border-color: var(--danger) !important; animation: brim 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) { .tide-water::before, .lane.danger .lane-head { animation: none; } }
.lane-head .lane-name { font-size: 28px; line-height: 1; letter-spacing: .04em; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.lane-head .lane-sum { align-self: flex-end; display: flex; align-items: baseline; gap: 4px; color: var(--cream); text-shadow: 0 1px 4px rgba(0, 0, 0, .55); }
.lane-head .lane-sum b { font-family: var(--num); font-size: 38px; line-height: 1; color: var(--cream) !important; }
.lane-head .lane-sum small { font-family: var(--num); font-size: 15px; color: rgba(239, 230, 210, .75); }
.lane-head.selected .lane-sum, .lane-head.selected .lane-sum b { color: var(--cream) !important; }
@media (max-width: 900px) {
  .lane-head { min-height: 0; flex-direction: row; align-items: center; padding: 6px 12px; }
  .lane-head .lane-name { font-size: 20px; }
  .lane-head .lane-sum b { font-size: 24px; }
  .tide-water { height: 100%; width: var(--lv); right: auto; }
  .tide-water::before { display: none; }
}

/* 檢查修正：水位改用 transform 動畫；拿掉彩色光暈 */
.tide-water { height: 100%; transform: translateY(calc(100% - var(--lv))); transition: transform .6s var(--ease-out), background .4s; }
@media (max-width: 900px) { .tide-water { width: 100%; height: 100%; transform: translateX(calc(var(--lv) - 100%)); } }
.lane.danger .lane-head { animation: brim 1.8s ease-in-out infinite; box-shadow: none; }
@keyframes brim { 50% { border-color: rgba(239, 230, 210, .9); } }
.moon.now .ring { filter: none; }
.pros-track .p-now { filter: none; }

/* 潮位計縮小、改用低彩度的水色 */
@media (min-width: 901px) {
  .lane { grid-template-columns: 84px minmax(0, 1fr); gap: 16px; }
  .lane-head { min-height: 0; padding: 8px 10px; border-radius: 10px; }
  .lane-head .lane-name { font-size: 18px; }
  .lane-head .lane-sum b { font-size: 26px; }
  .lane-head .lane-sum small { font-size: 12px; }
}
.lane-head { border-color: rgba(239, 230, 210, .25) !important; }
.tide-water { background: linear-gradient(180deg, #4d6a6a, #2c4448); }
.tide-water::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8'%3E%3Cpath d='M0 6q10-6 20 0t20 0V8H0z' fill='%234d6a6a'/%3E%3C/svg%3E"); }
.lane.near .tide-water { background: linear-gradient(180deg, #a5843f, #6b5220); }
.lane.near .tide-water::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='8'%3E%3Cpath d='M0 6q10-6 20 0t20 0V8H0z' fill='%23a5843f'/%3E%3C/svg%3E"); }
.lane.danger .tide-water { background: linear-gradient(180deg, #a8463a, #63231a); }
.lane-head::after { border-top-color: rgba(239, 230, 210, .35); }

/* 潮位計：細長、編號加大、浪頭隨水位變大變急 */
@media (min-width: 901px) {
  .lane { grid-template-columns: 58px minmax(0, 1fr); }
  .lane-head { padding: 8px 6px; align-items: center; }
  .lane-head .lane-name { font-size: 26px; }
  .lane-head .lane-sum { align-self: center; flex-direction: column; align-items: center; gap: 0; }
  .lane-head .lane-sum b { font-size: 24px; }
}
.tide { --crest: #4d6a6a; }
.lane.near .tide { --crest: #a5843f; }
.lane.danger .tide { --crest: #a8463a; }
.tide-water::before {
  left: -60px; right: -60px; top: calc(-1 * var(--amp, 4px) - 1px); height: calc(var(--amp, 4px) + 2px);
  background: var(--crest) !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='10' preserveAspectRatio='none'%3E%3Cpath d='M0 9C12 -3 12 -3 24 9S36 -3 48 9V10H0z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 30px 100% repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='10' preserveAspectRatio='none'%3E%3Cpath d='M0 9C12 -3 12 -3 24 9S36 -3 48 9V10H0z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 30px 100% repeat-x;
  display: block !important;
}

@media (prefers-reduced-motion: reduce) { .tide-water::before { animation: none; } }
.tide-water::before { -webkit-mask-size: 52px 100%; mask-size: 52px 100%; }

.lane-head .lane-name { position: relative; z-index: 2; }

/* 進度數字一行；浪頭往下延伸進水裡，起伏時不會和水面分離 */
@media (min-width: 901px) {
  .lane-head .lane-sum { flex-direction: row; align-items: baseline; gap: 1px; white-space: nowrap; }
  .lane-head .lane-sum b { font-size: 20px; }
  .lane-head .lane-sum small { font-size: 12px; }
}
.tide-water::before {
  top: calc(-1 * var(--amp, 4px) - 1px); height: calc(var(--amp, 4px) + 26px);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='10' preserveAspectRatio='none'%3E%3Cpath d='M0 9C12 -3 12 -3 24 9S36 -3 48 9V10H0z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 52px calc(var(--amp, 4px) + 1px) repeat-x,
    linear-gradient(#000, #000) 0 100% / 100% calc(100% - var(--amp, 4px)) no-repeat;
          mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='10' preserveAspectRatio='none'%3E%3Cpath d='M0 9C12 -3 12 -3 24 9S36 -3 48 9V10H0z' fill='%23000'/%3E%3C/svg%3E") 0 0 / 52px calc(var(--amp, 4px) + 1px) repeat-x,
    linear-gradient(#000, #000) 0 100% / 100% calc(100% - var(--amp, 4px)) no-repeat;
}

.tide-water::before { background: linear-gradient(180deg, var(--crest) 0, var(--crest) calc(var(--amp, 4px) + 2px), transparent 100%) !important; }

/* 浪頭：水平等速推進＋上下平滑起伏，拆成兩個動畫（transform 與 translate 各自獨立） */
.tide-water::before {
  animation:
    crest-run calc(var(--spd, 3s) * 1.4) linear infinite,
    crest-bob var(--spd, 3s) ease-in-out infinite alternate !important;
}
@keyframes crest-run { from { transform: translateX(0); } to { transform: translateX(52px); } }
@keyframes crest-bob { from { translate: 0 calc(var(--amp, 4px) * .4); } to { translate: 0 calc(var(--amp, 4px) * -.4); } }
@media (prefers-reduced-motion: reduce) { .tide-water::before { animation: none !important; } }

/* 對手圖板：內容在遮色片裡上下置中（遮色片從 8px 開始） */
@media (min-width: 901px) { #seat-opp { padding-top: 18px; padding-bottom: 10px; } }

/* 中文字型統一：Noto Sans TC（標題與內文同一套，用字重區分層級）；數字仍用 Philosopher */
:root {
  --serif: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  --sans: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, -apple-system, sans-serif;
}
body { font-family: var(--sans); }

/* ================= 版面第十二輪：精簡座位、手牌進座位、目標提示、泡泡 ================= */
/* 頂列只留回合數、盟約、規則 */

/* 座位：頭像 + 一列名稱與數字，旗標固定一行 */
.seat-id { position: relative; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.seat-stats { position: relative; display: block; flex: none; }
.seat .stats { display: flex !important; flex-wrap: nowrap; gap: 16px !important; margin: 0; width: auto; }
.seat .stat { display: flex; align-items: baseline; gap: 6px; }
.seat .stat-name { display: inline; font-size: 14px; color: var(--muted); }
.seat .stat .stat-num, .seat .stat:not(.sens) .stat-num { font-family: var(--num); font-size: 24px; font-weight: 700; color: var(--cream); line-height: 1.1; }
.seat .stat-num small { font-size: 14px; color: var(--muted); font-weight: 400; }
.seat .stat.low .stat-num, .seat .stat.low .stat-num small { color: var(--warn); }
.flag-row { min-height: 24px; display: flex; align-items: center; }
.flag-row .flag { font-size: 13px; padding: 2px 10px; }

/* 目標提示：發亮與小標籤 */
.pcard { position: relative; }
.pcard.target { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(227, 182, 92, .55); }
.ptag {
  position: absolute; left: 50%; top: -11px; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  background: var(--gold); color: var(--night); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.hand { position: relative; }
.hand-tag {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  background: var(--gold); color: var(--night); font-size: 13px; font-weight: 700; padding: 2px 12px; border-radius: 999px;
}

/* 電腦的話：從右側電腦牌背的下方冒出，泡泡右緣對齊牌背；尖角固定在右上指向牌背，與文字長短無關 */
.seat-opp .opp-hand { position: relative; margin-left: auto; display: flex; align-items: center; }
.bubble {
  position: absolute; z-index: 6; right: 0; top: calc(100% + 12px);
  width: max-content; min-width: 64px; max-width: 460px; min-height: 44px; display: flex; flex-direction: column; justify-content: center;
  background: var(--cream); color: var(--ink); border-radius: 14px; padding: 10px 18px; font-size: 16px; line-height: 1.45;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4); animation: bubble-in .3s var(--ease-out); white-space: normal;
}
@keyframes bubble-in { from { transform: translateY(-6px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.bubble::before { content: ""; position: absolute; right: 18px; top: -5px; width: 10px; height: 10px; background: inherit; transform: rotate(45deg); }
.bubble p { margin: 0; position: relative; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bubble p + p { margin-top: 2px; }
.bubble.thinking p { letter-spacing: .2em; color: var(--muted); }
.bubble .lt-card.c-dis { color: var(--dis); } .bubble .lt-card.c-mon { color: var(--mon); } .bubble .lt-card.c-ill { color: var(--ill); } .bubble .lt-card.c-res { color: var(--res); }

@media (min-width: 901px) {
  /* 底部：左側是最小的一橫排個人圖板；右側是獨立的手牌區塊，貼底往上長，不撐高這一列 */
  .table { grid-template-columns: auto auto minmax(0, 1fr); }
  #seat-me { grid-column: 1; grid-row: 3; align-self: end; padding-top: 14px; padding-bottom: 22px; padding-right: 20px; }
  .seat { align-items: center; }
  .seat-stats { position: relative; display: block; }
  .flag-row { position: absolute; left: 0; top: calc(100% + 2px); min-height: 0; white-space: nowrap; }
  /* 行動說明與按鈕：個人圖板的一部分，同一橫排、垂直置中 */
  .actions {
    position: static; grid-column: 2; grid-row: 3; align-self: end; margin: 0; padding: 14px 0 22px;
    flex-direction: row; align-items: center; gap: 10px; width: auto; max-width: none; height: auto; min-height: 0;
    background: none !important; border: 0 !important;
  }
  .actions .act-info { max-width: 200px; text-align: left; font-size: 13px; }
  .actions .act-info:empty { display: none; }
  .actions .act-btns { display: flex; flex-direction: row; align-items: center; gap: 6px; min-height: 48px; }
  .actions .act-btns button { margin: 0 !important; min-height: 36px; white-space: nowrap; }
  /* 手牌：右側獨立區塊，貼底往上延伸，不撐高這一列 */
  .hand {
    position: absolute; grid-column: 3; grid-row: 3; left: 20px; right: var(--hand-right, 220px); bottom: 12px; top: auto;
    width: auto; min-width: 0; height: auto; margin: 0; z-index: 4; container-type: inline-size;
    justify-content: safe center; align-items: flex-end; padding: 24px 0 14px !important;
    background: none; border: 0;
  }
  /* 卡片維持依螢幕高度的大小；張數多時縮小牌距（加大重疊），不縮小卡片，也不擠出手牌區 */
  .hand { --cw: clamp(88px, 13vh, 124px); }
  .hand .acard { width: var(--cw); height: auto; aspect-ratio: 5 / 7; }
  /* 留 24px 給扇形旋轉與選取浮起 */
  .hcard { margin-left: min(-14px, calc((100cqw - 24px - var(--cw) * var(--n, 7)) / (var(--n, 7) - 1))); }
  .hcard:first-child { margin-left: 0; }
}
@media (max-width: 900px) {
  .seat-id .medal { display: inline-grid; width: 36px; height: 36px; }
  .seat .stats { flex-wrap: wrap; gap: 2px 12px !important; }
  .seat-stats { flex: 1 1 auto; min-width: 0; }
  .seat .stat .stat-num, .seat .stat:not(.sens) .stat-num { font-size: 20px; }
}

/* 難題列上下留白縮到最小，把高度留給中央牌堆 */
@media (min-width: 901px) {
  .rows { padding-top: 22px !important; padding-bottom: 22px !important; }
  #seat-opp { padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 900px) {
  .seat-opp .opp-hand { display: contents; }
  .bubble { position: relative; right: auto; top: auto; grid-column: 1 / -1; justify-self: start; width: auto; margin: 4px 0 0; max-width: 100%; }
  .bubble::before { right: auto; left: 18px; }
}

/* 上下圖板與畫面邊緣留白（頂部提示列已移除） */
@media (min-width: 901px) {
  #seat-opp { margin-top: 24px; }
  #seat-me, .actions { margin-bottom: 24px; }
}

/* ================= 體驗調整：預警對話框、固定寬度圖板、封閉港灣 modal ================= */
/* 淺灘預警：敏感軌數字變色，上方冒出對話框；絕對定位，不改變座位高度 */
.seat .stat.brink { position: relative; }
.seat .stat.brink .stat-num, .seat .stat.brink .stat-num small { color: var(--warn); }
.brink-tip {
  position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%); z-index: 7;
  white-space: nowrap; background: var(--warn); color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
  padding: 6px 10px; border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .4); pointer-events: none;
  animation: bubble-in .3s var(--ease-out);
}
.brink-tip::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .brink-tip { animation: none; } }

/* 封閉港灣：只蓋住中央難題列，上下圖板照常看得到 */

@media (min-width: 901px) {
  /* 電腦座位：遮色片從 margin 下 8px 開始，內容上下各補到與遮色片同中心 */
  #seat-opp { padding-top: 20px; padding-bottom: 12px; }
  /* 行動區固定寬度：說明在上一行、按鈕在下一行，內容多寡不影響圖板寬度與手牌位置 */
  .actions { width: 360px; flex: none; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
  .actions .act-info, .actions .act-info:empty { display: block; width: 100%; max-width: none; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset; line-height: 18px; }
  .actions .act-btns { min-height: 36px; flex-wrap: nowrap; }
}
@media (min-width: 901px) {
  /* 數字位數變動（例如 9 → 10、0 → 1）不推動圖板寬度 */
  .seat .stat .stat-num { display: inline-block; min-width: 1.6em; }
  .seat .stat .stat-num:has(small) { min-width: 3.2em; }
}
@media (max-width: 900px) {
  /* 手機：電腦座位在頁面最上方，預警改在數字下方展開 */
  .seat-opp .brink-tip { bottom: auto; top: calc(100% + 9px); }
  .seat-opp .brink-tip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--warn); }
}

/* ================= 牌堆示意：回合上方是難題牌堆、繁榮上方是行動卡牌堆 ================= */
.pile { position: absolute; width: 40px; display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.pile-cards { position: relative; width: 40px; height: 56px; }
.pile-cards i {
  position: absolute; left: 0; bottom: calc(var(--k) * 2px); width: 40px; height: 56px; border-radius: 5px;
  border: 1.5px solid rgba(239, 230, 210, .8); box-shadow: 0 2px 4px rgba(0, 0, 0, .45);
  background: radial-gradient(circle, var(--cream) 0 2px, transparent 2.6px), var(--sea);
}
.pile-problem .pile-cards i { background: radial-gradient(circle, var(--gold) 0 2px, transparent 2.6px), #3a3326; border-color: rgba(227, 182, 92, .75); }
.pile.empty .pile-cards { border: 1.5px dashed rgba(239, 230, 210, .3); border-radius: 5px; }
.pile b { font-family: var(--num); font-size: 13px; font-weight: 700; color: rgba(239, 230, 210, .75); line-height: 1; }

/* ================= 拖曳出牌 ================= */
@media (min-width: 901px) {
  .hand .hcard:not([aria-disabled="true"]) { touch-action: none; }
}
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; margin: 0; transform: rotate(-4deg) scale(1.04); box-shadow: 0 18px 32px rgba(0, 0, 0, .55); opacity: .95; }
.hcard.dragging { opacity: .35; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.pcard.drop-ok { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(227, 182, 92, .7); transform: translateY(-6px); }

/* ================= 第二輪調整 ================= */
/* 出牌區：牌移到畫面中央，下方確認與取消；沒有背景色，只有內容可以點 */
.stage { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; background: none; }
.stage[hidden] { display: none; }
.stage > * { pointer-events: auto; }
.stage-title, .stage-info { margin: 0; color: var(--cream); font-size: 15px; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .7); min-height: 20px; }
.stage-info .bad { color: #ff8a8a; }
.stage-info .warn { color: #ff9aa8; font-weight: 700; }   /* 預警色 --warn 的淺色版，深色牌桌上對比足夠 */
.stage-cards { display: flex; gap: 12px; }
.stage-card { padding: 0; border: 0; background: none; cursor: pointer; animation: stage-in .25s var(--ease-out); }
.stage-card .acard { width: 110px; height: auto; aspect-ratio: 5 / 7; box-shadow: 0 0 0 3px var(--gold), 0 18px 30px rgba(0, 0, 0, .6); }
.stage-card:hover .acard { transform: translateY(-4px); }
.stage-btns { display: flex; gap: 10px; }
.stage-btns button { font: inherit; font-size: 16px; font-weight: 700; padding: 9px 22px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(239, 230, 210, .6); background: rgba(9, 20, 25, .85); color: var(--cream); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); }
.stage-btns button.primary { background: var(--gold); border-color: var(--gold); color: var(--night); }
.stage-btns button:disabled { opacity: .5; cursor: not-allowed; }
@keyframes stage-in { from { transform: translateY(14px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stage-card { animation: none; } }

/* 牌堆數字和卡背之間留空 */
.pile { gap: 8px; }

/* 電腦行動中的提示：泡泡是米色底，用深色字 */
.bubble.thinking p { color: var(--ink); opacity: .8; letter-spacing: .05em; }

@media (min-width: 901px) {
  /* 行動區：說明與按鈕同一橫排、垂直置中，和座位數字對齊；寬度依角色固定（海人多強行登陸、旗語） */
  .actions { flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; width: 260px; }
  .table[data-me="sea"] .actions { width: 330px; }
  .actions .act-info { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; width: auto; flex: 0 1 auto; min-height: 0; line-height: 1.35; overflow: hidden; }
  .actions .act-info:empty { display: none; }
  .actions .act-btns { flex: none; }
}
@media (min-width: 901px) {
  /* 底板從座位上方 4px 起、到畫面下方 36px 止；上下內距差 16px 時，內容中心剛好落在底板中心 */
  #seat-me { padding-top: 10px; padding-bottom: 26px; }
  .actions { align-self: stretch; padding: 10px 0 26px; }
}
@media (min-width: 901px) {
  /* 行動區只放按鈕，寬度依角色可能出現的最多按鈕而定；說明文字浮在按鈕上方，不佔圖板寬度 */
  .actions { position: relative; width: 140px; }
  .table[data-me="sea"] .actions { width: 280px; }
  .actions .act-info {
    position: absolute; left: 0; bottom: calc(100% - 8px); z-index: 6; display: block; width: max-content; max-width: 420px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: unset;
    font-size: 13px; line-height: 1; padding: 6px 12px; border-radius: 999px;
    background: rgba(9, 20, 25, .92); color: var(--cream); border: 1px solid rgba(239, 230, 210, .25); box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  }
  .actions .act-info:empty { display: none; }
}

/* ================= 第三輪調整 ================= */
/* 封閉港灣、強行登陸：不加任何遮罩，只有對話框本身 */
/* 出牌區：牌放大成畫面的視覺重心；多張時依張數縮小，仍放得下 */
.stage { gap: 14px; }
.stage-cards { gap: 18px; }
.stage-card .acard { width: clamp(120px, min(28vh, calc(56vw / var(--sn, 1))), 230px); padding: 14px 12px 12px; }
.stage-card .acard .idx { font-size: 1.9em; }
.stage-card .acard .emb { width: 46%; height: auto; }
.stage-card .acard .aname b { font-size: 18px; }
.stage-title { font-size: 17px; margin-top: 4px; }

/* ================= 電腦出牌、解決難題的動態 ================= */
.bot-play { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 65; pointer-events: none; }
.bot-play .stage-card .acard { width: clamp(110px, min(24vh, calc(50vw / var(--sn, 1))), 200px); box-shadow: 0 0 0 3px var(--cream), 0 18px 30px rgba(0, 0, 0, .6); }
.pcard.leaving { position: fixed; margin: 0; z-index: 60; pointer-events: none; }

.stage-ghost { position: fixed; z-index: 64; margin: 0; pointer-events: none; }

/* ---------- 姿態：牌桌中央兩張自己的姿態牌、一張電腦的蓋牌、2×2 結果表 ---------- */
.posture-table { border-collapse: collapse; font-size: 13px; background: rgba(9, 20, 25, .88); border-radius: 10px; overflow: hidden; box-shadow: 0 10px 24px rgba(0, 0, 0, .5); }
.posture-table th, .posture-table td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; }
.posture-table th { font-weight: 700; color: var(--cream-2); white-space: nowrap; }
.posture-table td { max-width: 190px; color: var(--cream); transition: background .15s; }
.posture-table td.hit { background: var(--gold); color: var(--night); font-weight: 700; }
.modal-box .posture-table { margin: 0 auto 14px; background: rgba(28, 26, 23, .06); box-shadow: none; }
.modal-box .posture-table th, .modal-box .posture-table td { color: var(--ink); border-color: rgba(28, 26, 23, .25); }
.modal-box .posture-table td.hit { background: var(--ink); color: var(--cream); }
.flip .face.c-active b { color: var(--gold); }
/* 強行登陸拿牌：島人的手牌攤在中央 */
.stage-tag { position: static; transform: none; }
.take-cards .stage-card .acard { width: clamp(84px, min(22vh, calc(64vw / var(--sn, 1))), 150px); box-shadow: 0 0 0 2px var(--line-2), 0 14px 24px rgba(0, 0, 0, .55); }
.take-cards .stage-card.on .acard { box-shadow: 0 0 0 3px var(--gold), 0 18px 30px rgba(0, 0, 0, .6); transform: translateY(-8px); }
@media (max-width: 600px) {
  .posture-table { font-size: 12px; }
  .posture-table td { max-width: 120px; }
  .take-cards { flex-wrap: wrap; justify-content: center; gap: 8px; max-width: calc(100vw - 32px); }
  .take-cards .stage-card .acard { width: 64px; padding: 6px 4px; }
  .take-cards .stage-card .acard .aname b { font-size: 12px; }
  .flip .face b { font-size: 26px; letter-spacing: .08em; }
}

/* 張數制：一列常有 4–6 張。手機上整列一次看得到：3–5 張縮放卡寬，6 張以上像實體版一樣橫向交疊 */
@media (max-width: 900px) {
  .lane, .lane-cards { min-width: 0; }
  .lane-cards { --k: clamp(3, var(--n, 3), 5); gap: 6px; overflow: visible; width: 100%; }
  .pcard { --w: calc((100% - (var(--k) - 1) * 6px) / var(--k)); }
  .pcard .pdiff { font-size: calc(25px - (var(--k) - 3) * 3px); }
  .pcard .pface { --bd: calc(60px - (var(--k) - 3) * 10px); }
  .lane-cards.crowd { gap: 0; }
  .lane-cards.crowd .pcard { --w: calc((100% - 24px) / 5); }
  .lane-cards.crowd .pcard + .pcard { margin-left: calc((100% - var(--w)) / (var(--n) - 1) - var(--w)); }
  .lane-cards.crowd .pcard { box-shadow: -6px 0 12px rgba(0, 0, 0, .45); }
  .lane-cards .pcard.selected, .lane-cards .pcard:focus-visible { z-index: 2; }
}

/* ---------- 結局：潮間紀事（8 個回合的行動方針與衝突結果） ---------- */
.chronicle { margin: 0 0 18px; }
.chronicle h3 { font-size: 18px; letter-spacing: .2em; margin: 0 0 10px; }
.ch-row { list-style: none; margin: 0 auto 10px; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; max-width: 420px; }
.ch-cell { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0 8px; border-radius: 6px; background: rgba(28, 26, 23, .05); }
.ch-cell.none { opacity: .35; }
.ch-r { font-family: var(--num); font-size: 12px; color: #5a5348; }
.ch-cs { display: flex; flex-direction: column; gap: 3px; min-height: 10px; }
.ch-p { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); box-sizing: border-box; }
.ch-p.p-calm { background: transparent; }
.ch-p.p-take { background: #2c7a80; border-color: #2c7a80; }      /* 海色：與封閉港灣的陸色在米白底上要分得開 */
.ch-p.p-sealed { background: #9a6b2f; border-color: #9a6b2f; }
.ch-p.p-miss { background: #8e2a1f; border-color: #8e2a1f; }
.ch-p.p-none { border-style: dotted; }
.ch-c { display: inline-block; width: 18px; height: 5px; border-radius: 3px; }
.ch-c.c-talk { background: var(--gold-deep); }
.ch-c.c-mixed { background: linear-gradient(90deg, var(--gold-deep) 50%, var(--ink) 50%); }
.ch-c.c-cold { background: var(--ink); }
.ch-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 13px; color: #5a5348; }
.ch-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend b { color: var(--ink); font-family: var(--num); }
.ch-legend .ch-p { width: 12px; height: 12px; }
.ch-legend .ch-c { width: 14px; }

/* 衝突揭曉：牌翻完（約 .9 秒）才浮現結果；細節收合 */
.after-flip { animation: after-flip .5s var(--ease-out) .85s both; }
@keyframes after-flip { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.reveal-more { margin: 0 0 14px; text-align: left; font-size: 14px; }
.reveal-more summary { cursor: pointer; color: #5a5348; text-align: center; list-style-position: inside; }
.reveal-more summary:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .after-flip { animation: none; } }

/* 手機底部托盤：行動列＋手牌黏在畫面底部（全域的 .hand { position: relative } 曾蓋掉這個設定）；
   紀錄、短語、規則收進行動列的「選單」，不再用浮動按鈕蓋住難題 */
.menu-btn, .drawer-rules { display: none; }
@media (max-width: 900px) {
  .hand { position: sticky; bottom: 0; }
  .actions { position: sticky; bottom: 132px; }
  .fabs { display: none; }
  .menu-btn { display: inline-flex; align-items: center; gap: 4px; position: relative; }
  .menu-btn .badge { position: absolute; top: -6px; right: -6px; margin: 0; background: var(--gold) !important; color: var(--ink) !important; border-radius: 10px; font-size: 12px; min-width: 18px; padding: 0 5px; line-height: 18px; text-align: center; }
  .menu-btn.on { background: var(--cream); color: var(--ink); }
  .drawer-rules { display: inline-block; }
  .drawer { position: fixed; width: 100%; z-index: 20; }   /* 頁面捲到哪都從畫面頂端打開，分頁永遠看得到 */
}

/* 民怨超過上限：已經會扣團結，用爆發橘紅，與低區預警的血紅分開 */
.seat .stat.over { position: relative; }
.seat .stat.over .stat-num, .seat .stat.over .stat-num small { color: var(--danger); }
.over-tip { background: var(--danger); color: var(--ink); }   /* 橘紅底配深色字，對比約 5.5:1 */
.over-tip::after { border-top-color: var(--danger); }
@media (max-width: 900px) { .seat-opp .over-tip::after { border-top-color: transparent; border-bottom-color: var(--danger); } }

/* 列頭小字：差一張「再 1 張」、滿了「結算爆發」（爆發在回合結算才發生） */
.lane-hint { position: relative; z-index: 2; font-size: 12px; font-weight: 700; line-height: 1.2; color: var(--cream); text-shadow: 0 1px 3px rgba(0, 0, 0, .8); white-space: nowrap; text-align: center; }
@media (min-width: 901px) { .lane-head .lane-hint { align-self: center; margin-top: -2px; } }
@media (max-width: 900px) { .lane-head .lane-sum { justify-self: end; } .lane-head .lane-hint { margin-left: 2px; } }

/* 行動卡插圖：取代中央剪影；米白底與卡面同色，不加框。寬最多約卡寬 86%，高不超過插圖那一列 */
.acard .art { mix-blend-mode: darken; display: block; width: auto; height: auto; max-width: 86%; max-height: 100%; min-height: 0; aspect-ratio: 1; object-fit: contain; align-self: center; pointer-events: none; user-select: none; }
.acard .art + .emb[hidden] { display: none; }
.stage-special { margin: 0; max-width: min(520px, calc(100vw - 32px)); font-size: 14px; color: var(--cream); text-align: center; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 12px rgba(0, 0, 0, .7); }
.stage-special b { color: var(--gold); }

/* 行動方針：標題＋兩卷紙捲。木製捲軸（兩端圓頭）夾住米白紙面；紙面靠近捲軸處有捲入的陰影、邊緣微黃 */
/* 舞台：深色半透明的布，把這一步和牌桌分開 */
.posture-mat { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 22px clamp(20px, 3vw, 40px) 26px;
  background: radial-gradient(ellipse at 50% 40%, rgba(9, 18, 22, .9), rgba(9, 18, 22, .78)); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.posture-title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: .14em; color: var(--cream); text-shadow: 0 1px 4px rgba(0, 0, 0, .9), 0 0 16px rgba(0, 0, 0, .6); }
.posture-title .term { color: inherit; font: inherit; letter-spacing: inherit; }
.posture-row { display: flex; align-items: flex-start; justify-content: center; gap: clamp(18px, 3.4vw, 40px); }
/* 羊皮紙：斑駁泛黃的紙面、焦褐的邊緣，右上角缺一角（第二張缺左下） */
.scroll {
  position: relative; width: clamp(220px, 22vw, 260px); padding: 0; margin: 0;
  background: none; border: 0; color: var(--ink); cursor: pointer; text-align: center;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .55));
  transition: transform .22s var(--ease-out), filter .22s var(--ease-out);
  animation: stage-in .25s var(--ease-out);
}
.scroll-paper {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 230px; padding: 28px 22px 28px; justify-content: flex-start;
  clip-path: polygon(0 3%, 4% 0, 70% 1%, 78% 0, 86% 6%, 92% 4%, 100% 14%, 99% 60%, 100% 97%, 94% 100%, 30% 99%, 3% 100%, 1% 70%);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(110, 70, 30, .38) 100%),
    radial-gradient(circle at 22% 30%, rgba(160, 120, 60, .18) 0 12%, transparent 30%),
    radial-gradient(circle at 75% 72%, rgba(150, 105, 50, .16) 0 10%, transparent 28%),
    radial-gradient(circle at 60% 18%, rgba(255, 250, 235, .35) 0 14%, transparent 34%),
    var(--grain), #e8d6ae;
}
.scroll.active .scroll-paper { clip-path: polygon(0 4%, 6% 0, 40% 1%, 96% 0, 100% 5%, 99% 50%, 100% 96%, 95% 100%, 24% 99%, 15% 93%, 8% 96%, 0 84%, 1% 40%); }
.scroll b { font-family: var(--serif); font-size: 23px; letter-spacing: .16em; padding-left: .16em; }
/* 名稱下的裝飾線：兩段細金線夾一顆菱形 */
.scroll-rule { display: block; width: 72%; height: 10px; color: var(--gold-deep); }
.scroll span:not(.scroll-paper) { font-size: 15px; line-height: 1.7; color: #3a342b; text-align: left; }
.scroll em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--dis); }
.scroll:hover:not(:disabled), .scroll:focus-visible { transform: translateY(-6px); filter: drop-shadow(0 0 2px var(--gold)) drop-shadow(0 0 1px var(--gold)) drop-shadow(0 20px 22px rgba(0, 0, 0, .6)); outline: none; }
.scroll.locked { cursor: not-allowed; }
.scroll.locked .scroll-paper { filter: grayscale(.7) brightness(.72); }
@media (max-width: 600px) {
  .posture-mat { padding: 16px 12px 20px; gap: 14px; width: calc(100vw - 24px); }
  .posture-title { font-size: 18px; }
  .posture-row { gap: 16px; }
  .scroll { width: calc(50vw - 40px); }
  .scroll-paper { min-height: 150px; padding: 22px 10px 20px; }
  .scroll b { font-size: 18px; letter-spacing: .08em; padding-left: .08em; }
  .scroll span:not(.scroll-paper) { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .scroll { animation: none; transition: none; } }

/* 選完行動方針的通知 */
.posture-notice { text-align: center; }
.posture-notice .pn-choices { margin: 6px 0 4px; }
.posture-notice .pn-choices b { margin: 0 4px; font-size: 18px; }

/* 行動卡下方：卡名縮小並往上收，不貼著內框；特殊卡多一行效果 */
.acard { padding-bottom: 14px; }
.acard .aname { gap: 2px; padding: 0 8px; }
.acard .aname b { font-size: 12px; }
.acard .aeffect { display: block; font-size: 12px; line-height: 1.3; color: #5a5348; text-align: center; }
.stage-card .acard { padding-bottom: 20px; }
.stage-card .acard .aname b { font-size: 15px; }
.stage-card .acard .aeffect { font-size: 13px; }
/* 小卡放不下效果：電腦攤牌、手機手牌與拿牌區 */
.acard.small .aeffect { display: none; }
@media (max-width: 900px) { .hand .acard .aeffect, .take-cards .acard .aeffect { display: none; } }
@media (max-width: 900px) { .acard { padding-bottom: 10px; } }
/* 桌面手牌交疊時只露一角：效果在滑過或選取時才顯示 */
@media (min-width: 901px) { .hand .hcard:not(:hover):not(.on) .aeffect { display: none; } }
