@font-face {
  font-family: "Marcellus";
  src: url("../assets/fonts/marcellus-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Noto Serif SC";
  src: url("../assets/fonts/noto-serif-sc-subset.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #030907;
  --abyss: #071512;
  --jade-900: #0a1b17;
  --jade-800: #0e2620;
  --jade-700: #14332b;
  --gold: #d8b56b;
  --gold-bright: #f3e3b6;
  --gold-soft: rgba(216, 181, 107, 0.35);
  --gold-line: rgba(216, 181, 107, 0.18);
  --bone: #ece5d5;
  --mist: #96a79d;
  --mist-dim: #7b8c82;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --latin: "Marcellus", "Times New Roman", serif;
  --sans: "HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.75, 0.2, 1);
  --chip: clamp(32px, 13vw, 60px);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

::selection {
  background: var(--gold);
  color: #071512;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.page {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(118% 82% at 50% -12%, #15382f 0%, #0a1e19 34%, #05100d 64%, #030907 100%);
}

.page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)'/%3E%3C/svg%3E");
}

.aura {
  position: absolute;
  left: 50%;
  top: -22%;
  width: 130%;
  height: 72%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 52% at 50% 50%, rgba(61, 127, 105, 0.24), transparent 72%),
    radial-gradient(70% 60% at 50% 42%, rgba(216, 181, 107, 0.05), transparent 70%);
  filter: blur(14px);
}

.app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 880px;
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: calc(13px + env(safe-area-inset-top)) 20px 4px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--gold);
  min-width: 0;
}

.tagline {
  margin: 0 0 0 34px;
  font-size: 10.5px;
  line-height: 1.45;
  letter-spacing: 0.16em;
  color: var(--mist);
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.app:not([data-state="idle"]) .tagline {
  opacity: 0;
}

.brand-mark {
  width: 23px;
  height: 23px;
  flex: none;
  filter: drop-shadow(0 0 9px rgba(216, 181, 107, 0.18));
}

.brand h1 {
  margin: 0;
  margin-right: -0.26em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.26em;
  color: var(--bone);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex: none;
  margin-top: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 181, 107, 0.16);
  background: rgba(8, 24, 19, 0.35);
  color: var(--mist);
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  color: var(--gold-bright);
  border-color: rgba(216, 181, 107, 0.42);
  background: rgba(22, 52, 44, 0.55);
}

.icon-btn:active {
  transform: scale(0.96);
}

.snd-mute {
  display: none;
}

#soundBtn[data-muted="true"] .snd-wave {
  display: none;
}

#soundBtn[data-muted="true"] .snd-mute {
  display: inline;
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

#table {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.34s ease, filter 0.34s ease;
}

.app:not([data-state="idle"]) #table {
  cursor: default;
}

.stage.is-split #table {
  opacity: 0;
  filter: blur(2px);
  pointer-events: none;
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(118% 88% at 50% 4%, transparent 55%, rgba(2, 7, 5, 0.42) 100%);
}


/* ---------- result view ---------- */

.result-view {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  transition: opacity 0.19s ease;
}

.result-view[hidden] {
  display: none;
}

.result-view.is-leaving {
  opacity: 0;
}

.result-head {
  position: relative;
  flex: none;
  padding: 15px 20px 16px;
  text-align: center;
  animation: headIn 0.55s var(--ease) both;
}


.result-head .status,
.result-head .summary {
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

@keyframes headIn {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.status {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.15em;
  color: var(--gold);
}

.status-gem {
  width: 5px;
  height: 5px;
  flex: none;
  transform: rotate(45deg);
  background: var(--gold);
  box-shadow: 0 0 9px rgba(216, 181, 107, 0.7);
}

.summary {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(15px, 4.2vw, 18px);
  line-height: 1.4;
  letter-spacing: 0.07em;
  color: var(--bone);
}

.summary .num {
  display: inline-block;
  margin: 0 0.04em;
  font-family: var(--latin);
  font-weight: 400;
  font-size: 1.3em;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  transform: translateY(0.03em);
}

.columns {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  border-top: 1px solid rgba(216, 181, 107, 0.2);
  border-bottom: 1px solid rgba(216, 181, 107, 0.08);
  opacity: 0;
  transition: opacity 0.32s ease;
}

.columns[hidden] {
  display: none;
}

.stage.is-split .columns {
  opacity: 1;
}

.col {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(216, 181, 107, 0.11);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  transition-delay: calc(var(--i) * 55ms);
}

.col:last-child {
  border-right: 0;
}

.col::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.018);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%);
  opacity: 0.62;
}

