:root {
  --ink: #2a1a20;
  --ink-soft: #6e545c;
  --bg: #f7f0ea;
  --panel: #fffaf6;
  --panel-2: #ffffff;
  --wine: #7a1f3d;
  --wine-deep: #5a142c;
  --wine-soft: rgba(122, 31, 61, 0.12);
  --line: rgba(122, 31, 61, 0.22);
  --ocean: #19647e;
  --ocean-deep: #114354;
  --ocean-soft: rgba(25, 100, 126, 0.12);
  --water-surface: #38bdf8;
  --water-deep: #0284c7;
  --gold: #c45c2a;
  --wood: #8d4925;
  --wood-light: #d48c46;
  --ok: #2e7d4f;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --hot: #e15a38;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --shadow: 0 16px 36px rgba(90, 20, 44, 0.1);
  --shadow-sm: 0 4px 12px rgba(90, 20, 44, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
  --header-h: 4.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(122, 31, 61, 0.12), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(25, 100, 126, 0.12), transparent 40%),
    linear-gradient(180deg, #fffaf6 0%, var(--bg) 46%, #efe5dc 100%);
  line-height: 1.65;
  touch-action: manipulation;
}

#main {
  flex: 1 0 auto;
}

img,
svg {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* 無障礙跳轉與通用 */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.5rem 0.85rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: calc(var(--safe-top) + 0.6rem);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 頁首 Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: calc(0.55rem + var(--safe-top)) 11.5rem 0.55rem 1rem;
  background: rgba(255, 250, 246, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.btn-reset-header {
  border: 2px solid var(--wine);
  background: #fff;
  color: var(--wine);
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  box-shadow: 0 4px 0 var(--wine-deep);
  transform: translateY(-1px);
  transition: transform 0.12s var(--ease), box-shadow 0.12s, background 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-reset-header:hover {
  background: var(--wine-soft);
}

.btn-reset-header:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--wine-deep);
}

/* 主版面 Layout */
.layout {
  width: min(1400px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 calc(2rem + var(--safe-bottom));
}

.hero {
  text-align: center;
  margin-bottom: 1.1rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.3rem);
  font-weight: 900;
  color: var(--wine);
  letter-spacing: -0.01em;
}

.hero .lead {
  margin: 0.45rem auto 0;
  max-width: 960px;
  color: var(--ink-soft);
  font-size: 1.06rem;
}

.disclaimer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.85rem;
  background: rgba(141, 73, 37, 0.09);
  color: #733c1f;
  border: 1px dashed rgba(141, 73, 37, 0.3);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
}

/* 分頁 Tablist */
.tablist-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem 1rem;
  padding: 0.15rem 0.25rem 0.35rem;
}

.tablist {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: min-content;
}

