:root {
  color-scheme: light;
  --color-bg: #0b1320;
  --color-bg-surface: #0f1f35;
  --color-panel: #f8fbff;
  --color-text: #0f1f35;
  --color-muted: #4f6a87;
  --color-accent: #2563eb;
  --color-accent-2: #0ea5e9;
  --color-highlight: #f59e0b;
  --color-focus: #f59e0b;
  --color-border: #a4bed6;
  --play-table-blue: #123d6f;
  --play-card-warm: #ffd166;
  --play-ink-line: rgba(255, 255, 255, .28);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 20% 0%, #14284a 0%, var(--color-bg) 35%, #050d1a 100%); color: var(--color-text); line-height: 1.6; }
a { color: var(--color-accent); }
button, select, input { font: inherit; }
button, select, label { min-height: 44px; }
button, select { border: 2px solid var(--color-border); border-radius: .65rem; padding: .65rem .9rem; }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--color-focus); outline-offset: 3px; }

.skip-link { position: absolute; left: .75rem; top: -5rem; padding: .75rem; background: var(--color-panel); z-index: 2; }
.skip-link:focus { top: .75rem; }
.site-header { position: relative; display: flex; justify-content: space-between; padding: 1rem clamp(1rem, 4vw, 3rem); background: linear-gradient(95deg, #0f2e58, var(--play-table-blue)); color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 .6rem 2rem rgba(0, 0, 0, .2); }
.site-header::after { content: ""; position: absolute; right: clamp(1rem, 4vw, 3rem); bottom: 0; left: clamp(1rem, 4vw, 3rem); height: 2px; border-radius: 999px; background: linear-gradient(90deg, transparent, var(--play-card-warm), transparent); opacity: .72; }
.site-header a { color: inherit; font-weight: 800; }
main { width: min(62rem, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 4rem; }
.play-stage-nav {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-top: 1.25rem;
  padding: .5rem;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  background: rgba(8, 19, 31, .78);
  backdrop-filter: blur(14px);
  box-shadow: 0 .7rem 1.6rem rgba(0, 0, 0, .18);
}
.play-stage-nav::after {
  content: "";
  display: block;
  width: min(22rem, 64%);
  height: 2px;
  margin: .42rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--play-card-warm), transparent);
  opacity: .72;
}
.play-stage-nav ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.play-stage-nav li {
  min-height: 2.5rem;
  display: grid;
  place-items: center;
  padding: .45rem .3rem;
  border-radius: 999px;
  color: #d9e2ec;
  font-size: .9rem;
  font-weight: 900;
  text-align: center;
}
.play-stage-nav li.active {
  color: #102a43;
  background: linear-gradient(145deg, #fff5c7, #ffd166);
}
.panel { margin-top: 1.5rem; padding: clamp(1rem, 3vw, 2rem); border: 2px solid rgba(255, 255, 255, .7); border-radius: 1.2rem; background: linear-gradient(150deg, rgba(245, 250, 255, .95), rgba(255, 255, 255, .88)); box-shadow: 0 .8rem 2rem rgba(8, 20, 37, .22); }
.play-stage.active { animation: stage-rise 180ms ease-out; }
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 1.1rem;
}
fieldset { display: grid; gap: .5rem; border: 0; padding: 0; }
fieldset label, .controls label { display: flex; align-items: center; gap: .6rem; }
#mode-selector label { align-items: start; }
#mode-selector label span { display: grid; gap: .2rem; }
#mode-selector label small { color: var(--color-muted); line-height: 1.35; }
#mode-selector label {
  position: relative;
  min-height: 8rem;
  justify-content: center;
  border: 2px solid rgba(159, 179, 200, .85);
  border-radius: 1rem;
  padding: .9rem 1rem;
  cursor: pointer;
  background: linear-gradient(145deg, rgba(232, 241, 247, .95), rgba(255, 255, 255, .85));
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
#mode-selector label:hover {
  transform: translateY(-1px);
  box-shadow: 0 .6rem 1.5rem rgba(15, 42, 67, .14);
}
#mode-selector label.selected {
  border-color: #d97706;
  box-shadow: 0 .9rem 1.8rem rgba(16, 42, 67, .14);
  background: radial-gradient(circle at 85% 18%, rgba(255, 209, 102, .55), transparent 32%), linear-gradient(145deg, rgba(255, 248, 230, .98), rgba(255, 255, 255, .92));
}
#mode-selector label input { position: absolute; left: .85rem; top: .9rem; }
#mode-selector label span { margin-left: 1.3rem; }
#mode-selector label small { margin-left: 1.3rem; }
.mode-description { margin: .75rem 0 0; padding: .75rem .85rem; border-radius: .7rem; color: var(--color-text); background: #eef4fb; font-weight: 700; }
.rehab-trust-card {
  display: grid;
  gap: .35rem;
  margin-top: 1rem;
  padding: .85rem 1rem;
  border: 2px solid rgba(255, 209, 102, .42);
  border-left: .34rem solid #ffd166;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(255, 250, 231, .95), rgba(255, 255, 255, .88));
  box-shadow: 0 .7rem 1.5rem rgba(15, 42, 67, .12);
}
.rehab-trust-card span {
  color: #9a5b00;
  font-size: .76rem;
  font-weight: 950;
  letter-spacing: .08em;
}
.rehab-trust-card p,
.rehab-trust-card small {
  margin: 0;
  color: var(--color-text);
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.58;
}
.rehab-trust-card small {
  color: var(--color-muted);
  font-size: .8rem;
  font-weight: 650;
}
.play-mode-guide { display: grid; gap: .75rem; margin-top: 1rem; }
.play-guide-card { padding: 1rem; border: 2px solid rgba(159, 179, 200, .65); border-radius: .9rem; background: linear-gradient(135deg, rgba(228, 241, 255, .86), rgba(255, 255, 255, .95)); }
.play-guide-card.active { border-color: #d97706; box-shadow: 0 .8rem 1.5rem rgba(16, 42, 67, .16); background: linear-gradient(135deg, rgba(255, 241, 168, .82), rgba(255, 255, 255, .96)); }
.play-guide-card span { color: #0f3a67; font-weight: 900; letter-spacing: .06em; }
.play-guide-card strong { display: block; margin: .25rem 0 .5rem; font-size: 1.05rem; }
.play-guide-card p { margin: .25rem 0; color: var(--color-muted); }
.play-guide-card b { color: var(--color-text); }
.use-case-grid {
  display: grid;
  gap: .8rem;
  margin-top: 1rem;
}
.use-case-grid article {
  padding: 1rem;
  border: 2px solid rgba(37, 99, 235, .18);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(232, 241, 247, .88));
  box-shadow: 0 .45rem 1rem rgba(16, 42, 67, .08);
}
.use-case-grid span {
  color: #0f3a67;
  font-size: .86rem;
  font-weight: 1000;
  letter-spacing: .07em;
}
.use-case-grid strong {
  display: block;
  margin: .28rem 0 .35rem;
  color: #102a43;
  font-size: 1.05rem;
}
.use-case-grid p { margin: 0; color: var(--color-muted); font-weight: 750; line-height: 1.55; }
.controls { display: grid; gap: .75rem; margin-top: 1rem; }
.game-toolbar { margin-top: 1rem; margin-bottom: .5rem; }
.game-toolbar h3 { margin: 0; font-size: .95rem; color: var(--color-muted); font-weight: 800; letter-spacing: .03em; }
.game-step-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin: .8rem 0 1rem; background: rgba(37, 99, 235, .11); border: 1px solid rgba(37, 99, 235, .24); border-radius: 999px; padding: .3rem; color: #0f3a67; font-weight: 800; text-align: center; }
.game-step-row span { padding: .45rem .25rem; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .16); }
.panel-card {
  border: 2px solid rgba(15, 118, 110, .2);
  border-radius: 1rem;
  padding: 1rem;
  background: linear-gradient(155deg, rgba(248, 252, 255, .95), rgba(255, 255, 255, .9));
}
#mode-selector { margin-top: .75rem; }
#mode-selector.play-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  margin-top: 1rem;
}
#mode-selector.play-mode-grid label {
  position: relative;
  min-height: 9rem;
  overflow: hidden;
}