.col::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 0;
  height: 1px;
  background: rgba(216, 181, 107, 0.18);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 65%, transparent), transparent);
  opacity: 0.7;
}

.stage.is-split .col {
  opacity: 1;
}

.col-head {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 16px 0 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.col-num {
  font-family: var(--latin);
  font-size: clamp(30px, 8.4vw, 46px);
  line-height: 0.9;
  color: var(--accent);
  font-variant-numeric: lining-nums;
  text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

.col-rule {
  width: 15px;
  height: 1px;
  background: var(--accent);
  opacity: 0.45;
}

.col-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  padding: 12px 2px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2.4vw, 12px);
  overflow: hidden;
}

.col-ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.07;
}

.col-ghost svg {
  width: 56%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 12px rgba(246, 239, 221, 0.4));
}


.col-foot {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 9px 0 15px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  font-family: var(--latin);
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--bone);
}

.col-foot .unit {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--mist-dim);
}

.col.is-empty .col-foot {
  color: var(--mist-dim);
}

.col-count {
  display: inline-block;
}

.col-count.bump {
  animation: countPop 0.34s var(--ease);
}

@keyframes countPop {
  0% {
    opacity: 0.15;
    transform: translateY(3px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* ---------- dice chips ---------- */

.chip {
  position: relative;
  width: var(--chip);
  height: var(--chip);
  flex: none;
  border-radius: 26%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(234, 208, 152, 0.42);
  background: var(--face-dark);
  background:
    radial-gradient(120% 105% at 28% 16%, color-mix(in srgb, var(--face-light) 84%, #fff 16%) 0%, var(--face-light) 27%, var(--face-dark) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 225, 0.28),
    inset 0 -7px 11px rgba(0, 0, 0, 0.26),
    0 4px 12px -4px rgba(0, 0, 0, 0.55);
}

.chip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 36%, transparent 68%, rgba(0, 0, 0, 0.17) 100%);
}

.chip svg {
  position: relative;
  z-index: 1;
  width: 76%;
  height: 76%;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}

.chip.is-pending {
  opacity: 0;
}

.chip.is-landed {
  animation: chipIn 0.36s var(--ease);
}

@keyframes chipIn {
  0% {
    opacity: 0.5;
    transform: scale(0.9);
  }
  62% {
    opacity: 1;
    transform: scale(1.035);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- flyers ---------- */

.flyer-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  overflow: hidden;
}

.chip.flyer {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform, opacity;
  filter: drop-shadow(0 15px 18px rgba(0, 0, 0, 0.48));
  filter:
    drop-shadow(0 15px 18px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 10px color-mix(in srgb, var(--face-light) 28%, transparent));
}

/* ---------- deck ---------- */

.deck {
  position: relative;
  z-index: 5;
  display: grid;
  min-height: 172px;
  padding: 4px 22px calc(16px + env(safe-area-inset-bottom));
}

.panel {
  grid-area: 1 / 1;
  align-self: center;
  justify-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.26s var(--ease),
    transform 0.26s var(--ease),
    visibility 0s linear 0.26s;
}

.panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.34s var(--ease),
    transform 0.34s var(--ease),
    visibility 0s;
}

.setup-panel {
  gap: 10px;
}

.count-row {
  display: flex;
  align-items: center;
  gap: 15px;
}

.count-label {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--mist);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(216, 181, 107, 0.14);
  background: rgba(6, 20, 16, 0.35);
}

.step-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--bone);
  font-family: var(--latin);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.step-btn:hover {
  background: rgba(216, 181, 107, 0.12);
  color: var(--gold-bright);
}

.step-btn:active {
  background: rgba(216, 181, 107, 0.18);
}

.step-btn:disabled {
  opacity: 0.26;
  cursor: default;
  background: transparent;
}

.count-value {
  width: 40px;
  text-align: center;
  font-family: var(--latin);
  font-size: 21px;
  line-height: 1;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

.roll-seal {
  position: relative;
  width: 74px;
  height: 74px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(216, 181, 107, 0.48);
  background:
    radial-gradient(72% 72% at 36% 28%, rgba(66, 122, 102, 0.5), rgba(9, 28, 23, 0.93) 70%);
  color: var(--gold-bright);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -12px 22px rgba(0, 0, 0, 0.44),
    0 16px 34px -16px rgba(0, 0, 0, 0.9);
  transition: transform 0.22s var(--ease), box-shadow 0.3s, border-color 0.3s, color 0.3s;
}

.roll-seal::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid rgba(216, 181, 107, 0.24);
  pointer-events: none;
}

.roll-seal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(62% 42% at 50% 0%, rgba(255, 240, 200, 0.14), transparent 62%);
  pointer-events: none;
}