.tab {
  flex: 0 0 auto;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.55rem 1.05rem;
  border-radius: 14px;
  cursor: pointer;
  min-height: 46px;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(122, 31, 61, 0.12);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab:hover {
  transform: translateY(-2px);
  border-color: var(--wine);
  color: var(--wine);
}

.tab[aria-selected="true"] {
  background: linear-gradient(180deg, #9a2a4e, var(--wine-deep));
  color: #fff;
  border-color: var(--wine-deep);
  box-shadow: 0 5px 0 #3d0c1c, 0 10px 18px rgba(90, 20, 44, 0.22);
}

.tab[data-tab="history"][aria-selected="true"] {
  background: linear-gradient(180deg, #ad592b, #843c16);
  border-color: #5a280c;
  box-shadow: 0 5px 0 #5a280c, 0 10px 18px rgba(141, 73, 37, 0.25);
}

.tab[data-tab="recap"][aria-selected="true"] {
  background: linear-gradient(180deg, #d4783a, #c45c2a);
  border-color: #8a3a16;
  box-shadow: 0 5px 0 #8a3a16, 0 10px 18px rgba(196, 92, 42, 0.22);
}

/* 面板 Panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.panel[hidden] {
  display: none !important;
}

.panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--wine);
}

.principle {
  margin: 0 0 1.15rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.6;
}

.principle strong {
  color: var(--ink);
  font-weight: 800;
}

/* 雙欄模擬網格 Sim Grid */
.sim-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(390px, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.sim-card,
.control-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.sim-card h3,
.control-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 雙重狀態顯示橫額 Dual State Banner */
.state-banner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.state-pill {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1.5px solid;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.state-pill.pill-buoyant {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}

.state-pill.pill-buoyant .pill-title {
  color: #166534;
  font-size: 0.92rem;
  font-weight: 700;
}

.state-pill.pill-buoyant .pill-value {
  font-size: 1.45rem;
  font-weight: 900;
  color: #15803d;
  margin-top: 0.15rem;
}

.state-pill.pill-status {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.state-pill.pill-status.is-sunk {
  background: var(--danger-bg);
  border-color: #fca5a5;
  color: var(--danger);
  animation: pulseSunk 1.2s ease-in-out infinite alternate;
}

@keyframes pulseSunk {
  from {
    box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.2);
  }
  to {
    box-shadow: 0 0 0 6px rgba(185, 28, 28, 0.15);
  }
}

.state-pill.pill-status .pill-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.state-pill.pill-status .pill-value {
  font-size: 1.12rem;
  font-weight: 900;
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* 舞臺 Stage SVG 容器 */
.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 11 / 7;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 30%, #7dd3fc 45%, #0284c7 75%, #075985 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(2, 132, 199, 0.35);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stage-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.stage-top-bar {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
  z-index: 10;
}

.stage-top-left {
  display: flex;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
}

.stage-top-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.stage-top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 0;
  min-width: 0;
}

.stage-badge {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
  border: 1px solid rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.waterline-badge {
  background: rgba(2, 132, 199, 0.94);
  color: #fff;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.timer-badge {
  background: rgba(185, 28, 28, 0.95);
  color: #fff;
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(185, 28, 28, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  animation: timerPulse 1.2s ease-in-out infinite alternate;
}

.timer-badge[hidden] {
  display: none !important;
}

@keyframes timerPulse {
  from {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.35);
  }
  to {
    transform: scale(1.03);
    box-shadow: 0 4px 18px rgba(185, 28, 28, 0.55);
  }
}

/* 容量總覽條 Compartment Summary Bar */
.capacity-readout-box {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.capacity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.compartment-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.comp-pill {
  flex: 1 1 auto;
  min-width: 54px;
  padding: 0.45rem 0.55rem;
  text-align: center;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.12s;
}

.comp-pill:hover {
  border-color: var(--ocean);
  background: #f0fdfa;
}

.comp-pill.is-punctured {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--danger);
}

.comp-pill.is-punctured::after {
  content: "💧已穿洞";
  font-size: 0.78rem;
  font-weight: 700;
}

.comp-pill.is-active-target {
  box-shadow: 0 0 0 2px var(--danger);
}

/* 控制台 Controls */
.control-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1e6de;
}

.control-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.control-hint {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  flex: 1 1 auto;
  min-width: 58px;
  min-height: 46px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.96rem;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.12s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.chip:hover {
  border-color: var(--wine);
  background: var(--wine-soft);
  color: var(--wine);
}

.chip.is-on {
  background: linear-gradient(180deg, #9a2a4e, var(--wine-deep));
  color: #fff;
  border-color: var(--wine-deep);
  box-shadow: 0 4px 0 #3d0c1c;
  transform: translateY(-1px);
}

.chip.is-control-1 {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #334155;
}

.chip.is-control-1.is-on {
  background: linear-gradient(180deg, #475569, #1e293b);
  border-color: #0f172a;
  color: #fff;
  box-shadow: 0 4px 0 #020617;
}

.warning-callout {
  margin-top: 0.45rem;
  padding: 0.5rem 0.85rem;
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: var(--warn);
  font-size: 0.92rem;
  font-weight: 700;
}

/* 穿洞與加減砝碼主操作區 Big Actions */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.action-btn {
  min-height: 50px;
  font-size: 1.05rem;
  font-weight: 900;
  border-radius: 14px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.12s var(--ease), box-shadow 0.12s, filter 0.12s;
}

.btn-puncture {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 5px 0 #7f1d1d;
}

.btn-puncture:hover {
  filter: brightness(1.08);
}

.btn-puncture:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7f1d1d;
}

.btn-puncture.is-punctured-mode {
  background: linear-gradient(180deg, #f97316, #c2410c);
  box-shadow: 0 5px 0 #7c2d12;
}

.weight-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.65rem;
}

.btn-weight-add {
  flex: 2;
  min-height: 50px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 1.12rem;
  font-weight: 900;
  border: none;
  border-radius: 14px;
  box-shadow: 0 5px 0 #92400e;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-weight-add:hover {
  filter: brightness(1.06);
}

.btn-weight-add:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #92400e;
}

.btn-weight-sub {
  flex: 1;
  min-height: 50px;
  background: #fff;
  color: #92400e;
  border: 2px solid #d97706;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 4px 0 #b45309;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-weight-sub:hover {
  background: #fffbeb;
}

.btn-weight-sub:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #b45309;
}

.btn-retry {
  width: 100%;
  min-height: 46px;
  margin-top: 0.65rem;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  color: #475569;
  font-size: 0.96rem;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.12s;
}

.btn-retry:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-replay {
  width: 100%;
  min-height: 46px;
  margin-top: 0.65rem;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  font-size: 0.96rem;
  font-weight: 800;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 4px 0 #1e3a8a;
  transition: all 0.12s;
}

.btn-replay:hover {
  filter: brightness(1.08);
}

.btn-replay:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1e3a8a;
}

/* 即時觀察與筆記區 Observe & Notes */
.observe-card {
  margin-top: 1.25rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.observe-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--wine);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.observe-text {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
  line-height: 1.65;
}

.notes-box {
  margin-top: 1rem;
  padding: 1rem;
  background: #fdf8f5;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
}

.notes-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.notes-box-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--wood);
}

.btn-copy-notes {
  min-height: 44px;
  padding: 0.45rem 1.05rem;
  background: #fff;
  border: 2px solid var(--wood);
  color: var(--wood);
  font-size: 0.94rem;
  font-weight: 800;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 3px 0 #5a280c;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.12s;
}

.btn-copy-notes:hover {
  background: rgba(141, 73, 37, 0.08);
}

.btn-copy-notes:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #5a280c;
}

.btn-copy-notes.is-copied {
  background: var(--ok);
  color: #fff;
  border-color: #1e5631;
  box-shadow: 0 3px 0 #143d22;
}

.notes-content-pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink);
  background: #fff;
  padding: 0.95rem;
  border-radius: 10px;
  border: 1px solid #ebd9cf;
}

