/* ui/style.css — 歷史知識大富翁介面：黏土玩具感（圓角、柔和陰影、米白卡片），亞熱帶晴天配色 */
:root {
  --sea: #2BA6A4; --sea-d: #1E7F7D; --rice: #7BBF5A; --rice-d: #5E9C41; --brick: #C2553D; --brick-d: #9C3F2B;
  --gold: #E8B33A; --gold-d: #B9871E; --cream: #FFF6E5; --ink: #3A2E2A; --ink-2: #5E4E46; --muted: #8A7A70;
  --line: rgba(58, 46, 42, .12); --card: rgba(255, 249, 238, .96);
  --shadow: 0 12px 30px rgba(58, 46, 42, .20), 0 2px 6px rgba(58, 46, 42, .10);
  --shadow-s: 0 4px 12px rgba(58, 46, 42, .16);
  --r-l: 24px; --r-m: 16px; --r-s: 12px;
  --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Heiti TC", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}

#ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-family: var(--font); color: var(--ink);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
.g-root { position: absolute; inset: 0; }
.g-root [hidden] { display: none !important; }
.g-root button, .g-root input { font-family: inherit; }
.ico { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }

/* ---------- 按鈕 ---------- */
.btn { pointer-events: auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap;
  font-size: 17px; font-weight: 800; letter-spacing: .02em; color: var(--ink); background: #fff;
  box-shadow: inset 0 -3px 0 rgba(58, 46, 42, .12), var(--shadow-s);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible, .tool-btn:focus-visible, .q-opt:focus-visible, .ani:focus-visible, .seg button:focus-visible, .roll-btn:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.primary { color: #fff; background: linear-gradient(180deg, #D46A50, var(--brick)); box-shadow: inset 0 -4px 0 var(--brick-d), 0 6px 16px rgba(194, 85, 61, .35); }
.btn.sea { color: #fff; background: linear-gradient(180deg, #3DBAB7, var(--sea)); box-shadow: inset 0 -4px 0 var(--sea-d), 0 6px 14px rgba(43, 166, 164, .3); }
.btn:disabled { background: #D8CFC6; box-shadow: inset 0 -4px 0 #C0B5AA; cursor: not-allowed; color: #F8F4EF; }
.btn.ghost { background: rgba(255, 255, 255, .94); color: var(--ink); }
.btn.link { background: transparent; box-shadow: none; color: var(--ink-2); min-height: 44px; padding: 0 12px; }
.btn.link .ico { color: var(--sea); }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 19px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; gap: 5px; }
.icon-btn { pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex: 0 0 auto; box-sizing: border-box; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--ink); box-shadow: var(--shadow-s); flex: none; }
.icon-btn .ico { width: 22px; height: 22px; }

/* ---------- 頭像 ---------- */
.avatar { position: relative; display: inline-block; flex: none; width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  background: var(--pcs, #eee); box-shadow: inset 0 0 0 3px #fff, 0 2px 6px rgba(58, 46, 42, .18); }
.avatar .av-fb { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; color: var(--pc, var(--ink)); font-size: 45%; }
.avatar .av-img { position: absolute; inset: 0; background-repeat: no-repeat; }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 3px #fff; pointer-events: none; }
.avatar.ghost { display: grid; place-items: center; background: #F1EAE0; color: #BBAEA2; }
.avatar.ghost .ico { width: 55%; height: 55%; }

/* 時代色標籤 */
.era-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap;
  background: rgba(255, 255, 255, .95); color: var(--ink); border-left: 6px solid var(--ec, var(--sea)); box-shadow: var(--shadow-s); }
.era-chip.solid { background: var(--ec, var(--sea)); color: #fff; border-left: 0; text-shadow: 0 1px 0 rgba(0, 0, 0, .15); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14); }
.era-chip.sm { padding: 3px 10px; font-size: 12px; }

/* ---------- HUD：玩家卡 ---------- */
.hud { position: absolute; top: calc(16px + var(--safe-t)); left: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.players { display: flex; flex-direction: column; gap: 10px; }
.pcard { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 12px; width: 236px; padding: 9px 14px 9px 9px;
  background: var(--card); border-radius: var(--r-m); box-shadow: var(--shadow-s); border: 2.5px solid transparent;
  transition: transform .25s ease, border-color .25s, box-shadow .25s, opacity .3s; }
.pcard.turn { border-color: var(--pc); transform: translateX(8px); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 22%, transparent), var(--shadow); }
.pcard.turn::before { content: ""; position: absolute; top: 50%; left: -20px; transform: translateY(-50%);
  border: 8px solid transparent; border-left: 10px solid var(--pc); }
.pcard.out { opacity: .5; filter: grayscale(.85); }
.pcard.offline { opacity: .72; }
.pc-av { width: 52px; height: 52px; }
.pc-info { min-width: 0; flex: 1; display: grid; gap: 1px; }
.pc-name { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 16px; min-width: 0; }
.pc-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { flex: none; font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; line-height: 1.35; }
.tag.you { background: var(--pc); color: #fff; }
.tag.cpu { background: #EFE7DC; color: var(--muted); }
.tag.net { background: #E1F1F0; color: var(--sea-d); }
.pc-cash { display: flex; align-items: center; gap: 6px; font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pc-cash.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.pc-props { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.pc-props .ico { color: var(--pc); width: 15px; height: 15px; }
.pc-badge { position: absolute; top: -9px; right: 10px; }
.pc-badge span { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; box-shadow: var(--shadow-s); }
.pc-badge .ico { width: 12px; height: 12px; }
.b-out { background: var(--ink); color: #fff; }
.b-off { background: #8A7A70; color: #fff; }
.b-skip { background: var(--gold); color: var(--ink); }
.round-pill { pointer-events: auto; display: inline-flex; align-items: baseline; gap: 5px; padding: 8px 16px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; box-shadow: var(--shadow-s); }
.round-pill b { font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }
.round-pill.bump { animation: bump .5s ease; }
.rp-total { opacity: .85; }

/* ---------- 工具列與連線提示 ---------- */
.tools { position: absolute; top: calc(16px + var(--safe-t)); right: 16px; display: flex; gap: 10px; }
.tool-btn { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border: 0; border-radius: 999px; background: var(--card); color: var(--ink); font-size: 15px; font-weight: 800; box-shadow: var(--shadow-s); cursor: pointer; }
.tool-btn:hover { background: #fff; }
.tool-btn .ico { width: 20px; height: 20px; color: var(--sea); }
.btn-leave .ico { color: var(--brick); }
.conn { position: absolute; top: calc(16px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 35; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; background: #FFF1D6; color: #8A5A10; font-weight: 800; font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.conn[data-state="lost"] { background: #FBE3DD; color: var(--brick-d); }
.conn .ico { width: 20px; height: 20px; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.toast { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); z-index: 60; padding: 12px 20px; border-radius: 999px;
  background: rgba(58, 46, 42, .92); color: #fff; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.toast.in { animation: msgIn .3s ease; }

/* ---------- 底部：訊息列＋擲骰 ---------- */
.bottom { position: absolute; left: 16px; right: 16px; bottom: calc(18px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: center; gap: 16px; }
.msgbar { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 680px; min-height: 54px; padding: 10px 14px 10px 16px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); }
.msgbar.flash { animation: msgIn .35s ease; }
@keyframes msgIn { from { transform: translateY(6px); opacity: .4; } }
.msg-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--sea); box-shadow: 0 0 0 4px rgba(43, 166, 164, .18); }
.msgbar[data-tone="good"] .msg-dot { background: var(--rice); box-shadow: 0 0 0 4px rgba(123, 191, 90, .22); }
.msgbar[data-tone="warn"] .msg-dot { background: var(--brick); box-shadow: 0 0 0 4px rgba(194, 85, 61, .2); }
.msgbar[data-tone="turn"] .msg-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 179, 58, .3); }
.msg-text { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.45; min-width: 0; flex: 1; padding-right: 8px; }
.timer-pill { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: #EFE7DC; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer-pill .ico { width: 17px; height: 17px; color: var(--sea); }
.timer-pill.urgent, .qt-timer.urgent { background: #FBE3DD; color: var(--brick-d); }
.roll-wrap { position: absolute; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.roll-who { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow-s);
  font-weight: 800; font-size: 14px; border: 2px solid var(--pc); max-width: 160px; }
.roll-who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rw-av { width: 30px; height: 30px; }
.roll-btn { pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 124px; height: 124px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 35% 30%, #DE7A60, var(--brick) 60%, var(--brick-d));
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .14), inset 0 0 0 5px rgba(255, 255, 255, .35), 0 10px 24px rgba(194, 85, 61, .4);
  font-size: 18px; font-weight: 900; transition: transform .15s, filter .2s; }
.roll-btn .ico { width: 42px; height: 42px; }
.roll-btn:disabled { cursor: default; background: radial-gradient(circle at 35% 30%, #CFC4B8, #B3A598 60%, #9C8E82); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .1), inset 0 0 0 5px rgba(255, 255, 255, .3), var(--shadow-s); }
.roll-btn:disabled .roll-label { font-size: 13px; padding: 0 14px; text-align: center; line-height: 1.25; max-width: 110px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.roll-btn.ready { animation: pulse 1.4s ease-in-out infinite; }
.roll-btn.ready:hover { transform: scale(1.05); }
@keyframes pulse { 50% { box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .14), inset 0 0 0 5px rgba(255, 255, 255, .35), 0 0 0 14px rgba(232, 179, 58, .38), 0 10px 24px rgba(194, 85, 61, .4); } }

/* ---------- 骰子（CSS 3D） ---------- */
.dice-stage { position: absolute; left: 50%; top: 40%; width: 84px; height: 84px; margin: -42px 0 0 -42px; perspective: 600px; z-index: 5;
  opacity: 0; transform: scale(.6); transition: opacity .25s, transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.dice-stage.show { opacity: 1; transform: scale(1); }
.dice-stage.rolling { animation: toss 1s cubic-bezier(.3, .6, .4, 1); }
@keyframes toss { 0% { translate: 0 60px; } 45% { translate: 0 -70px; } 75% { translate: 0 6px; } 88% { translate: 0 -10px; } 100% { translate: 0 0; } }
.dice-stage::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -26px; height: 14px; border-radius: 50%; background: rgba(58, 46, 42, .25); filter: blur(4px); }
.dice { position: absolute; inset: 0; transform-style: preserve-3d; }
.face { position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 13px; gap: 3px;
  background: radial-gradient(circle at 30% 25%, #fff, #F6EEDF); border-radius: 18px; box-shadow: inset 0 0 0 2px rgba(58, 46, 42, .1), inset 0 -5px 10px rgba(58, 46, 42, .08); backface-visibility: hidden; }
.face i { display: block; border-radius: 50%; margin: 2px; }
.face i.on { background: radial-gradient(circle at 35% 35%, #5E4E46, var(--ink)); }
.f1 i.on { background: radial-gradient(circle at 35% 35%, #DE7A60, var(--brick)); margin: -3px; }
.f1 { transform: rotateY(0deg) translateZ(42px); } .f6 { transform: rotateY(180deg) translateZ(42px); }
.f3 { transform: rotateY(90deg) translateZ(42px); } .f4 { transform: rotateY(-90deg) translateZ(42px); }
.f2 { transform: rotateX(90deg) translateZ(42px); } .f5 { transform: rotateX(-90deg) translateZ(42px); }

/* ---------- 飄字 ---------- */
.floats { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.float { position: fixed; transform: translate(-50%, 0); font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 #fff, 0 0 8px #fff; animation: floatUp 1.4s ease-out forwards; font-variant-numeric: tabular-nums; }
.float.up { color: var(--rice-d); }
.float.down { color: var(--brick); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }

/* ---------- 彈窗 ---------- */
.modal-layer { pointer-events: auto; position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(58, 46, 42, .16), rgba(58, 46, 42, .4)); }
.modal-layer.in { animation: fadeIn .2s ease; }
.modal-layer.in .modal { animation: popIn .32s cubic-bezier(.3, 1.35, .5, 1); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: translateY(14px) scale(.94); opacity: 0; } }
.modal-wrap { position: relative; width: min(500px, 100%); max-height: 100%; display: flex; }
.l-m-quiz .modal-wrap { width: min(600px, 100%); }
.l-m-end .modal-wrap { width: min(540px, 100%); }
.modal { position: relative; width: 100%; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; background: var(--cream);
  border-radius: var(--r-l); box-shadow: 0 24px 60px rgba(58, 46, 42, .35), 0 0 0 6px rgba(255, 255, 255, .55); overscroll-behavior: contain; }
.host-fig { position: absolute; right: calc(100% - 26px); bottom: -10px; width: 250px; z-index: 2; pointer-events: none; animation: hostIn .5s cubic-bezier(.3, 1.3, .5, 1) both; }
.host-img { width: 100%; height: auto; display: block; filter: drop-shadow(0 12px 18px rgba(58, 46, 42, .3)); opacity: 0; }
.host-img.ok { opacity: 1; }
@keyframes hostIn { from { transform: translateX(30px) rotate(6deg); opacity: 0; } }
.m-body { padding: 20px 24px 22px; }
.m-body.center { text-align: center; }
.m-body h2 { margin: 0; font-size: 26px; line-height: 1.3; }
.m-kicker { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--sea-d); margin-bottom: 6px; }
.m-kicker.center { justify-content: center; padding: 18px 20px 0; font-size: 16px; color: var(--ink); }
.m-kicker .ico { width: 20px; height: 20px; color: var(--brick); }
.mk-av { width: 30px; height: 30px; }
.m-note { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r-s); background: #E5F4F3; color: var(--sea-d); font-size: 15px; font-weight: 700; line-height: 1.55; }
.m-warn { margin: 10px 0 0; color: var(--brick); font-weight: 900; font-size: 15px; }
.m-timer { margin: 10px 0 0; font-size: 13px; color: var(--muted); text-align: right; }
.m-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.m-actions.center, .m-body.center .m-actions { justify-content: center; }
.m-card .m-actions { padding: 0 20px 20px; }
.m-actions .btn { min-width: 120px; }
.blurb { margin: 8px 0 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); }

/* 地產卡 */
.land-art { position: relative; height: 200px; overflow: hidden; border-radius: var(--r-l) var(--r-l) 0 0;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gc) 45%, #FFF6E5), var(--gc)); }
.la-fallback { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; color: rgba(255, 255, 255, .9);
  background: radial-gradient(circle at 20% 25%, rgba(255, 255, 255, .5) 0 3px, transparent 4px) 0 0 / 46px 46px,
              radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .35) 0 2px, transparent 3px) 0 0 / 34px 34px; }
.la-fallback .ico { width: 150px; height: 150px; margin-bottom: -8px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .14)); }
.la-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.la-img.ok { opacity: 1; }
.land-art .era-chip { position: absolute; left: 16px; top: 14px; --ec: var(--gc); }
.prop-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lv { display: inline-flex; gap: 2px; flex: none; }
.lv .st { color: #E2D8CC; } .lv .st.on { color: var(--gold); }
.lv .ico { width: 22px; height: 22px; }
.prop-stats { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 8px; margin: 14px 0 0; }
.prop-stats div { background: #fff; border-radius: var(--r-s); padding: 8px 10px; box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.prop-stats dt { font-size: 12px; color: var(--muted); font-weight: 700; }
.prop-stats dd { margin: 2px 0 0; white-space: nowrap; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* 題目窗 */
.q-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: var(--r-l) var(--r-l) 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ec) 22%, #FFF6E5), #FFF6E5); border-bottom: 2px dashed color-mix(in srgb, var(--ec) 40%, transparent); }
.q-av { width: 50px; height: 50px; display: none; }
.q-who { flex: 1; min-width: 0; }
.q-host { font-weight: 900; font-size: 17px; color: var(--ink); }
.q-sub { font-size: 14px; color: var(--ink-2); font-weight: 700; margin-top: 2px; }
.q-head .era-chip { --ec: inherit; }
.q-turn { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; margin: 0 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--pcs) 60%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 45%, transparent); font-weight: 900; font-size: 16px; }
.q-turn.mine { background: var(--pc); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--pc) 40%, transparent); }
.qt-av { width: 34px; height: 34px; }
.qt-text { flex: 1; min-width: 0; }
.q-turn.watch .qt-text::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.qt-timer { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--ink); font-variant-numeric: tabular-nums; }
.qt-timer .ico { width: 16px; height: 16px; color: var(--sea); }
.q-text { margin: 0 0 14px; font-size: 21px; font-weight: 900; line-height: 1.5; }
.q-opts { display: grid; gap: 10px; }
.q-opt { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px 8px 8px; text-align: left; border: 0; cursor: pointer;
  border-radius: var(--r-m); background: #fff; color: var(--ink); font-size: 17px; font-weight: 800; line-height: 1.4;
  box-shadow: inset 0 0 0 2px var(--line), inset 0 -3px 0 rgba(58, 46, 42, .06); transition: transform .12s, box-shadow .12s, background .2s; }
@media (hover: hover) { .q-mine .q-opt:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 0 0 2.5px var(--sea), inset 0 -3px 0 rgba(58, 46, 42, .06); } }
.q-key { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #F1EAE0; color: var(--ink); font-weight: 900; }
.q-label { flex: 1; min-width: 0; }
.q-mark { flex: none; width: 26px; height: 26px; display: grid; place-items: center; }
.q-mark .ico { width: 24px; height: 24px; }
.q-opt:disabled { cursor: default; }
.q-watch .q-opt:disabled:not(.right):not(.wrong):not(.dim) { background: #FBF7F1; }
.q-opt.picked { box-shadow: inset 0 0 0 2.5px var(--gold); background: #FFF3D6; }
.q-opt.right { background: #EAF6E2; box-shadow: inset 0 0 0 2.5px var(--rice-d); color: #3F6E2A; animation: rightPop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes rightPop { 35% { transform: scale(1.05); } 65% { transform: scale(.98); } }
.q-opt.right .q-key { background: var(--rice-d); color: #fff; }
.q-opt.wrong { background: #FBE6E0; box-shadow: inset 0 0 0 2.5px var(--brick); color: var(--brick-d); }
.q-opt.wrong .q-key { background: var(--brick); color: #fff; }
.q-opt.dim { opacity: .5; }
.q-opts, .m-quiz .m-body { overflow: visible; }
.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.burst i { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; color: var(--gold);
  filter: drop-shadow(0 0 4px rgba(232, 179, 58, .9)) drop-shadow(0 2px 2px rgba(185, 135, 30, .5)); animation: starOut 1.1s cubic-bezier(.15, .8, .3, 1) both; }
.burst i .ico { width: 100%; height: 100%; }
@keyframes starOut { 0% { transform: translate(0, 0) scale(0) rotate(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(var(--s)) rotate(var(--r)); opacity: 0; } }
.q-result { margin-top: 14px; padding: 12px 16px; border-radius: var(--r-m); animation: popIn .3s ease; }
.q-result.ok { background: #EAF6E2; } .q-result.ng { background: #FDF0E0; }
.q-verdict { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 900; }
.q-result.ok .q-verdict { color: #3F6E2A; } .q-result.ng .q-verdict { color: #A55A1E; }
.q-verdict .ico { width: 22px; height: 22px; }
.q-explain { margin: 6px 0 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); }

/* 事件卡：翻牌 */
.flip { perspective: 1200px; padding: 14px 28px 0; }
.flip-inner { position: relative; height: 320px; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.2, .5, 1); }
.flip.open .flip-inner { transform: rotateY(180deg); }
.card-back, .card-front { position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: var(--shadow); }
.card-back { background: linear-gradient(135deg, var(--ec), color-mix(in srgb, var(--ec) 70%, #3A2E2A)); display: grid; place-items: center; }
.cb-pattern { position: absolute; inset: 12px; border-radius: 14px; border: 3px solid rgba(255, 246, 229, .55);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .08) 0 14px, transparent 14px 28px); }
.cb-icon { position: relative; display: grid; justify-items: center; gap: 8px; color: var(--cream); font-weight: 900; font-size: 20px; letter-spacing: .2em; }
.cb-icon .ico { width: 84px; height: 84px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .2)); }
.cb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; z-index: 1; }
.cb-img.ok { opacity: 1; }
.card-front { transform: rotateY(180deg); padding: 20px 22px 20px; display: flex; flex-direction: column; gap: 10px;
  border: 6px solid var(--ec); background: radial-gradient(circle at 100% 0, #FFEFCB, #FFFBF3 50%); }
.cf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cf-year { font-weight: 900; color: var(--ink-2); font-size: 15px; }
.card-front h3 { margin: 0; font-size: 25px; line-height: 1.3; }
.cf-fact { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); flex: 1; overflow: auto; }
.cf-effect { align-self: flex-start; padding: 8px 16px; border-radius: 999px; font-size: 17px; font-weight: 900; }
.cf-effect.good { background: #EAF6E2; color: #3F6E2A; }
.cf-effect.bad { background: #FBE6E0; color: var(--brick-d); }

/* 通知 */
.notice-ico { width: 64px; height: 64px; margin: 4px auto 10px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--sea); }
.notice-ico.bad { background: var(--ink); }
.notice-ico .ico { width: 34px; height: 34px; }
.notice-av { width: 88px; height: 88px; margin: 4px auto 10px; display: block; }
.t-bad .notice-av { filter: grayscale(.7); }

/* 結算 */
.end-art { position: relative; height: 210px; border-radius: var(--r-l) var(--r-l) 0 0; overflow: hidden;
  background: radial-gradient(circle at 50% 115%, #FFE7A6, transparent 62%), linear-gradient(170deg, #3DBAB7, var(--sea-d)); }
.ea-rays { position: absolute; left: 50%; top: 115%; width: 900px; height: 900px; margin: -450px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 246, 229, .18) 0 10deg, transparent 10deg 20deg); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ea-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.ea-img.ok { opacity: 1; }
.ea-podium { position: absolute; left: 0; right: 0; bottom: -6px; display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.ea-fig { height: 190px; width: auto; opacity: 0; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .25)); }
.ea-fig.ok { opacity: 1; animation: hop .7s .2s ease both; }
.ea-fig:nth-child(n+2) { height: 150px; }
@keyframes hop { 40% { transform: translateY(-14px); } }
.ea-trophy { position: absolute; right: 18px; top: 14px; color: var(--gold); }
.ea-trophy .ico { width: 56px; height: 56px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.end-title { text-align: center; }
.end-sub { margin: 6px 0 14px; text-align: center; color: var(--muted); font-size: 15px; font-weight: 600; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: var(--r-m); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.rank li.r1 { box-shadow: inset 0 0 0 2.5px var(--gold); background: #FFF8E4; }
.rank li.me { box-shadow: inset 0 0 0 2.5px var(--pc); }
.rank li.out { opacity: .6; }
.rk { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: #F1EAE0; color: var(--ink); }
.rank li.r1 .rk { background: var(--gold); box-shadow: 0 0 0 4px rgba(232, 179, 58, .3); }
.rk-av { width: 44px; height: 44px; }
.rn { flex: 1; min-width: 0; display: grid; }
.rn b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rn small { font-size: 13px; color: var(--muted); }
.rt { font-size: 20px; font-variant-numeric: tabular-nums; flex: none; }

/* 說明 */
.help { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.help li::marker { color: var(--brick); }
.help-eras { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 14px; font-weight: 800; color: var(--muted); }
.help-eras > span:first-child { margin-right: 4px; }
.help-note { margin: 12px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ---------- 全螢幕畫面（開始、設定、大廳） ---------- */
.screen { pointer-events: auto; position: absolute; inset: 0; z-index: 20; overflow-y: auto; overflow-x: hidden; background: #BFE6EC; }
.cover { position: fixed; inset: 0; overflow: hidden; }
.cover picture, .cover-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-img { object-fit: cover; opacity: 0; transition: opacity .5s; }
.cover-img.ok { opacity: 1; }
.cover-fb { position: absolute; inset: 0; }
.cf-sky { position: absolute; inset: 0; background: linear-gradient(180deg, #8FD3E8 0%, #C9EEF0 48%, #F4F9EC 62%); }
.cf-sun { position: absolute; right: 12%; top: 9%; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, #FFF3C4 0 45%, rgba(255, 233, 160, .6) 46% 60%, transparent 62%); box-shadow: 0 0 80px 30px rgba(255, 236, 170, .55); }
.cf-cloud { position: absolute; width: 220px; height: 56px; border-radius: 999px; background: #fff; opacity: .9; filter: drop-shadow(0 6px 0 rgba(43, 166, 164, .12)); animation: drift 60s linear infinite; }
.cf-cloud::before, .cf-cloud::after { content: ""; position: absolute; border-radius: 50%; background: #fff; }
.cf-cloud::before { width: 90px; height: 90px; left: 34px; top: -46px; }
.cf-cloud::after { width: 70px; height: 70px; left: 110px; top: -32px; }
.cf-cloud.c1 { left: 6%; top: 14%; }
.cf-cloud.c2 { left: 55%; top: 24%; transform: scale(.7); animation-duration: 80s; }
.cf-cloud.c3 { left: 30%; top: 6%; transform: scale(.5); opacity: .75; animation-duration: 100s; }
@keyframes drift { 50% { translate: 40px 0; } }
.cf-sea { position: absolute; left: 0; right: 0; bottom: 0; height: 44%; background: linear-gradient(180deg, #43BDB8, var(--sea) 40%, #20908E); }
.cf-sea::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(170deg, rgba(255, 255, 255, .12) 0 2px, transparent 2px 46px); }
.cf-isle { position: absolute; left: 50%; bottom: 30%; width: min(70vw, 900px); height: 22vh; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 100%, #8FCB66 0 55%, transparent 56%); }
.cf-isle::before { content: ""; position: absolute; left: 30%; bottom: 30%; width: 40%; height: 85%;
  background: linear-gradient(180deg, #5E9C41, #7BBF5A); clip-path: polygon(0 100%, 22% 45%, 34% 62%, 52% 0, 68% 55%, 80% 38%, 100% 100%); }
.cf-wave { position: absolute; left: 0; right: 0; bottom: 18%; height: 30px; background: radial-gradient(circle at 25px -8px, transparent 24px, rgba(255, 255, 255, .4) 25px 28px, transparent 29px) 0 0 / 50px 30px repeat-x; animation: wave 6s linear infinite; }
@keyframes wave { to { background-position: 50px 0; } }
.cf-sand { position: absolute; left: -5%; right: -5%; bottom: -8vh; height: 24vh; border-radius: 50% 50% 0 0 / 60% 60% 0 0; background: linear-gradient(180deg, #F6E3B4, #EBD08E); box-shadow: 0 -8px 0 rgba(255, 255, 255, .5); }

.start { position: relative; min-height: 100%; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.15fr); grid-template-rows: 1fr auto;
  grid-template-areas: "title cast" "actions cast"; gap: 12px 24px; padding: clamp(20px, 5vh, 56px) clamp(20px, 5vw, 80px) clamp(20px, 6vh, 64px); box-sizing: border-box; }
.st-title { grid-area: title; align-self: center; display: flex; flex-direction: column; align-items: flex-start; animation: popIn .6s cubic-bezier(.3, 1.3, .5, 1); }
.kicker { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--sea-d); font-weight: 900; font-size: 15px; box-shadow: var(--shadow-s); }
.st-title h1 { margin: 14px 0 6px; font-size: clamp(44px, 5.4vw, 88px); line-height: 1.08; letter-spacing: .03em; color: var(--brick); font-weight: 900;
  text-shadow: 3px 3px 0 #fff, -3px 3px 0 #fff, 3px -3px 0 #fff, -3px -3px 0 #fff, 0 4px 0 #fff, 0 -4px 0 #fff, 4px 0 0 #fff, -4px 0 0 #fff, 0 9px 0 rgba(58, 46, 42, .18), 0 14px 26px rgba(58, 46, 42, .25); }
.map-badge { display: inline-flex; padding: 6px 22px; border-radius: 14px; background: var(--gold); color: var(--ink); font-size: clamp(20px, 2vw, 28px); font-weight: 900; letter-spacing: .2em;
  box-shadow: inset 0 -4px 0 var(--gold-d), var(--shadow-s); transform: rotate(-2deg); }
.tagline { margin: 16px 0 0; max-width: 520px; padding: 10px 18px; border-radius: 16px; background: rgba(255, 255, 255, .88); font-size: 17px; font-weight: 700; line-height: 1.6; color: var(--ink-2); box-shadow: var(--shadow-s); }
.era-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; max-width: 540px; }
.st-actions { grid-area: actions; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; width: min(440px, 100%); animation: popIn .6s .1s cubic-bezier(.3, 1.3, .5, 1) both; }
.st-actions .b-local { width: 100%; }
.st-net { display: flex; gap: 10px; width: 100%; }
.st-net .btn { flex: 1; }
.st-cast { grid-area: cast; position: relative; align-self: end; height: min(72vh, 640px); min-height: 360px; }
.cast-row { position: absolute; left: 0; right: 0; bottom: 0; height: 64%; }
.cast-a { position: absolute; bottom: calc(var(--i) * 0%); width: 22%; animation: castIn .6s calc(var(--i) * 70ms + .2s) cubic-bezier(.3, 1.4, .5, 1) both; }
.cast-a .cast-img { width: 100%; height: auto; display: block; opacity: 0; filter: drop-shadow(0 10px 10px rgba(58, 46, 42, .25)); }
.cast-a .cast-img.ok { opacity: 1; }
.cast-a:nth-child(1) { left: 2%; bottom: 14%; width: 20%; z-index: 2; }
.cast-a:nth-child(2) { left: 18%; bottom: 30%; width: 17%; z-index: 1; }
.cast-a:nth-child(3) { left: 31%; bottom: 8%; width: 18%; z-index: 3; }
.cast-a:nth-child(4) { left: 47%; bottom: 30%; width: 19%; z-index: 1; }
.cast-a:nth-child(5) { left: 61%; bottom: 6%; width: 21%; z-index: 3; }
.cast-a:nth-child(6) { left: 79%; bottom: 22%; width: 18%; z-index: 2; }
.cast-a:nth-child(7) { left: 15%; bottom: -2%; width: 19%; z-index: 4; }
@keyframes castIn { from { transform: translateY(40px) scale(.8); opacity: 0; } }
.cast-a:hover .cast-img { animation: hop .5s ease; }
.cast-host { position: absolute; right: 2%; top: 0; width: 34%; animation: castIn .7s .1s cubic-bezier(.3, 1.4, .5, 1) both; }
.cast-host .cast-img { width: 100%; height: auto; opacity: 0; filter: drop-shadow(0 12px 14px rgba(58, 46, 42, .25)); }
.cast-host .cast-img.ok { opacity: 1; }
.cast-bubble { position: absolute; right: 88%; top: 8%; padding: 10px 16px; border-radius: 18px; background: #fff; font-weight: 900; font-size: 16px; line-height: 1.4; box-shadow: var(--shadow-s); white-space: nowrap; }
.cast-bubble::after { content: ""; position: absolute; right: -12px; top: 22px; border: 8px solid transparent; border-left: 14px solid #fff; }

/* 面板（單機設定、加入、大廳） */
.panel-wrap { position: relative; min-height: 100%; display: flex; align-items: center; justify-content: center; padding: clamp(14px, 4vh, 40px) 16px; box-sizing: border-box; }
.panel { width: min(760px, 100%); background: rgba(255, 249, 238, .97); border-radius: 28px; box-shadow: 0 24px 60px rgba(58, 46, 42, .3), 0 0 0 6px rgba(255, 255, 255, .5);
  display: flex; flex-direction: column; animation: popIn .4s cubic-bezier(.3, 1.3, .5, 1); }
.panel.narrow { width: min(520px, 100%); }
.panel.lobby { width: min(640px, 100%); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 6px; }
.panel-head h2 { margin: 0; font-size: 24px; }
.panel-body { padding: 10px 22px 6px; display: grid; gap: 16px; }
.panel-body.center { text-align: center; justify-items: center; }
.panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 22px 22px; flex-wrap: wrap; }
.field { display: grid; gap: 8px; }
.f-label { font-size: 14px; font-weight: 900; color: var(--muted); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 16px; background: #EFE6D9; justify-self: start; }
.seg button { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--ink-2); font-size: 16px; font-weight: 800; white-space: nowrap; }
.seg button .ico { width: 18px; height: 18px; }
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-s); }
.seg-ctl button[aria-checked="true"][data-v="human"] { background: var(--pc); color: #fff; }
.seg.readonly button { cursor: default; }
.seg.readonly button:not([aria-checked="true"]) { opacity: .5; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seat-card { display: grid; gap: 10px; padding: 12px; border-radius: 20px; background: #fff; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 35%, transparent), var(--shadow-s); }
.sc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-no { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--pc); color: #fff; font-weight: 900; }
.sc-top .seg { flex: none; padding: 3px; border-radius: 13px; }
.sc-top .seg button { min-height: 44px; padding: 0 10px; font-size: 14px; border-radius: 10px; gap: 4px; }
.sc-name, .name-input, .code-input, .share-url { pointer-events: auto; min-width: 0; flex: 1; height: 44px; padding: 0 12px; border-radius: 12px; border: 2px solid #E6DCCF; background: #FFFCF6;
  font-size: 16px; font-weight: 700; color: var(--ink); box-sizing: border-box; width: 100%; }
.sc-name:focus, .name-input:focus, .code-input:focus { outline: none; border-color: var(--sea); }
.code-input { font-size: 26px; letter-spacing: .4em; text-transform: uppercase; height: 56px; text-align: center; font-weight: 900; }
.ani-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ani { pointer-events: auto; position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 44px; padding: 0; border: 0; border-radius: 14px; cursor: pointer; background: transparent; }
.ani .ani-av { width: 100%; height: 100%; max-width: 54px; max-height: 54px; box-shadow: inset 0 0 0 3px #fff; transition: transform .15s; }
.ani[aria-checked="true"] .ani-av { box-shadow: 0 0 0 3px var(--pc), 0 6px 12px color-mix(in srgb, var(--pc) 40%, transparent); transform: scale(1.06); }
.ani.taken .ani-av { opacity: .35; filter: grayscale(.8); }
.ani-tag { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); padding: 0 5px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 800; white-space: nowrap; }
.hint { margin: 0; color: var(--brick); font-weight: 800; }
.hint.small { font-size: 13px; color: var(--muted); font-weight: 600; line-height: 1.6; }
.err { margin: 0; padding: 10px 14px; border-radius: 12px; background: #FBE6E0; color: var(--brick-d); font-weight: 800; }
.lead { margin: 0; font-size: 17px; line-height: 1.7; color: var(--ink-2); font-weight: 600; }
.big-ico { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; background: #E1F1F0; color: var(--sea); }
.big-ico .ico { width: 42px; height: 42px; }
.join-form { gap: 14px; }
.join-form .b-go { width: 100%; }

/* 大廳 */
.room-box { display: grid; gap: 10px; padding: 14px; border-radius: 20px; background: #fff; box-shadow: var(--shadow-s); }
.room-code { display: flex; align-items: baseline; gap: 12px; }
.rc-label { font-weight: 900; color: var(--muted); }
.rc-code { font-size: 44px; letter-spacing: .25em; color: var(--brick); font-weight: 900; line-height: 1; }
.share { display: flex; gap: 8px; }
.share-url { font-size: 13px; color: var(--ink-2); }
.lobby-seats { display: grid; gap: 8px; }
.ls-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 2px var(--line); min-height: 44px; }
.ls-row.me { box-shadow: inset 0 0 0 2.5px var(--pc); background: color-mix(in srgb, var(--pcs) 35%, #fff); }
.ls-row.empty { background: #FBF7F1; }
.ls-row.off { opacity: .6; }
.ls-no { flex: none; width: 22px; text-align: center; font-weight: 900; color: var(--muted); }
.ls-av { width: 44px; height: 44px; }
.ls-info { flex: 1; min-width: 0; display: grid; }
.ls-info b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-info small { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; }
.dot.on { background: var(--rice); } .dot.off { background: #BBAEA2; }
.me-field .name-input { flex: none; }
.wait-host { margin: 0; font-weight: 800; color: var(--muted); order: -1; flex-basis: 100%; text-align: center; }

/* ---------- 窄螢幕（手機直向） ---------- */
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .hud { left: 8px; right: 8px; top: calc(8px + var(--safe-t)); flex-direction: row; align-items: stretch; gap: 6px; }
  .players { flex: 1; flex-direction: row; gap: 6px; min-width: 0; }
  .pcard { flex: 1; min-width: 0; width: auto; flex-direction: column; gap: 2px; padding: 6px 4px 5px; text-align: center; border-width: 2px; }
  .pcard.turn { transform: translateY(3px); }
  .pcard.turn::before { display: none; }
  .pc-av { width: 32px; height: 32px; }
  .pc-info { justify-items: center; gap: 0; width: 100%; }
  .pc-name { font-size: 12.5px; gap: 3px; justify-content: center; max-width: 100%; }
  .pc-name .tag { display: none; }
  .pc-cash { font-size: 14px; gap: 3px; }
  .pc-cash .ico { width: 13px; height: 13px; }
  .pc-props { font-size: 11px; }
  .pc-unit { display: none; }
  .pc-badge { top: -7px; right: 2px; }
  .pc-badge span { font-size: 10px; padding: 2px 5px; }
  .round-pill { flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px 9px; border-radius: 14px; font-size: 11px; }
  .round-pill .rp-label { display: none; }
  .round-pill b { font-size: 20px; line-height: 1.1; }
  .tools { top: auto; right: auto; left: 8px; bottom: calc(84px + var(--safe-b)); flex-direction: column; gap: 8px; }
  .tool-btn { width: 46px; height: 46px; padding: 0; justify-content: center; }
  .tool-btn span { display: none; }
  .conn { top: calc(96px + var(--safe-t)); font-size: 13px; padding: 8px 14px; }
  .toast { bottom: calc(110px + var(--safe-b)); }
  .bottom { left: 8px; right: 8px; bottom: calc(10px + var(--safe-b)); justify-content: flex-start; }
  .msgbar { max-width: none; flex: 1; margin-right: 98px; min-height: 52px; padding: 8px 10px 8px 12px; border-radius: 18px; gap: 8px; }
  .msg-text { font-size: 14.5px; padding-right: 0; }
  .timer-pill { padding: 4px 8px; }
  .roll-btn { width: 88px; height: 88px; font-size: 15px; }
  .roll-btn .ico { width: 30px; height: 30px; }
  .roll-btn:disabled .roll-label { font-size: 11px; padding: 0 8px; max-width: 76px; }
  .roll-who { max-width: 120px; font-size: 13px; }
  .modal-layer { align-items: flex-end; padding: 0; }
  .modal-wrap, .l-m-quiz .modal-wrap, .l-m-end .modal-wrap { width: 100%; }
  .modal { max-height: 90vh; max-height: 90dvh; border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(58, 46, 42, .3); padding-bottom: var(--safe-b); }
  .modal-layer.in .modal { animation: sheetIn .35s cubic-bezier(.3, 1.1, .5, 1); }
  @keyframes sheetIn { from { transform: translateY(40%); opacity: .3; } }
  .host-fig { display: none; }
  .q-av { display: inline-block; width: 44px; height: 44px; }
  .q-head { padding: 12px 14px; border-radius: 24px 24px 0 0; gap: 10px; }
  .q-host { font-size: 15px; }
  .q-sub { font-size: 13px; }
  .q-head .era-chip { padding: 4px 9px; font-size: 12px; }
  .q-text { font-size: 18px; margin-bottom: 12px; }
  .q-opt { font-size: 16px; min-height: 50px; }
  .q-turn { font-size: 15px; }
  .land-art { height: 140px; border-radius: 24px 24px 0 0; }
  .la-fallback .ico { width: 110px; height: 110px; }
  .m-body { padding: 14px 16px 18px; }
  .m-body h2 { font-size: 22px; }
  .prop-stats { grid-template-columns: 1fr 1fr; }
  .prop-stats div:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .m-actions .btn { flex: 1; min-width: 0; }
  .flip { padding: 12px 16px 0; }
  .flip-inner { height: 300px; }
  .card-front h3 { font-size: 22px; }
  .end-art { height: 150px; border-radius: 24px 24px 0 0; }
  .ea-fig { height: 140px; } .ea-fig:nth-child(n+2) { height: 110px; }
  .dice-stage { top: 42%; }

  .start { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "title" "cast" "actions"; gap: 8px; padding: calc(18px + var(--safe-t)) 16px calc(16px + var(--safe-b)); min-height: 100%; }
  .st-title { align-items: center; text-align: center; }
  .kicker { font-size: 13px; padding: 4px 12px; }
  .st-title h1 { font-size: clamp(36px, 10.5vw, 52px); margin: 10px 0 6px; }
  .map-badge { font-size: 18px; padding: 4px 16px; }
  .tagline { font-size: 14.5px; padding: 8px 12px; margin-top: 10px; }
  .era-row { justify-content: center; margin-top: 8px; }
  .era-row .era-chip.sm { font-size: 11px; padding: 2px 8px; }
  .st-cast { height: auto; min-height: 190px; align-self: stretch; }
  .cast-host { width: 30%; right: 0; top: -2%; }
  .cast-bubble { display: none; }
  .cast-row { height: 100%; }
  .st-actions { width: 100%; align-items: stretch; }
  .st-net .btn { padding: 0 12px; }
  .b-help { align-self: center; }
  .panel-wrap { padding: calc(10px + var(--safe-t)) 10px calc(10px + var(--safe-b)); align-items: flex-start; }
  .panel { border-radius: 24px; }
  .panel-head { padding: 14px 14px 4px; }
  .panel-head h2 { font-size: 21px; }
  .panel-body { padding: 8px 14px 4px; gap: 14px; }
  .panel-foot { padding: 12px 14px 16px; }
  .panel-foot .btn { flex: 1; }
  .panel-foot .btn.big { padding: 0 16px; font-size: 17px; }
  .seats { grid-template-columns: 1fr; gap: 10px; }
  .seat-card { padding: 10px; gap: 8px; }
  .seg button { padding: 0 12px; font-size: 15px; }
  .rc-code { font-size: 36px; }
  .share .btn span { display: none; }
}

/* 桌機但高度不足（小筆電、iframe） */
@media (min-width: 761px) and (max-height: 760px) {
  .pcard { padding: 6px 12px 6px 8px; }
  .pc-av { width: 42px; height: 42px; }
  .land-art { height: 140px; }
  .host-fig { width: 200px; }
  .flip-inner { height: 280px; }
  .end-art { height: 160px; }
  .q-text { font-size: 19px; }
}

/* 很窄的手機（360 寬） */
@media (max-width: 380px) {
  .pc-cash { font-size: 13px; }
  .pc-name { font-size: 12px; }
  .ani-row { gap: 2px; }
  .sc-top .seg button span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .roll-btn.ready, .cf-cloud, .cf-wave, .ea-rays, .conn .ico { animation: none; }
  .flip-inner { transition-duration: .01s; }
}

/* 封面圖本身已畫好角色與藍鵲：載入成功就收起 CSS 角色排列，避免角色重複；玩法說明加底色才看得清楚 */
.has-cover .st-cast > * { visibility: hidden; }
.has-cover .b-help { background: rgba(255, 246, 229, 0.92); box-shadow: 0 2px 10px rgba(58, 46, 42, 0.18); border-radius: 999px; }

/* ===== 2026-10-30 視覺審查修正 ===== */
/* 1. 封面圖成功載入後，CSS 替身背景（天空、雲、太陽、海、沙）整個不畫；載入前先藏 0.8 秒，避免淡入時兩層疊在一起 */
.cover-fb { opacity: 0; animation: fbIn .4s ease .8s forwards; }
.cover.img-ok .cover-fb { display: none; }
.cover.img-ok .cover-img { transition: none; }
@keyframes fbIn { to { opacity: 1; } }

/* 2. 旁觀者題目：選項變灰、沒有 hover，並說明只有誰可以作答 */
.q-watch .q-opt:not(.right):not(.wrong) { opacity: .55; filter: grayscale(.5); cursor: not-allowed; box-shadow: none; transform: none; }
.q-watch-note { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--muted); }
.q-watch-note .ico { width: 16px; height: 16px; }
.q-opt.right .burst, .q-opt .burst { left: auto; right: 28px; top: 50%; }

/* 3. 連線提示：兩行（誰、怎麼處理），桌機加大 */
.conn { flex-direction: row; align-items: flex-start; gap: 12px; padding: 14px 26px; border-radius: 20px; font-size: 18px; max-width: min(760px, calc(100% - 520px)); min-width: 360px; }
.conn .ico { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.conn-text { display: grid; gap: 2px; }
.conn-text b { font-size: 19px; }
.conn-text small { font-size: 15px; font-weight: 700; opacity: .85; line-height: 1.45; }
.conn[data-state="peer"] { background: #E9F4FB; color: #22567A; }
.conn[data-state="peer"] .ico { animation: none; }

/* 8. 結算的「（1 塊）」不斷行 */
.nowrap { white-space: nowrap; }

/* 11. 開局順序公告 */
.order-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 26; pointer-events: none; display: grid; gap: 10px; justify-items: center;
  padding: 18px 28px; border-radius: 24px; background: rgba(255, 249, 238, .97); box-shadow: var(--shadow); text-align: center; animation: popIn .32s cubic-bezier(.3, 1.35, .5, 1); }
.order-banner h3 { margin: 0; font-size: 20px; }
.ob-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-weight: 800; font-size: 17px; }
.ob-row .avatar { width: 40px; height: 40px; }
.ob-p { display: flex; align-items: center; gap: 6px; }
.ob-row .ico { width: 18px; height: 18px; color: var(--muted); }
.order-banner.out { opacity: 0; transition: opacity .4s; }

@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  /* 4. 手機的連線提示放在玩家卡下方 */
  .conn { top: calc(134px + var(--safe-t)); left: 8px; right: 8px; transform: none; max-width: none; min-width: 0; padding: 10px 14px; border-radius: 16px; font-size: 14px; gap: 8px; }
  .conn .ico { width: 20px; height: 20px; }
  .conn-text b { font-size: 14.5px; }
  .conn-text small { font-size: 12.5px; }
  /* 5、7. 面板：標題與底部按鈕固定，中間捲動 */
  .screen:has(.panel-wrap) { overflow: hidden; }
  .panel-wrap { height: 100%; min-height: 0; align-items: stretch; }
  .panel { display: flex; flex-direction: column; max-height: 100%; align-self: flex-start; }
  .panel-head, .panel-foot { flex: none; }
  .panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .panel-foot { box-shadow: 0 -8px 14px -10px rgba(58, 46, 42, .25); }
  /* 7. 彈窗底部按鈕黏在可視範圍 */
  .modal .m-body > .m-actions:last-child { position: sticky; bottom: 0; margin-left: -16px; margin-right: -16px; padding: 12px 16px calc(14px + var(--safe-b)); background: var(--cream); box-shadow: 0 -8px 14px -10px rgba(58, 46, 42, .25); z-index: 3; }
  /* 9. 手機玩家卡補上小標籤 */
  .pcard { position: relative; }
  .pc-name .tag { display: inline-block; position: absolute; top: -7px; left: 3px; font-size: 10px; padding: 1px 6px; box-shadow: 0 1px 3px rgba(58, 46, 42, .2); }
  .pc-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .order-banner { width: calc(100% - 32px); box-sizing: border-box; padding: 14px 16px; }
  .order-banner h3 { font-size: 17px; }
  .ob-row { font-size: 14px; gap: 6px; }
  .ob-row .avatar { width: 30px; height: 30px; }
}

/* ===== 2026-10-30 第二輪視覺小修 ===== */
/* 2. 面板不透明；面板畫面的封面圖模糊變暗，當背景，不跟面板搶 */
.panel { background: #FFF9EE; }
.screen:not(.sc-start) .cover-img.ok { filter: blur(7px) saturate(.9) brightness(.82); transform: scale(1.06); }
/* 4. 連線提示：兩種斷線同樣寬、同樣顯眼，用顏色區分；離線徽章收進卡片內 */
.conn { width: min(760px, calc(100% - 640px)); min-width: 0; box-sizing: border-box; border: 2px solid transparent; }
.conn[data-state="reconnecting"], .conn[data-state="migrating"], .conn[data-state="ok"] { background: #FFEBC2; color: #6B4100; border-color: var(--gold); }
.conn[data-state="lost"] { border-color: var(--brick); }
.conn[data-state="peer"] { background: #DCEBFA; color: #123E66; border-color: #2F7FD0; }
.conn[data-state="peer"] .conn-text small { opacity: 1; }
.pc-badge { top: 8px; right: 10px; }
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  .conn { width: auto; }
  /* 1. 手機：標籤在左上、暫停／離線／破產徽章改放卡片下緣中央，兩者不重疊 */
  .pc-badge { top: auto; bottom: -15px; right: auto; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 2; }
  /* 5. 捲動區底部留內距，最後一列不會貼在固定底欄下 */
  .panel-body { padding-bottom: 28px; }
  .modal .m-body > .m-actions:last-child { margin-top: 22px; }
  .m-help .help-list, .m-help ul { padding-bottom: 8px; }
}
/* 2. 面板畫面：模糊封面上再蓋一層米色薄紗，藍鵲與角色只剩淡淡色塊 */
.screen:not(.sc-start) .cover.img-ok::after { content: ""; position: absolute; inset: 0; background: rgba(255, 246, 229, .38); }
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  /* 5. 手機大廳收緊間距，輪數選擇器在一般手機高度內完整露出 */
  .panel.lobby .panel-body { gap: 10px; }
  .panel.lobby .room-box { padding: 10px 12px; gap: 6px; }
  .panel.lobby .room-box .hint { font-size: 12px; line-height: 1.4; margin: 0; }
  .panel.lobby .ls-row { padding: 3px 10px; }
  .panel.lobby .ls-row .avatar { width: 38px; height: 38px; }
}