.roll-seal:hover {
  border-color: rgba(216, 181, 107, 0.82);
  color: #fff3cf;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -12px 22px rgba(0, 0, 0, 0.4),
    0 16px 34px -16px rgba(0, 0, 0, 0.9),
    0 0 30px -4px rgba(216, 181, 107, 0.32);
}

.roll-seal:active {
  transform: scale(0.962);
}

.roll-seal:focus-visible {
  outline-offset: 5px;
}

.seal-char {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 27px;
  line-height: 1;
  transform: translateY(1px);
}

.hint {
  margin: 0;
  min-height: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--mist-dim);
}

.link-btn {
  margin: -5px -3px;
  padding: 5px 3px 4px;
  border: 0;
  border-bottom: 1px solid rgba(216, 181, 107, 0.38);
  background: none;
  color: var(--gold);
  font: inherit;
  letter-spacing: inherit;
  line-height: 1.4;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

.rolling-panel {
  gap: 12px;
}

.rolling-title {
  margin: 0;
  padding-left: 0.3em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.3em;
  color: var(--gold-bright);
  text-align: center;
}

.rolling-rule {
  position: relative;
  display: block;
  width: 64px;
  height: 1px;
  overflow: hidden;
  background: rgba(216, 181, 107, 0.15);
}

.rolling-rule::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: sweep 1.6s ease-in-out infinite;
}

@keyframes sweep {
  0% {
    transform: translateX(-26px);
  }
  100% {
    transform: translateX(66px);
  }
}

.rolling-sub {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--mist-dim);
}

.result-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 430px;
}

.btn {
  height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14.5px;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.3s, transform 0.2s;
}

.btn-primary {
  flex: 1.55;
  border: 1px solid rgba(216, 181, 107, 0.5);
  background: linear-gradient(180deg, rgba(40, 82, 69, 0.74), rgba(10, 30, 25, 0.93));
  color: var(--gold-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 225, 0.12),
    inset 0 -10px 18px rgba(0, 0, 0, 0.24),
    0 12px 28px -16px rgba(0, 0, 0, 0.9);
}

.btn-primary:hover {
  color: #fff4d2;
  border-color: rgba(216, 181, 107, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 225, 0.14),
    inset 0 -10px 18px rgba(0, 0, 0, 0.2),
    0 12px 28px -16px rgba(0, 0, 0, 0.9),
    0 0 26px -6px rgba(216, 181, 107, 0.3);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.995);
}

.btn-ghost {
  flex: 1;
  border: 1px solid rgba(216, 181, 107, 0.18);
  background: rgba(255, 255, 255, 0.014);
  color: var(--mist);
}