#mode-selector.play-mode-grid label::before {
  position: absolute;
  top: .78rem;
  right: .78rem;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  color: #102a43;
  background: var(--play-card-warm);
  box-shadow: 0 .45rem 1rem rgba(16, 42, 67, .16);
  font-weight: 950;
}

#mode-selector.play-mode-grid label:nth-of-type(1)::before { content: "圖"; }
#mode-selector.play-mode-grid label:nth-of-type(2)::before { content: "接"; }
#mode-selector.play-mode-grid label:nth-of-type(3)::before { content: "聽"; }
#mode-selector.play-mode-grid label:nth-of-type(4)::before { content: "序"; }
#mode-selector.play-mode-grid strong {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  line-height: 1.2;
}
.game-dashboard {
  display: grid;
  gap: 1rem;
}
.game-launch-card,
.game-progress { margin-top: 0; }
.game-launch-card {
  display: grid;
  gap: .8rem;
  border: 2px solid rgba(37, 99, 235, .25);
}
.primary { min-width: 12rem; background: linear-gradient(120deg, #2563eb, #0ea5e9); color: #fff; border: 0; border-radius: 999px; font-weight: 900; padding-inline: 1.2rem; box-shadow: 0 .8rem 1.3rem rgba(14, 39, 87, .28); transition: transform 160ms ease, filter 160ms ease; }
.primary:hover { filter: brightness(1.05); }
.primary:active { transform: translateY(1px); }
.secondary { min-width: 0; background: transparent; color: var(--color-text); border: 2px solid rgba(15, 118, 110, .28); box-shadow: none; }
.secondary:hover { filter: none; }
.game-cta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.game-board { display: grid; gap: 1rem; margin-top: 1rem; }
.game-head { display: grid; gap: .4rem; }
.game-progress { padding: 1rem; border: 2px solid rgba(15, 118, 110, .26); border-radius: .95rem; background: linear-gradient(145deg, rgba(14, 116, 110, .12), rgba(255, 255, 255, .82)); }
.game-progress h3 { margin: 0 0 .45rem; }
.progress-stats { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; color: var(--color-text); font-weight: 800; }
.progress-stats output { display: inline-flex; border-radius: 999px; padding: .3rem .72rem; background: rgba(255, 255, 255, .88); border: 1px solid rgba(15, 118, 110, .25); }
.progress-meter { height: .55rem; margin: .45rem 0 .7rem; border-radius: 999px; background: rgba(7, 89, 133, .18); overflow: hidden; }
.progress-meter-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #0f766e, #38bdf8); transition: width 320ms ease; }
.round-history { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: .35rem 0 0; }
.round-history li { min-height: 2.1rem; display: grid; place-items: center; padding: .35rem .65rem; border: 1px solid rgba(15, 118, 110, .38); border-radius: 999px; background: rgba(15, 118, 110, .09); font-size: .92rem; color: #0f4c4d; }
.round-history li.done { background: linear-gradient(145deg, rgba(6, 95, 70, .18), rgba(16, 185, 129, .12)); border-color: rgba(16, 185, 129, .45); }
.round-history li.active { background: linear-gradient(145deg, rgba(37, 99, 235, .16), rgba(147, 197, 253, .15)); border-color: rgba(37, 99, 235, .45); }
.round-history li.pending { opacity: .7; }

.round-header { display: grid; gap: .5rem; }
.round-track { height: .7rem; overflow: hidden; border-radius: 999px; background: #d9e2ec; }
.round-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--color-accent); }
.mission-panel { display: grid; gap: .45rem; padding: 1.1rem; border: 2px solid rgba(7, 89, 133, .25); border-radius: 1rem; background: radial-gradient(circle at 8% 10%, rgba(255, 209, 102, .28), transparent 34%), linear-gradient(145deg, rgba(232, 241, 247, .92), rgba(255, 255, 255, .98)); }
.mission-panel span { color: var(--color-accent); font-size: .85rem; font-weight: 900; letter-spacing: .08em; }
.mission-panel p {
  margin: 0;
  color: var(--color-text);
  font-size: 1.08rem;
  font-weight: 850;
}
.mission-panel h3 { margin: .2rem 0 .35rem; font-size: clamp(1.25rem, 2.2vw, 1.65rem); }
.visual-prompt-card {
  display: grid;
  gap: .5rem;
  padding: .9rem;
  border: 2px solid rgba(37, 99, 235, .18);
  border-radius: .95rem;
  background: radial-gradient(circle at 86% 16%, rgba(255, 209, 102, .45), transparent 28%), linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(226, 241, 255, .92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.visual-prompt-card img {
  width: 100%;
  max-height: 18rem;
  object-fit: contain;
  border: 2px solid rgba(15, 42, 67, .14);
  border-radius: .75rem;
  background: #fff;
}
.visual-prompt-card strong {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #102a43;
  font-size: 1.05rem;
}
.visual-prompt-card p { margin: 0; color: var(--color-text); font-weight: 800; }
.visual-prompt-card ul { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.visual-prompt-card li { padding: .25rem .62rem; border-radius: 999px; color: #0f3a67; background: #fff; border: 1px solid rgba(37, 99, 235, .18); font-weight: 900; }
.listen-prompt-card {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  border: 2px solid rgba(37, 99, 235, .2);
  border-radius: 1rem;
  background: radial-gradient(circle at 86% 18%, rgba(255, 209, 102, .5), transparent 30%), linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(226, 241, 255, .92));
}
.listen-prompt-card .primary { justify-self: start; }
.listen-prompt-card output {
  color: #17324d;
  font-weight: 850;
}
.listen-prompt-card details {
  padding: .75rem .85rem;
  border: 1px solid rgba(37, 99, 235, .2);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .74);
}
.listen-prompt-card summary {
  cursor: pointer;
  color: #0f3a67;
  font-weight: 950;
}
.listen-prompt-card p {
  margin: .6rem 0 0;
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.6;
}
.sequence-card-row {
  display: grid;
  gap: .65rem;
  margin: .15rem 0 .25rem;
}
.sequence-step-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .45rem .6rem;
  align-items: center;
  padding: .8rem;
  border: 2px solid rgba(15, 118, 110, .22);
  border-radius: .9rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(225, 247, 240, .9));
}
.sequence-step-card span {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: .65rem;
  color: #102a43;
  background: #fff1a8;
  font-weight: 1000;
}
.sequence-step-card small { color: #17324d; font-size: 1rem; font-weight: 850; line-height: 1.5; }
.choice-panel {
  display: grid;
  gap: .65rem;
  margin: .35rem 0 .1rem;
}
.choice-panel > strong {
  color: #17324d;
  font-size: .95rem;
  font-weight: 1000;
}
.choice-deck {
  display: grid;
  gap: .65rem;
}
.choice-deck button {
  min-height: 5.5rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .75rem;
  align-items: center;
  padding: .9rem;
  border: 2px solid rgba(37, 99, 235, .22);
  border-radius: .8rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(235, 245, 255, .9));
  color: var(--color-text);
  text-align: left;
  box-shadow: 0 .45rem 1rem rgba(16, 42, 67, .1);
}
.choice-deck button:hover,
.choice-deck button.selected {
  border-color: #d97706;
  transform: translateY(-1px);
  background: linear-gradient(145deg, rgba(255, 248, 230, .98), rgba(255, 255, 255, .96));
}
.choice-deck button.correct {
  border-color: #0f766e;
  background: linear-gradient(145deg, rgba(220, 252, 231, .98), rgba(255, 255, 255, .96));
}
.choice-deck button.incorrect {
  border-color: #b45309;
  background: linear-gradient(145deg, rgba(255, 237, 213, .98), rgba(255, 255, 255, .96));
}
.choice-deck span {
  display: grid;
  place-items: center;
  width: 3.4rem;
  min-height: 2.2rem;
  border-radius: .55rem;
  color: #102a43;
  background: #fff1a8;
  font-weight: 1000;
}
.choice-deck strong {
  font-size: 1rem;
  line-height: 1.45;
}
.selected-choice-line {
  display: block;
  min-height: 2.5rem;
  padding: .55rem .75rem;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: .7rem;
  color: #0f4c4d;
  background: rgba(15, 118, 110, .08);
  font-weight: 850;
}
.round-results { display: grid; gap: .75rem; }
.round-results button { color: var(--color-text); background: var(--color-panel); font-weight: 800; border-radius: .8rem; transition: transform 150ms ease, box-shadow 150ms ease; }
.round-results button:hover { transform: translateY(-2px); box-shadow: 0 .45rem 1rem rgba(16, 42, 67, .16); }
.round-results button[data-round-outcome="independent"] { border-color: #0f766e; }
.round-results button[data-round-outcome="cue"] { border-color: #2563eb; }
.round-results button[data-round-outcome="switch-strategy"] { border-color: #b45309; }
.game-summary { margin-top: 1rem; padding: 1.25rem; border-left: .4rem solid #0f766e; border-radius: .75rem; background: rgba(15, 118, 110, .08); }
.game-summary span { color: var(--color-muted); font-weight: 800; }
.game-summary h3 { margin: .35rem 0; }
.share-summary-panel {
  display: grid;
  gap: .6rem;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: .9rem;
  background: rgba(255, 255, 255, .72);
}
.share-summary-panel h4, .share-summary-panel p { margin: 0; }
.share-summary-print-card {
  display: grid;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid rgba(15, 118, 110, .22);
  border-radius: 1rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(240, 253, 250, .86)),
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, .16), transparent 24%);
  box-shadow: 0 .7rem 1.4rem rgba(16, 42, 67, .08);
}
.share-summary-card-brand {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #0f766e;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.share-summary-print-card h5 {
  margin: 0;
  color: #102a43;
  font-size: 1.2rem;
}
.share-summary-meta,
.share-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
}
.share-summary-meta div,
.share-summary-metrics span {
  padding: .65rem;
  border-radius: .8rem;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(15, 118, 110, .14);
}
.share-summary-meta dt,
.share-summary-metrics small {
  color: var(--color-muted);
  font-size: .72rem;
  font-weight: 850;
}
.share-summary-meta dd,
.share-summary-metrics b {
  display: block;
  margin: .15rem 0 0;
  color: var(--color-text);
  font-size: 1rem;
}
.share-summary-print-card footer {
  color: var(--color-muted);
  font-size: .72rem;
  line-height: 1.45;
}
.share-summary-text {
  display: block;
  white-space: pre-wrap;
  padding: .85rem;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .86);
  color: var(--color-text);
  font-weight: 700;
}
.share-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.status { min-height: 3rem; color: var(--color-muted); font-weight: 700; }
.status-toast {
  display: grid;
  gap: .65rem;
  margin-top: 1rem;
  padding: .9rem 1rem;
  border-radius: .95rem;
  border: 1px solid rgba(15, 118, 110, .28);
  background: rgba(15, 118, 110, .08);
}
.status-action {
  justify-self: start;
}
[hidden] { display: none !important; }

.room-lobby {
  color: #fff;
  border-color: rgba(255, 255, 255, .16);
  background: radial-gradient(circle at 82% 18%, rgba(255, 195, 94, .2), transparent 28%), linear-gradient(145deg, #102a43, #173f5f 58%, #0d6b67);
  box-shadow: 0 1.5rem 3.75rem rgba(14, 36, 58, .22);
}
.room-heading, .room-join-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lobby-badge, .room-code { letter-spacing: .12em; font-weight: 900; }
.room-code { padding: .6rem .9rem; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: rgba(255, 255, 255, .1); }
.room-mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.room-mode-grid button { min-height: 9rem; display: grid; place-items: center; gap: .5rem; padding: 1.1rem; color: #fff; border: 1px solid rgba(255, 255, 255, .18); border-radius: 1rem; background: rgba(255, 255, 255, .08); }
.room-mode-grid button.active { color: #102a43; border-color: #fff1a8; background: linear-gradient(145deg, #fff5c7, #ffd166); transform: translateY(-2px); }
.room-mode-grid button:disabled { opacity: .48; cursor: not-allowed; }
.room-icon { font-size: 2rem; }
.room-mode-grid small { line-height: 1.45; }
.room-join-row label { display: flex; align-items: center; gap: .6rem; }
.room-join-row input { width: 9em; text-transform: uppercase; letter-spacing: .16em; }
.room-status { display: block; margin-top: .8rem; color: #d9f5f1; }
.game-result-badge {
  position: absolute;
  right: .8rem;
  top: .8rem;
  transform: translateY(-4px);
  opacity: 0;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1px solid rgba(7, 89, 133, .24);
  background: rgba(255, 255, 255, .96);
  transition: opacity 220ms ease, transform 220ms ease;
}
.game-result-badge.show { opacity: 1; transform: translateY(0); }
.game-result-badge.independent { border-color: #0f766e; color: #0f766e; }
.game-result-badge.cue { border-color: #2563eb; color: #1e40af; }
.game-result-badge.switch { border-color: #b45309; color: #b45309; }
.energy-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
  margin: .75rem 0;
  padding: .75rem .9rem;
  border: 2px solid rgba(15, 118, 110, .24);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(255, 241, 168, .85), rgba(220, 252, 231, .78));
}
.energy-strip strong { color: #0f4c4d; font-size: 1.08rem; }
.energy-strip small { color: #335c67; font-weight: 750; }
.achievement-badges { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 .7rem; }
.achievement-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .28rem .7rem;
  border-radius: 999px;
  color: #17324d;
  background: #fff;
  border: 1px solid rgba(15, 118, 110, .25);
  font-weight: 900;
  box-shadow: 0 .35rem .8rem rgba(15, 42, 67, .1);
}

@keyframes stage-rise {
  from { transform: translateY(8px); opacity: .72; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 45rem) {
  main { width: min(100% - 1rem, 58rem); padding-top: 1rem; }
  .play-stage-nav { border-radius: 1rem; }
  .play-stage-nav ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-actions { justify-content: stretch; }
  .stage-actions button { flex: 1 1 12rem; }
  .room-mode-grid { grid-template-columns: 1fr; }
  .room-heading, .room-join-row { align-items: stretch; flex-direction: column; }
  .game-step-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 42rem) {
  fieldset { grid-template-columns: repeat(2, 1fr); }
  #mode-selector { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .game-dashboard { grid-template-columns: 2fr 1fr; align-items: start; }
  .game-progress { position: sticky; top: 1rem; }
  .controls { grid-template-columns: repeat(2, 1fr); }
  .round-results { grid-template-columns: repeat(3, 1fr); }
  .play-mode-guide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .use-case-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  #mode-selector.play-mode-grid label::before { transform: none !important; }
}

@media print {
  @page { margin: 14mm; }

  body.printing-share-summary {
    background: #fff !important;
  }

  body.printing-share-summary * {
    visibility: hidden !important;
  }

  body.printing-share-summary .share-summary-panel,
  body.printing-share-summary .share-summary-panel * {
    visibility: visible !important;
  }

  body.printing-share-summary .share-summary-panel {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    max-width: 720px;
    margin: 0;
    padding: 28px;
    border: 1px solid #d6ebe7;
    border-radius: 20px;
    background: #fff !important;
    box-shadow: none;
  }

  body.printing-share-summary .share-summary-actions,
  body.printing-share-summary .share-summary-text,
  body.printing-share-summary .share-summary-panel > p {
    display: none !important;
  }

  body.printing-share-summary .share-summary-print-card {
    break-inside: avoid;
    box-shadow: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root { --color-bg: #08131f; --color-panel: #102a43; --color-text: #f0f4f8; --color-muted: #bcccdc; --color-border: #627d98; --color-accent: #38bdf8; }
}
