:root {
  --ink: #2a2118;
  --ink-soft: #6d5e4f;
  --paper: #f4eee4;
  --paper-2: #fffdf8;
  --line: #e4d5c2;
  --tomato: #c23b22;
  --tomato-deep: #8e2414;
  --gold: #d4a017;
  --gold-soft: #f3dd9a;
  --teal: #2f6f6a;
  --sky: #3d6ea8;
  --ok: #2e7d4f;
  --bad: #b42318;
  --shadow: 0 14px 36px rgba(80, 48, 24, 0.1);
  --radius: 18px;
  --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 TC", "Microsoft JhengHei", sans-serif;
  --mono: "Source Code Pro", "SF Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(194, 59, 34, 0.1), transparent 52%),
    radial-gradient(800px 380px at 100% 0%, rgba(212, 160, 23, 0.14), transparent 46%),
    linear-gradient(180deg, #fbf6ee 0%, var(--paper) 42%, #efe4d4 100%);
  line-height: 1.65;
  font-size: 1.02rem;
}

#main {
  flex: 1 0 auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.5rem 0.85rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
}

.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;
}

.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, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  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;
}

.brand-text strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
}

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

.star-summary {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tomato);
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout {
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.1rem 0 calc(2rem + var(--safe-bottom));
}

.hero {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.2rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.hero h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 900;
}

.hero .lead {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.mode-tabs {
  display: inline-flex;
  background: #efe4d4;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
  font-family: inherit;
}

.mode-tab[aria-selected="true"] {
  background: #fff;
  color: var(--tomato);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 1px solid #f0d0c4;
  background: #fff4ee;
  color: #6a3326;
  font-size: 0.95rem;
}

.banner-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.2rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1.12rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.kcard {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.kcard h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.kcard p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.kcard:nth-child(1) { border-left-color: var(--tomato); }
.kcard:nth-child(2) { border-left-color: var(--gold); }
.kcard:nth-child(3) { border-left-color: var(--teal); }

details.cheat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

details.cheat summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--teal);
  list-style: none;
}

details.cheat summary::-webkit-details-marker {
  display: none;
}

.cheat-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.8rem;
  font-size: 0.88rem;
}

.cheat-table th,
.cheat-table td {
  border: 1px solid var(--line);
  padding: 0.5rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.cheat-table th {
  background: #f6efe4;
}

.motto {
  color: var(--tomato);
  font-weight: 800;
}

.tutorial-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
}

.tutor-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.tutor-steps li {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #efe6d8;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.tutor-steps li.is-on {
  background: var(--sky);
  color: #fff;
}

.tutor-steps li.is-done {
  background: #dceee3;
  color: var(--ok);
}

#tutorial-desc {
  margin: 0.4rem 0 0.8rem;
}

#tutorial-align-hint {
  color: var(--teal);
  font-weight: 700;
  font-size: 0.92rem;
  margin: 0 0 0.6rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  text-decoration: none;
  background: var(--tomato);
  color: #fff;
  box-shadow: 0 6px 0 var(--tomato-deep);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 var(--tomato-deep);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: #efe6d8;
  color: var(--ink);
  box-shadow: 0 6px 0 #d9cbb6;
}

.btn-sky {
  background: var(--sky);
  box-shadow: 0 6px 0 #2a507c;
}

.btn-ok {
  background: var(--ok);
  box-shadow: 0 6px 0 #1e5a38;
}

.btn-gold {
  background: var(--gold);
  color: #3a2a00;
  box-shadow: 0 6px 0 #a57c10;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.view-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.view-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--tomato);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
}

.view-frame {
  background: #2a2118;
  color: #f7efe3;
  border-radius: 16px;
  min-height: 280px;
  padding: 1rem;
  overflow: auto;
}

.balance {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
}

.pan {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.7rem;
  text-align: center;
}

.pan-label {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  color: #cbbba6;
}