/* 歷史與故事 History Panel */
.history-flow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.history-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
}

.history-card h3 {
  margin: 0 0 0.6rem;
  color: var(--wood);
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.history-card p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
}

.history-card p:last-child {
  margin-bottom: 0;
}

.quote-box {
  padding: 0.75rem 0.95rem;
  background: #fdf8f5;
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  font-style: normal;
  margin: 0.75rem 0;
  font-size: 0.92rem;
  color: #632d12;
}

/* 重點速記 Recap List */
.recap-list {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: recap;
}

.recap-list li {
  counter-increment: recap;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem 0.95rem 3.4rem;
  position: relative;
  font-size: 0.98rem;
  line-height: 1.6;
}

.recap-list li::before {
  content: counter(recap);
  position: absolute;
  left: 0.85rem;
  top: 0.95rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(180deg, #d4783a, #c45c2a);
  color: #fff;
  font-size: 0.9rem;
}

/* 頁尾 Footer */
.site-footer {
  padding: 1rem 1.2rem calc(1rem + var(--safe-bottom));
  text-align: center;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--ocean-deep);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* 響應式與 iPad 支援 */
@media (max-width: 960px) {
  .sim-grid,
  .history-flow {
    grid-template-columns: 1fr;
  }

  .site-header {
    padding-right: 6.5rem;
  }

  .brand-text strong {
    font-size: 0.88rem;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .panel {
    padding: 1rem 0.8rem 1.25rem;
  }

  .state-banner {
    grid-template-columns: 1fr;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .stage-top-bar {
    top: 0.45rem;
    left: 0.5rem;
    right: 0.5rem;
    gap: 0.3rem;
  }

  .stage-badge,
  .waterline-badge {
    font-size: 0.76rem;
    padding: 0.25rem 0.55rem;
  }

  .timer-badge {
    font-size: 0.82rem;
    padding: 0.25rem 0.65rem;
  }
}

/* 減弱動畫模式 prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
