:root {
  color-scheme: light;
  --canvas: #fbf7f1;
  --surface: #fffefc;
  --surface-soft: #fbf4ec;
  --ink: #201d1b;
  --navy: #19213f;
  --brown: #765c49;
  --green: #087c5b;
  --green-deep: #087c5b;
  --gold: #eda40a;
  --gold-line: #e8c999;
  --line: #eee3d5;
  --shadow: 0 6px 18px rgba(102, 75, 48, 0.1);
  --font-ui: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: Montserrat, Avenir Next, Avenir, var(--font-ui);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e9e1d7;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid #087c5b;
  outline-offset: 3px;
}

.stake-field:focus-within {
  border-color: #087c5b;
  outline: 3px solid #087c5b;
  outline-offset: 2px;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
}

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

.app-canvas {
  position: relative;
  width: min(100%, 427px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: clip;
  background-color: var(--canvas);
  background-image: url("./assets/scene-background-v2.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
}

.game-header {
  position: relative;
  height: calc(76px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}

.icon-button,
.balance-add,
.rules-button,
.step-button,
.quick-bet,
.mode-tab,
.primary-action,
.cell,
.dialog-close {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-button {
  position: absolute;
  z-index: 2;
  top: calc(13px + env(safe-area-inset-top));
  left: 12px;
  display: grid;
  width: 44px;
  height: 46px;
  padding: 12px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 16px rgba(93, 75, 54, 0.08);
  backdrop-filter: blur(8px);
}

.menu-button img,
.rules-button img,
.step-button img,
.mode-tab img,
.dialog-close img,
.balance-add img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-lockup {
  position: absolute;
  top: calc(25px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translateX(-50%);
}

.brand-lockup h1 {
  display: inline-block;
  margin: 0;
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  transform: scaleX(0.8);
  transform-origin: center;
}

.brand-sparkle {
  width: 14px;
  height: 18px;
  flex: 0 0 14px;
  object-fit: contain;
  filter: invert(58%) sepia(52%) saturate(753%) hue-rotate(352deg) brightness(89%);
}

.host-balance {
  position: absolute;
  z-index: 2;
  top: calc(16px + env(safe-area-inset-top));
  right: 12px;
  display: grid;
  height: 44px;
  grid-template-columns: max-content max-content max-content;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 4px;
  row-gap: 0;
  padding: 0 0 0 8px;
  border: 1px solid rgba(225, 212, 195, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 4px 12px rgba(93, 75, 54, 0.07);
  backdrop-filter: blur(8px);
}

.balance-number {
  grid-column: 1;
  grid-row: 2;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.demo-balance-label {
  grid-column: 1 / 3;
  grid-row: 1;
  align-self: end;
  color: #684b2d;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.coin {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.coin-small {
  grid-column: 2;
  grid-row: 2;
  width: 23px;
  height: 23px;
}

.balance-add {
  position: relative;
  display: grid;
  grid-column: 3;
  grid-row: 1 / 3;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  background: transparent;
}

.balance-add::before {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #08a65a;
  box-shadow: 0 2px 6px rgba(0, 125, 70, 0.18);
  content: "";
}

.sandbox-badge {
  display: inline-flex;
  min-height: 15px;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  border: 1px solid #c98c37;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.96);
  color: #684214;
  font-family: var(--font-display);
  font-size: 7.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.game-header > .sandbox-badge,
.brand-lockup .sandbox-badge {
  position: absolute;
  z-index: 4;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
}

.game-header > .sandbox-badge {
  top: calc(54px + env(safe-area-inset-top));
}

.sandbox-badge[hidden] {
  display: none;
}

.balance-add img {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  filter: brightness(0) invert(1);
}

.host-popover {
  position: absolute;
  z-index: 12;
  top: calc(62px + env(safe-area-inset-top));
  left: 12px;
  width: 224px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.host-popover strong,
.host-popover span {
  display: block;
}

.host-popover strong {
  color: var(--green);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.host-popover span {
  margin-top: 4px;
  color: var(--brown);
  font-size: 11px;
  line-height: 1.5;
}

.game-main {
  padding: 0 14px calc(16px + env(safe-area-inset-bottom));
}

.status-card {
  display: grid;
  height: 72px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  border: 1px solid rgba(235, 225, 214, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

.status-item {
  display: flex;
  min-width: 0;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.status-item-middle {
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.status-icon {
  width: 31px;
  height: 31px;
  border-radius: 40%;
  object-fit: cover;
}

.gem-icon {
  width: 34px;
  height: 34px;
}

.status-label,
.control-label {
  display: block;
  color: var(--brown);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.status-item strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.multiplier-stat strong {
  color: var(--green);
  font-size: 20px;
}

.game-layout {
  display: block;
}

.board-column {
  min-width: 0;
}

.offer-row {
  display: flex;
  height: 38px;
  margin-top: 8px;
  align-items: center;
  justify-content: flex-end;
  border-bottom: 1px solid rgba(236, 220, 200, 0.55);
}

.offer-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #6f5034;
  font-size: 13px;
}

.offer-copy strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.coin-offer {
  width: 20px;
  height: 20px;
}

.rules-button {
  display: grid;
  width: 60px;
  height: 44px;
  padding: 13px 21px;
  place-items: center;
  border: 1px solid rgba(238, 224, 208, 0.84);
  border-radius: 10px;
  background: rgba(255, 250, 244, 0.91);
  box-shadow: 0 3px 10px rgba(99, 75, 46, 0.06);
}

.rules-button img {
  filter: invert(43%) sepia(24%) saturate(787%) hue-rotate(346deg) brightness(91%);
}

.board {
  display: grid;
  width: calc(100% - 30px);
  margin: 8px 15px 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  perspective: 900px;
}

.cell {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  box-shadow: 0 3px 7px rgba(107, 76, 43, 0.08);
  transform-style: preserve-3d;
  transition: transform 100ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.cell:not(:disabled):active {
  transform: scale(0.965);
}

.cell:not(:disabled):hover {
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(154, 101, 21, 0.24), 0 5px 11px rgba(107, 76, 43, 0.14);
}

.cell-art {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: cover;
}

.cell.is-safe,
.cell.is-mine {
  background-color: #fefaf6;
  background-image: none;
}

.cell.is-safe .cell-art,
.cell.is-mine .cell-art {
  width: 76%;
  height: 76%;
  mix-blend-mode: multiply;
  object-fit: cover;
}

.cell.is-safe .cell-art {
  width: 88%;
  height: 88%;
}

.cell.is-safe {
  border-color: #9dcfa3;
  box-shadow: 0 5px 13px rgba(29, 136, 76, 0.17), inset 0 0 0 2px rgba(65, 164, 93, 0.08);
}

.cell.is-mine {
  border-color: #c89b91;
  box-shadow: 0 5px 13px rgba(117, 40, 36, 0.16), inset 0 0 0 2px rgba(170, 76, 66, 0.08);
}

.cell.is-pending {
  z-index: 1;
  border-color: #9a6515;
  box-shadow: 0 0 0 3px rgba(154, 101, 21, 0.22), 0 5px 12px rgba(107, 76, 43, 0.14);
  animation: pending-ring 700ms ease-in-out infinite alternate;
}

.cell.is-new {
  animation: tile-reveal 440ms cubic-bezier(0.18, 0.78, 0.28, 1.12);
}

.auto-order {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #fff2cf;
  border-radius: 50%;
  background: #08734f;
  color: #fff;
  box-shadow: 0 2px 5px rgba(4, 114, 60, 0.25);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.auto-order[hidden] {
  display: none;
}

.board.is-busted {
  animation: board-shake 220ms ease-out;
}

.board-guidance {
  min-height: 12px;
  margin: 2px 15px 0;
  color: #765c49;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.control-card {
  margin-top: 4px;
  padding: 12px 14px 13px;
  border: 1px solid rgba(235, 225, 214, 0.9);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

.stake-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 56px);
  gap: 6px;
}

.stake-field,
.quick-bet {
  height: 50px;
  border-radius: 9px;
}

.stake-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 6px 9px 5px;
  border: 1px solid #efe4d8;
  background: rgba(255, 255, 255, 0.78);
}

.stake-field > span:first-child {
  color: #473a32;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.stake-input-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.stake-input-line input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.coin-input {
  width: 23px;
  height: 23px;
}

.quick-bet {
  padding: 0 5px;
  background: #faf3ea;
  color: #493629;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  transition: background-color 120ms ease, transform 100ms ease;
}

.quick-bet:not(:disabled):active,
.step-button:not(:disabled):active {
  transform: scale(0.96);
}

.quick-bet:not(:disabled):hover,
.step-button:not(:disabled):hover {
  background-color: #f5eadf;
}

.field-error {
  min-height: 10px;
  margin: 2px 2px 0;
  color: #a3423b;
  font-size: 10px;
  line-height: 1.2;
}

.round-row {
  display: grid;
  min-height: 68px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 10px;
}

.mine-control {
  min-width: 0;
}

.mine-control .control-label {
  margin-bottom: 6px;
}

.mine-stepper {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 4px;
}

.step-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 12px;
  place-items: center;
  border-radius: 10px;
  background: #faf3ea;
}

.step-button img {
  filter: invert(24%) sepia(20%) saturate(696%) hue-rotate(342deg) brightness(91%);
}

.mine-value {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mine-value img {
  width: 28px;
  height: 28px;
  border-radius: 40%;
  object-fit: cover;
}

.mine-value strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.payout-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0e4d8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.payout-card > span {
  font-size: 11px;
}

.payout-card > div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.payout-card strong {
  color: var(--green);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.coin-payout {
  width: 21px;
  height: 21px;
}

.payout-card small {
  color: #9b6725;
  font-size: 9px;
}

.payout-card.is-celebrating strong {
  animation: payout-pop 320ms ease-out;
}

.auto-summary {
  display: grid;
  min-height: 42px;
  margin-top: 6px;
  padding: 6px 9px;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid #e8dfd4;
  border-radius: 10px;
  background: #fbf7f1;
}

.auto-summary[hidden] {
  display: none;
}

.auto-summary > span {
  color: var(--brown);
  font-size: 11px;
  font-weight: 600;
}

.auto-summary > strong {
  color: var(--green);
  font-size: 13px;
}

.auto-summary small {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: #6f5e50;
  font-size: 10px;
}

.locked-note,
.plan-retention {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.locked-note {
  border: 1px solid #b86e64;
  background: #fff3f0;
  color: #702d29;
}

.plan-retention {
  border: 1px solid #d9c29d;
  background: #fff8ec;
  color: #65491f;
}

.locked-note[hidden],
.plan-retention[hidden] {
  display: none;
}

.primary-action {
  position: relative;
  display: grid;
  width: 100%;
  height: 64px;
  margin-top: 8px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid #f0b444;
  border-radius: 13px;
  background: linear-gradient(180deg, #32a47b 0%, #0f7b5a 100%);
  box-shadow: 0 7px 14px rgba(75, 101, 66, 0.16);
  color: #fff;
  isolation: isolate;
}

.primary-art {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-style: solid;
  border-width: 30px 54px;
  border-color: transparent;
  border-image-source: url("./assets/action-button-overlay-v2.png");
  border-image-slice: 260 520 260 520;
  border-image-width: 30px 54px;
  border-image-repeat: stretch;
  background: none;
  opacity: 0.9;
}

.primary-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: min(88%, 330px);
  padding: 4px 16px;
  border-radius: 10px;
  background: transparent;
  text-shadow: 0 1px 2px rgba(0, 58, 42, 0.18);
}

.primary-copy strong {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
}

.primary-copy small {
  margin-top: 2px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

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

.primary-action:disabled {
  border-color: #9eaaa1;
  background: linear-gradient(180deg, #708f84 0%, #526f65 100%);
  box-shadow: none;
  opacity: 1;
}

.primary-action:disabled .primary-art {
  opacity: 0.32;
}

.mode-switch {
  display: grid;
  height: 50px;
  margin-top: 8px;
  padding: 2px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #efe5d9;
  border-radius: 22px;
  background: rgba(252, 248, 244, 0.82);
}

.mode-tab {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 19px;
  background: transparent;
  color: #34302d;
  font-size: 14px;
  font-weight: 600;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.mode-tab img {
  width: 22px;
  height: 22px;
  filter: invert(20%) sepia(3%) saturate(746%) hue-rotate(339deg) brightness(92%);
}

.mode-tab.is-active {
  background: #fff;
  color: var(--green-deep);
  box-shadow: 0 2px 8px rgba(94, 72, 46, 0.08);
}

.mode-tab.is-active img {
  filter: invert(43%) sepia(70%) saturate(1044%) hue-rotate(109deg) brightness(87%);
}

.mode-tab:disabled {
  color: #6f665e;
  opacity: 1;
}

.mode-tab.is-active:disabled {
  color: #356b58;
  background: #f2f5f2;
}

.quick-bet:disabled,
.step-button:disabled {
  background: #eee8e0;
  color: #6f665e;
  opacity: 1;
}

.quick-bet:disabled img,
.step-button:disabled img {
  opacity: 0.58;
}

.stake-field:has(input:disabled) {
  border-color: #ded6cc;
  background: #f1ece6;
}

.stake-input-line input:disabled {
  color: #5f5750;
  -webkit-text-fill-color: #5f5750;
  opacity: 1;
}

.app-canvas[data-pending="true"] .primary-action,
.app-canvas.is-pending .primary-action {
  border-color: #9eaaa1;
  background: linear-gradient(180deg, #708f84 0%, #526f65 100%);
  box-shadow: none;
}

.app-canvas[data-pending="true"] .board-guidance,
.app-canvas.is-pending .board-guidance {
  color: #65491f;
  font-weight: 700;
}

.app-canvas[data-phase="BUSTED"] .multiplier-stat strong,
.app-canvas.is-busted .multiplier-stat strong {
  color: #6f6258;
  opacity: 0.78;
}

.app-canvas[data-phase="BUSTED"] .payout-card,
.app-canvas.is-busted .payout-card {
  border-color: #c98e86;
  background: #fff3f0;
}

.app-canvas[data-phase="CASHED_OUT"] .payout-card,
.app-canvas.is-cashed-out .payout-card {
  border-color: #7eb99c;
  background: #eff9f3;
}

.app-canvas[data-phase="BUSTED"] .payout-card strong,
.app-canvas.is-busted .payout-card strong {
  color: #7a3530;
}

.app-canvas.is-locked .control-card,
.app-canvas[data-locked="true"] .control-card {
  border-color: #b86e64;
  box-shadow: 0 0 0 3px rgba(184, 110, 100, 0.12), var(--shadow);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  border: 1px solid rgba(240, 224, 202, 0.9);
  border-radius: 18px;
  background: rgba(35, 31, 28, 0.92);
  box-shadow: 0 8px 24px rgba(40, 32, 24, 0.2);
  color: #fff;
  font-size: 12px;
  text-align: center;
  transform: translateX(50%);
}

.persistent-error {
  position: fixed;
  z-index: 31;
  right: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: min(399px, calc(100% - 28px));
  padding: 11px 14px;
  border: 1px solid #b86e64;
  border-radius: 14px;
  background: rgba(255, 243, 240, 0.98);
  box-shadow: 0 8px 24px rgba(77, 34, 30, 0.18);
  color: #702d29;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  transform: translateX(50%);
}

.persistent-error[hidden] {
  display: none;
}

.rules-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid #eadfce;
  border-radius: 20px;
  background: #fffdf9;
  box-shadow: 0 22px 60px rgba(61, 46, 32, 0.25);
  color: var(--ink);
}

.rules-dialog::backdrop {
  background: rgba(39, 31, 25, 0.42);
  backdrop-filter: blur(3px);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  padding: 11px;
  border-radius: 50%;
  background: #f8f1e8;
  transform: rotate(45deg);
}

.rules-dialog .eyebrow {
  margin: 0;
  color: var(--green);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rules-dialog h2 {
  margin: 7px 0 18px;
  color: var(--navy);
  font-size: 24px;
}

.rules-dialog dl {
  margin: 0;
}

.rules-dialog dl > div {
  display: grid;
  padding: 9px 0;
  grid-template-columns: 88px 1fr;
  border-bottom: 1px solid #eee5da;
}

.rules-dialog dt {
  color: var(--brown);
  font-weight: 600;
}

.rules-dialog dd {
  margin: 0;
  text-align: right;
}

.formula {
  margin: 18px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #f8f3ec;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  text-align: center;
}

.dialog-note {
  margin: 14px 0 0;
  color: #74685d;
  font-size: 12px;
  line-height: 1.65;
}

@keyframes pending-ring {
  from {
    border-color: #9a6515;
    box-shadow: 0 3px 7px rgba(107, 76, 43, 0.13), 0 0 0 2px rgba(154, 101, 21, 0.16);
  }
  to {
    border-color: #754809;
    box-shadow: 0 5px 14px rgba(117, 72, 9, 0.22), 0 0 0 4px rgba(154, 101, 21, 0.2);
  }
}

@keyframes tile-reveal {
  0% {
    transform: rotateY(0deg) scale(1);
  }
  45% {
    transform: rotateY(82deg) scale(0.94);
  }
  70% {
    transform: rotateY(8deg) scale(1.045);
  }
  100% {
    transform: rotateY(0deg) scale(1);
  }
}

@keyframes board-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

@keyframes payout-pop {
  0% { transform: scale(0.92); }
  58% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@media (max-width: 479px) {
  .brand-lockup .sandbox-badge {
    transform: translateX(-58%);
  }

  .balance-number {
    font-size: 11px;
  }

  .host-balance {
    column-gap: 3px;
    row-gap: 0;
    padding-left: 6px;
  }

  .coin-small {
    width: 20px;
    height: 20px;
  }

  .balance-add {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 399px) {
  .brand-lockup {
    gap: 1px;
  }

  .brand-lockup h1 {
    font-size: 28px;
  }

  .brand-sparkle {
    width: 6px;
    height: 10px;
    flex-basis: 6px;
  }

  .stake-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
    gap: 6px;
  }

  .quick-bet {
    min-width: 44px;
    padding-right: 3px;
    padding-left: 3px;
    font-size: 14px;
  }
}

@media (max-width: 374px) {
  .brand-lockup {
    left: calc(50% - 2px);
  }

  .brand-lockup h1 {
    font-size: 26px;
  }

  .brand-lockup .sandbox-badge {
    transform: translateX(-61%);
  }

  .balance-number {
    font-size: 10px;
  }

  .host-balance {
    column-gap: 2px;
    row-gap: 0;
    padding-left: 4px;
  }

  .coin-small {
    width: 18px;
    height: 18px;
  }

  .balance-add {
    width: 44px;
    height: 44px;
  }

  .stake-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, 44px);
    gap: 5px;
  }

  .quick-bet {
    font-size: 14px;
  }

  .round-row {
    gap: 6px;
    grid-template-columns: minmax(132px, 1.08fr) minmax(0, 0.92fr);
  }

  .mine-stepper {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .step-button {
    width: 44px;
  }

  .payout-card strong {
    font-size: 19px;
  }
}

@media (max-width: 339px) {
  .balance-number {
    display: none;
  }
}

@media (min-width: 640px) {
  html {
    scrollbar-width: auto;
  }

  html::-webkit-scrollbar {
    width: auto;
    height: auto;
  }
}

@media (min-width: 640px) and (max-width: 979px) {
  .app-canvas {
    width: min(calc(100% - 32px), 720px);
    min-height: calc(100dvh - 24px);
    margin: 12px auto;
    border-radius: 26px;
    box-shadow: 0 20px 70px rgba(67, 48, 30, 0.16);
  }

  .game-main {
    padding-right: 24px;
    padding-bottom: 20px;
    padding-left: 24px;
  }

  .board {
    width: min(calc(100% - 60px), 520px, max(320px, calc(100dvh - 555px)));
    margin-right: auto;
    margin-left: auto;
    gap: 9px;
  }

  .control-card {
    margin-top: 8px;
    padding: 16px;
  }

  .stake-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, 68px);
    gap: 9px;
  }

  .stake-field,
  .quick-bet {
    height: 56px;
  }
}

@media (min-width: 980px) {
  html {
    background: #e8e0d5;
  }

  body {
    padding: 22px;
  }

  .app-canvas {
    width: min(100%, 1180px);
    min-height: calc(100dvh - 44px);
    border: 1px solid rgba(233, 219, 200, 0.88);
    border-radius: 30px;
    background-size: cover;
    box-shadow: 0 24px 80px rgba(70, 50, 31, 0.17);
  }

  .game-header {
    height: 100px;
  }

  .menu-button {
    top: 21px;
    left: 28px;
    width: 56px;
    height: 56px;
    padding: 15px;
  }

  .brand-lockup {
    top: 29px;
    gap: 10px;
  }

  .brand-lockup h1 {
    font-size: 42px;
  }

  .brand-sparkle {
    width: 18px;
    height: 24px;
    flex-basis: 18px;
  }

  .host-balance {
    top: 24px;
    right: 28px;
    height: 50px;
    column-gap: 6px;
    row-gap: 0;
    padding: 2px 3px 2px 14px;
    border-radius: 26px;
  }

  .balance-number {
    font-size: 18px;
  }

  .demo-balance-label {
    font-size: 10px;
  }

  .coin-small,
  .balance-add {
    width: 36px;
    height: 36px;
  }

  .balance-add {
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .balance-add::before {
    width: 32px;
    height: 32px;
  }

  .balance-add img {
    width: 17px;
    height: 17px;
  }

  .game-header > .sandbox-badge {
    top: 74px;
  }

  .host-popover {
    top: 84px;
    left: 28px;
  }

  .game-main {
    padding: 0 36px 36px;
  }

  .status-card {
    height: 112px;
    border-radius: 20px;
  }

  .status-item {
    height: 68px;
    gap: 17px;
  }

  .status-icon {
    width: 51px;
    height: 51px;
  }

  .gem-icon {
    width: 47px;
    height: 47px;
  }

  .status-label {
    font-size: 17px;
  }

  .status-item strong {
    margin-top: 7px;
    font-size: 30px;
  }

  .multiplier-stat strong {
    font-size: 32px;
  }

  .game-layout {
    display: grid;
    margin-top: 20px;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 32px;
    align-items: start;
  }

  .offer-row {
    height: 58px;
    margin-top: 0;
  }

  .offer-copy {
    gap: 13px;
    font-size: 18px;
  }

  .offer-copy strong {
    font-size: 28px;
  }

  .coin-offer {
    width: 29px;
    height: 29px;
  }

  .rules-button {
    width: 60px;
    height: 50px;
    padding: 14px;
    border-radius: 14px;
  }

  .board {
    width: min(100%, max(340px, calc(100dvh - 425px)));
    margin: 18px auto 0;
    gap: 11px;
  }

  .cell {
    border-radius: 14px;
  }

  .board-guidance {
    min-height: 22px;
    margin-top: 9px;
    font-size: 13px;
  }

  .control-card {
    position: sticky;
    top: max(22px, env(safe-area-inset-top));
    margin-top: 0;
    padding: 22px;
    border-radius: 20px;
  }

  .stake-row {
    grid-template-columns: minmax(0, 1fr) repeat(3, 67px);
    gap: 9px;
  }

  .stake-field,
  .quick-bet {
    height: 66px;
    border-radius: 13px;
  }

  .stake-field {
    padding: 8px 12px;
  }

  .stake-field > span:first-child {
    font-size: 13px;
  }

  .stake-input-line input {
    font-size: 20px;
  }

  .quick-bet {
    font-size: 17px;
  }

  .field-error {
    min-height: 18px;
    font-size: 11px;
  }

  .round-row {
    min-height: 102px;
    gap: 14px;
  }

  .mine-control .control-label {
    margin-bottom: 14px;
    font-size: 14px;
  }

  .mine-stepper {
    grid-template-columns: 49px minmax(0, 1fr) 49px;
    gap: 7px;
  }

  .step-button {
    width: 49px;
    height: 52px;
    padding: 14px;
  }

  .mine-value strong {
    font-size: 24px;
  }

  .mine-value img {
    width: 36px;
    height: 36px;
  }

  .payout-card > span {
    font-size: 13px;
  }

  .payout-card strong {
    font-size: 26px;
  }

  .primary-action {
    height: 82px;
    margin-top: 17px;
    border-radius: 17px;
  }

  .primary-copy strong {
    font-size: 25px;
  }

  .primary-copy small {
    font-size: 14px;
  }

  .mode-switch {
    height: 50px;
    margin-top: 20px;
    border-radius: 26px;
  }

  .mode-tab {
    border-radius: 23px;
    font-size: 16px;
  }
}

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