.btn-ghost:hover {
  color: var(--bone);
  border-color: rgba(216, 181, 107, 0.36);
  background: rgba(216, 181, 107, 0.05);
}

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

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(86vw, 420px);
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(216, 181, 107, 0.3);
  background: rgba(8, 24, 20, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--bone);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0s linear 0.28s;
  pointer-events: none;
}

.toast.is-on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0s;
}

/* ---------- install sheet ---------- */

.sheet {
  width: min(90vw, 382px);
  padding: 20px 24px 22px;
  border: 1px solid rgba(216, 181, 107, 0.26);
  border-radius: 20px;
  background: linear-gradient(168deg, #0f2b23, #061411 72%);
  color: var(--bone);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.92);
}

.sheet::backdrop {
  background: rgba(2, 8, 6, 0.7);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.sheet h2 {
  margin: 2px 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  text-align: center;
}

.sheet p {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--mist);
  text-align: center;
}

.sheet-top {
  display: flex;
  justify-content: flex-end;
  margin: -6px -8px 0 0;
}

.sheet-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mist-dim);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.sheet-close:hover {
  color: var(--bone);
}

.sheet-actions {
  display: flex;
}

.sheet-actions .btn {
  width: 100%;
  flex: none;
}

/* ---------- utilities ---------- */

[hidden] {
  display: none !important;
}

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

.noscript-note {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 24px;
  z-index: 200;
  padding: 13px;
  border: 1px solid var(--gold-soft);
  background: #0a1a16;
  color: var(--bone);
  text-align: center;
  font-size: 13px;
}

/* ---------- responsive ---------- */

@media (min-width: 760px) {
  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .roll-seal {
    width: 84px;
    height: 84px;
  }

  .seal-char {
    font-size: 30px;
  }

  .step-btn {
    width: 40px;
    height: 40px;
  }

  .count-value {
    font-size: 23px;
  }

  .topbar {
    padding: calc(18px + env(safe-area-inset-top)) 30px 6px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .deck {
    min-height: 184px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  .result-head {
    padding-top: 12px;
    padding-bottom: 18px;
  }

  .result-actions {
    max-width: 460px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .topbar {
    padding: calc(6px + env(safe-area-inset-top)) 18px 0;
  }

  .tagline {
    display: none;
  }

  .brand-mark {
    width: 19px;
    height: 19px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .deck {
    min-height: 96px;
    padding: 0 18px calc(7px + env(safe-area-inset-bottom));
  }

  .setup-panel {
    flex-direction: row;
    gap: 22px;
  }

  .count-row {
    flex-direction: column;
    gap: 5px;
  }

  .count-label {
    font-size: 10px;
  }

  .roll-seal {
    width: 58px;
    height: 58px;
  }

  .seal-char {
    font-size: 22px;
  }

  .hint {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  .result-actions {
    max-width: 340px;
  }

  .col-head {
    padding: 8px 0 6px;
    gap: 5px;
  }

  .col-num {
    font-size: clamp(22px, 4.6vw, 30px);
  }

  .col-body {
    padding: 6px 2px;
    gap: 3px;
  }

  .col-foot {
    padding: 4px 0 8px;
    font-size: 11px;
  }

  .result-head {
    padding: 2px 16px 8px;
  }

  .result-head::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -6px;
    bottom: -22px;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(4, 11, 9, 0.94) 0%, rgba(4, 11, 9, 0.72) 52%, rgba(4, 11, 9, 0) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .app[data-state="landed"] .result-head::before {
    opacity: 1;
  }

  .summary {
    margin-top: 5px;
    font-size: 14px;
  }

  .status {
    font-size: 10px;
  }

  .btn {
    height: 44px;
  }

  .result-actions {
    max-width: 360px;
  }
}

@media (max-width: 350px) {
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .deck {
    padding-left: 16px;
    padding-right: 16px;
  }

  .count-row {
    gap: 10px;
  }

  .roll-seal {
    width: 66px;
    height: 66px;
  }

  .seal-char {
    font-size: 24px;
  }

  .btn {
    padding: 0 14px;
    font-size: 13.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .rolling-rule::after {
    animation: none;
    transform: translateX(20px);
  }
}