.frac strong {
  display: block;
  font-size: 2.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.frac-bar {
  display: block;
  height: 2px;
  margin: 0.25rem auto;
  width: 70%;
  background: #f3dd9a;
}

.frac.is-lit {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 8px;
}

.fulcrum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.factor {
  font-size: 1rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #3d342a;
  color: #cbbba6;
}

.factor.is-on {
  background: var(--gold);
  color: #3a2a00;
}

.eq {
  font-size: 1.75rem;
  font-weight: 900;
  color: #f3dd9a;
}

.unit-row,
.share-col {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 0.85rem;
}

.unit-row i,
.share-col i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(#f3dd9a, #d4a017);
}

.share-grid {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.share-caption {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: #d9cbb8;
  text-align: center;
}

.ld {
  font-family: var(--mono);
  position: relative;
}

.ld-grid {
  display: grid;
  justify-content: start;
  align-items: center;
  column-gap: 0;
  row-gap: 3px;
}

.ld-cell {
  min-width: 1.7rem;
  min-height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
}

.ld-pv {
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #cbbba6;
  min-height: 1.1rem;
}

.ld-pv.is-ones,
.ld-cell.is-ones {
  box-shadow: inset 0 -2px 0 #ffe08a;
}

.ld-pv.is-dot-h {
  color: #8a7b68;
}

.ld.is-calc .is-dot,
.ld.is-calc .is-dot-h,
.ld.is-calc .ld-pv.is-dot-h {
  opacity: 0.1;
}

.ld-cell.is-q {
  color: #ffe08a;
}

.ld-cell.is-q.is-wait {
  border-bottom: 2px dashed rgba(255, 224, 138, 0.35);
}

.ld-cell.is-q.is-placeholder,
.ld-cell.is-dim {
  color: #8a7b68;
}

.ld-cell.is-div {
  color: #9ad7d2;
  justify-content: flex-end;
  padding-right: 0.15rem;
  min-width: 2.4rem;
}

.ld-cell.is-d {
  color: #f7efe3;
}

.ld-cell.is-dot.has-beam,
.ld-cell.is-dot.is-new {
  color: #ffe08a;
  text-shadow: 0 0 10px #f3dd9a;
}

.ld-cell.is-pad,
.ld-cell.is-bring.is-pad {
  color: #ffe08a;
  border-bottom: 2px dashed #ffe08a;
}

.ld-cell.is-mul {
  color: #9ad7d2;
}

.ld-cell.is-rem {
  color: #f3dd9a;
}

.ld-cell.is-bring {
  color: #f3dd9a;
}

.ld-cell.is-on {
  background: rgba(243, 221, 154, 0.16);
  border-radius: 6px;
}

.ld-rule {
  height: 2px;
  background: #f7efe3;
  align-self: center;
}

.ld-sub {
  height: 2px;
  background: #c23b22;
  align-self: center;
}

.ld-arc {
  width: 14px;
  height: 2rem;
  border: 3px solid #f7efe3;
  border-right: 0;
  border-radius: 16px 0 0 16px;
  justify-self: end;
}

.ld-beam {
  width: 3px;
  justify-self: center;
  align-self: stretch;
  background: linear-gradient(#ffe08a, rgba(255, 224, 138, 0.15));
  border-radius: 99px;
  box-shadow: 0 0 10px #f3dd9a;
  pointer-events: none;
}

.old-shift,
.ld-caption {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #d9cbb8;
  font-family: var(--font);
  line-height: 1.55;
}

.ld-caption {
  color: #f7efe3;
}

.op {
  display: inline-block;
  margin: 0 0.25rem 0 0;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.op-div { background: #3d6ea8; color: #fff; }
.op-mul { background: #2f6f6a; color: #fff; }
.op-sub { background: #c23b22; color: #fff; }
.op-pad { background: #d4a017; color: #3a2a00; }

.ld-check {
  margin: 0.75rem 0 0;
  font-family: var(--font);
  font-weight: 700;
}

.ld-check.is-ok {
  color: #8dffb0;
}

.ld-wrong {
  color: #ffb4a8;
  text-decoration: line-through;
  font-size: 1.2rem;
}

.point-slot {
  width: 22px;
  height: 28px;
  padding: 0;
  border: 1px dashed #f3dd9a;
  background: transparent;
  color: #ffe08a;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  justify-self: center;
}

.point-slot.is-on {
  background: #ffe08a;
  color: #2a2118;
  border-style: solid;
}

.console h2 {
  margin-top: 0;
}

.console-hint {
  margin: 0 0 1rem;
  color: #8a5a22;
  font-weight: 700;
  font-size: 0.92rem;
}

.sliders {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.slider-box {
  background: #f6efe4;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
}

.slider-box label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.val-pill {
  background: #fff;
  color: var(--sky);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.9rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--tomato);
  height: 1.4rem;
}

input[type="range"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}

.stage-box {
  margin-top: 1rem;
  background: #f6efe4;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
}

.stage-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  font-weight: 800;
}

.stage-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.stage-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  min-height: 52px;
  min-width: 5.1rem;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
}

.stage-chip em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.stage-chip span {
  font-size: 0.88rem;
  font-weight: 800;
}

.stage-chip.is-on {
  background: var(--tomato);
  border-color: var(--tomato);
  color: #fff;
}

.stage-chip.is-on em {
  color: #ffd7cc;
}

.stage-chip.is-done {
  background: #f3dd9a;
  border-color: #e0c36a;
}

.stage-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stage-caption {
  margin: 0.65rem 0 0;
  color: #6a4a28;
  font-size: 0.9rem;
  font-weight: 700;
}

.presets {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.presets-label {
  font-weight: 800;
  color: var(--ink-soft);
}

#preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.step-tools,
.mission-tools {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px dashed var(--tomato);
  border-radius: 14px;
  background: #fff8f4;
}

.step-tools h3,
.mission-tools h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.step-note {
  margin: 0.55rem 0 0;
  font-weight: 700;
  font-size: 0.9rem;
}

.step-note.is-ok { color: var(--ok); }
.step-note.is-bad { color: #8a3b16; }

.digit-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.digit-keys .btn {
  min-width: 2.6rem;
  min-height: 44px;
  box-shadow: 0 4px 0 #d9cbb6;
}

.ld-pv.is-pick {
  cursor: pointer;
  border: 1px dashed rgba(243, 221, 154, 0.45);
  border-radius: 8px;
  background: transparent;
  color: #cbbba6;
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 800;
}

.ld-pv.is-pick:hover,
.ld-pv.is-pick.is-on {
  background: #ffe08a;
  color: #2a2118;
  border-style: solid;
}

.shift-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0.4rem 0 0.8rem;
  font-variant-numeric: tabular-nums;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.choice {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  min-height: 44px;
  font-family: inherit;
  cursor: pointer;
}

.choice.is-on {
  border-color: var(--tomato);
  background: #fff1ea;
  font-weight: 700;
}

.field {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.7rem;
}

.game-toolbar {
  margin-top: 0.35rem;
}

.game-answer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1rem;
}

.game-answer-row .field {
  margin-top: 0;
}

.game-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.game-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.game-tools-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.field input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem 0.7rem;
  font-size: 1.05rem;
  font-family: inherit;
  width: 8rem;
}

.game-start,
.game-result {
  text-align: center;
  padding: 1.4rem 1rem;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0 1.2rem;
  text-align: left;
}

.diff-card {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.diff-card em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--tomato);
}

.diff-card strong {
  display: block;
  margin: 0.15rem 0 0.2rem;
  font-size: 1rem;
}

.diff-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.diff-card.is-on {
  border-color: var(--tomato);
  background: #fff6f2;
  box-shadow: inset 0 0 0 1px var(--tomato);
}

.game-expr {
  font-size: 1.65rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  margin: 0.2rem 0 0.8rem;
}

.game-result-stars {
  font-size: 2rem;
  margin: 0 0 0.3rem;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.pill {
  background: #fff1ea;
  color: var(--tomato);
  font-weight: 800;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.88rem;
}

.feedback {
  min-height: 1.4rem;
  margin: 0.8rem 0 0;
  font-weight: 700;
}

.feedback.is-ok { color: var(--ok); }
.feedback.is-bad { color: #8a3b16; }

.wrong-list {
  text-align: left;
  max-width: 36rem;
  margin: 0.8rem auto 1rem;
  padding: 0;
  list-style: none;
}

.wrong-list li {
  background: #f6efe4;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
}

.dd-board {
  text-align: left;
}

.dd-board-intro {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 0.9rem;
}

.dd-board-mine,
.dd-board-status {
  background: #fff8e8;
  border: 1px solid var(--gold-soft);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.85rem;
  color: #6a4d00;
  font-weight: 700;
}

.dd-board-status.is-ok {
  background: #eef7f0;
  border-color: #b7dcc2;
  color: var(--ok);
}

.dd-board-status.is-bad {
  background: #fff1ea;
  border-color: #f0c8b8;
  color: var(--tomato-deep);
}

.dd-board-table-wrap {
  overflow-x: auto;
}

.dd-board-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.dd-board-table th,
.dd-board-table td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.dd-board-table th {
  background: #fff1ea;
  color: var(--tomato-deep);
  font-weight: 800;
}

.dd-board-table tr.is-me {
  background: #fff6f2;
  font-weight: 800;
}

.dd-board-empty,
.dd-board-error {
  padding: 1.2rem 0.6rem;
  color: var(--ink-soft);
}

.dd-board-login {
  margin: 0.9rem 0 0;
  font-weight: 700;
}

.dd-board-login a {
  color: var(--sky);
}

.dd-board-actions {
  margin-top: 0.9rem;
}

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

.site-footer a {
  color: var(--tomato);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  z-index: 80;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .cards,
  .sim-grid,
  .sliders {
    grid-template-columns: 1fr;
  }

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

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

  .star-summary {
    display: none;
  }

  .hero h1 {
    font-size: 1.28rem;
  }

  .cheat-table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .game-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .game-tools-main,
  .game-primary {
    width: 100%;
  }

  .game-end-btn,
  #game-end-btn {
    width: 100%;
  }

  .header-tools .label-full {
    display: none;
  }

  .ld-cell {
    font-size: 1.15rem;
    min-width: 1.45rem;
  }

  .stage-chip {
    min-width: 4.4rem;
  }
}
