/* 由IRATA开发 */
@font-face {
  font-family: "ZCOOL QingKe HuangYou";
  src: url("./fonts/zcool-qingke-huangyou.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Bebas Neue";
  src: url("./fonts/bebas-neue.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC";
  src: url("./fonts/noto-sans-sc-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC";
  src: url("./fonts/noto-sans-sc-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

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

@font-face {
  font-family: "Noto Sans SC";
  src: url("./fonts/noto-sans-sc-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font-body: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-display-zh: "ZCOOL QingKe HuangYou", "Noto Sans SC", sans-serif;
  --font-display-en: "Bebas Neue", "Arial Narrow", sans-serif;
  --bg: #090806;
  --panel: rgba(20, 17, 13, 0.94);
  --panel-deep: rgba(10, 9, 7, 0.96);
  --metal: #2b261e;
  --metal-light: #443a2b;
  --line: #6e5d43;
  --line-soft: rgba(151, 126, 87, 0.28);
  --text: #e8dfcc;
  --muted: #a79a83;
  --red: #c63b32;
  --red-dark: #70201d;
  --blue: #477a97;
  --blue-dark: #24475e;
  --amber: #c2a467;
  --green: #8caa77;
  --shadow: rgba(0, 0, 0, 0.55);
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(129, 83, 45, 0.22), transparent 42%),
    linear-gradient(180deg, #100d09 0%, #070605 100%);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

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

.icon-button,
.primary-button,
.fire-button,
.item-button,
.modal-choice,
.position-button,
.modal-action,
.donation-close {
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.background,
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.background {
  z-index: -3;
  background-image:
    linear-gradient(rgba(7, 6, 5, 0.72), rgba(7, 6, 5, 0.9)),
    url("./assets/table-bg.jpg");
  background-position: center;
  background-size: cover;
  filter: saturate(0.72) contrast(1.08);
  transform: scale(1.02);
  animation: background-drift 18s ease-in-out infinite alternate;
}

.scanlines {
  z-index: 20;
  opacity: 0.12;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.5) 3px,
    transparent 4px
  );
  mix-blend-mode: multiply;
  animation: scanline-drift 0.8s steps(2, end) infinite;
}

.app-shell {
  width: min(100%, 540px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.view {
  animation: view-in 220ms ease-out;
}

.view[hidden] {
  display: none;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 2px 22px;
}

.language-switcher {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  margin-left: auto;
}

.language-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid #4b4132;
  border-radius: 3px;
  background: linear-gradient(#2c261e, #17130f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0.58;
  transition: border-color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.language-button svg {
  display: block;
  width: 24px;
  height: 16px;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.language-button:hover,
.language-button[aria-pressed="true"] {
  border-color: var(--amber);
  opacity: 1;
}

.language-button:active {
  transform: translateY(1px);
}

html[lang="en"] .brand {
  gap: 10px;
}

html[lang="en"] .brand h1 {
  font-family: var(--font-display-en);
  font-size: clamp(26px, 7vw, 38px);
  letter-spacing: 0.045em;
}

html[lang="en"] .tracker-header h1 {
  font-family: var(--font-display-en);
  font-size: 28px;
  letter-spacing: 0.045em;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 52px;
  height: 58px;
  flex: 0 0 52px;
}

.brand-shell {
  position: absolute;
  width: 18px;
  height: 43px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px 5px 3px 3px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.22), 0 5px 12px var(--shadow);
  transform: rotate(-12deg);
}

.brand-shell::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 9px;
  border-radius: 1px;
  background: linear-gradient(#d0b26d, #74562c);
}

.brand-shell.live {
  top: 2px;
  left: 8px;
  background: linear-gradient(90deg, #7c201d, #d14a3e 48%, #791d1a);
  animation: shell-float 3.8s ease-in-out infinite;
}

.brand-shell.blank {
  right: 6px;
  bottom: 0;
  background: linear-gradient(90deg, #234258, #5687a3 48%, #234258);
  transform: rotate(13deg);
  animation: shell-float 4.4s ease-in-out 0.6s infinite;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--amber);
  font-family: var(--font-display-en);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.2em;
  line-height: 1.2;
  text-shadow: 0 1px 0 #000;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: var(--font-display-zh);
  font-size: clamp(30px, 8.5vw, 42px);
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(194, 164, 103, 0.16);
}

h2 {
  margin-bottom: 0;
  font-family: var(--font-display-zh);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 0 #000;
}

html[lang="en"] h1,
html[lang="en"] h2 {
  font-family: var(--font-display-en);
  letter-spacing: 0.055em;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 38%),
    var(--panel);
  box-shadow:
    0 16px 32px var(--shadow),
    inset 0 0 0 1px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9b8864, #332b20 70%);
  box-shadow: 0 1px 2px #000;
}

.panel::before {
  top: 7px;
  left: 7px;
}

.panel::after {
  right: 7px;
  bottom: 7px;
}

.setup-panel {
  padding: 22px 16px 16px;
  animation: panel-in 420ms 60ms ease-out both;
}

#tracker-view .panel {
  animation: panel-in 460ms ease-out both;
}

#tracker-view .panel:nth-of-type(1) {
  animation-delay: 40ms;
}

#tracker-view .panel:nth-of-type(2) {
  animation-delay: 100ms;
}

#tracker-view .panel:nth-of-type(3) {
  animation-delay: 160ms;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.panel-heading.compact {
  align-items: center;
  margin-bottom: 16px;
}

.limit-badge,
.remaining-label {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.remaining-label {
  max-width: 150px;
  line-height: 1.45;
  text-align: right;
  white-space: pre-line;
}

.count-block + .count-block {
  margin-top: 20px;
}

.count-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.count-label strong {
  margin-left: auto;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.type-dot.live {
  color: var(--red);
  background: var(--red);
}

.type-dot.blank {
  color: var(--blue);
  background: var(--blue);
}

.count-options {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.count-button {
  position: relative;
  min-width: 0;
  height: 50px;
  padding: 4px 0 3px;
  border: 1px solid #4b4132;
  border-radius: 3px;
  color: #c9bda7;
  background: linear-gradient(#2c261e, #17130f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 3px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, transform 120ms ease, background 120ms ease;
}

.count-button::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: #5b4e39;
}

.count-button.live.selected {
  border-color: #d75547;
  color: #fff0e8;
  background: linear-gradient(#8e2c26, #461714);
  box-shadow: inset 0 0 12px rgba(229, 72, 57, 0.2), 0 0 10px rgba(198, 59, 50, 0.14);
  animation: select-pop 180ms ease-out;
}

.count-button.blank.selected {
  border-color: #6b9db8;
  color: #e8f5ff;
  background: linear-gradient(#315f7a, #182e3d);
  box-shadow: inset 0 0 12px rgba(71, 122, 151, 0.22), 0 0 10px rgba(71, 122, 151, 0.12);
  animation: select-pop 180ms ease-out;
}

.count-button:active {
  transform: translateY(1px);
}

.count-button:disabled {
  color: #5f574b;
  border-color: #302a22;
  background: #14110e;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.52;
}

.load-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

.load-summary strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 54px;
  margin-top: 16px;
  padding: 0 18px;
  border: 1px solid #a68b58;
  border-radius: 3px;
  color: #17120b;
  background: linear-gradient(#d2b579, #9a7c45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 5px 12px rgba(0, 0, 0, 0.42);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.primary-button:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.28);
}

.primary-button:disabled {
  border-color: #4b4335;
  color: #746b5c;
  background: linear-gradient(#302a21, #1b1712);
  box-shadow: none;
  cursor: not-allowed;
}

.footer-note {
  margin: 16px 0 0;
  color: #756c5d;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
}

.credit {
  margin: 18px 2px 0;
  color: #625a4c;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: right;
}

.tracker-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 18px;
}

.tracker-header h1 {
  font-size: 27px;
}

.round-block {
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-actions .icon-button {
  min-width: 48px;
  padding: 0 8px;
}

.social-button {
  min-width: 34px !important;
  width: 34px;
  padding: 0 !important;
}

.social-button svg {
  width: 18px;
  height: 18px;
}

.social-button.github {
  color: #e8dfcc;
}

.social-button.github svg {
  fill: currentColor;
  stroke: none;
}

.social-button.alipay {
  color: #1677ff;
}

.social-button.wechat {
  color: #07c160;
}

.social-button.alipay svg,
.social-button.wechat svg {
  stroke: none;
}

.social-button.wechat svg {
  fill: currentColor;
}

.social-button[aria-expanded="true"] {
  border-color: var(--amber);
  background: linear-gradient(#3a3022, #1d1710);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 58px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #554733;
  border-radius: 3px;
  color: #c8bca6;
  background: linear-gradient(#2c261e, #15120e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 3px 8px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  cursor: pointer;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.next {
  border-color: #7b6747;
  color: #e2cd9f;
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.donation-popover {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  right: 0;
  width: min(240px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid #8a734e;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 40%),
    #17130e;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.62), inset 0 0 0 1px rgba(0, 0, 0, 0.65);
  transform-origin: top right;
  animation: popover-in 180ms ease-out;
}

.donation-popover[hidden] {
  display: none;
}

.donation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.donation-heading strong {
  font-size: 14px;
  letter-spacing: 0.06em;
}

.donation-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #554733;
  border-radius: 3px;
  color: var(--muted);
  background: #211b14;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.donation-qr {
  display: grid;
  place-items: center;
  width: min(180px, 100%);
  aspect-ratio: 1;
  margin: 12px auto 8px;
  overflow: hidden;
  border: 1px solid #6e5d43;
  border-radius: 3px;
  background: #f4f0e6;
}

.donation-qr img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: qr-in 220ms ease-out;
}

.donation-qr img[hidden] {
  display: none;
}

.donation-qr-placeholder {
  color: #6b6252;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.donation-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.probability-panel,
.chamber-panel,
.items-panel {
  padding: 17px 15px 15px;
}

.probability-panel + .chamber-panel,
.chamber-panel + .items-panel {
  margin-top: 12px;
}

.probability-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.probability-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
}

.probability-value span {
  color: var(--muted);
  font-size: 12px;
}

.probability-value strong {
  font-family: var(--font-display-en);
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.025em;
  text-shadow: 0 3px 0 #000;
}

.probability-value.live strong {
  color: #ef6a58;
  text-shadow: 0 0 12px rgba(198, 59, 50, 0.3);
}

.probability-value.blank strong {
  color: #79a9c4;
  text-shadow: 0 0 12px rgba(71, 122, 151, 0.28);
}

.probability-bar {
  display: flex;
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #3d3427;
  border-radius: 2px;
  background: #0b0907;
}

.probability-bar span {
  display: block;
  height: 100%;
  transition: width 180ms ease;
}

.probability-bar .live {
  background: linear-gradient(90deg, #71211d, #c7473b);
}

.probability-bar .blank {
  background: linear-gradient(90deg, #2e5d77, #5688a4);
}

.status-text {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.slots {
  display: grid;
  grid-template-columns: repeat(var(--slot-count, 8), minmax(0, 42px));
  justify-content: center;
  gap: clamp(4px, 1.4vw, 7px);
  min-height: 64px;
  margin: 4px 0 16px;
}

.slot {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 42px;
  aspect-ratio: 1;
  border: 2px solid #564a37;
  border-radius: 50%;
  color: #887b65;
  background:
    radial-gradient(circle at 50% 42%, #282219 0%, #15120e 58%, #0b0907 100%);
  box-shadow: inset 0 0 0 2px #0a0907, inset 0 0 9px rgba(0, 0, 0, 0.8), 0 3px 6px rgba(0, 0, 0, 0.42);
  font-family: Georgia, serif;
  font-size: 19px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.slot::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(151, 126, 87, 0.22);
  border-radius: 50%;
}

.slot.current {
  border-color: var(--amber);
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(194, 164, 103, 0.12), 0 0 16px rgba(194, 164, 103, 0.18), inset 0 0 8px #000;
  animation: current-glow 1.8s ease-in-out infinite;
}

.slot.live,
.slot.blank {
  color: transparent;
  border-color: #756448;
  animation: slot-reveal 260ms ease-out;
}

.slot.live {
  background: radial-gradient(circle, #471714 0%, #1c0e0c 70%);
  box-shadow: inset 0 0 12px #000, 0 0 10px rgba(198, 59, 50, 0.12);
}

.slot.blank {
  background: radial-gradient(circle, #193244 0%, #0c151b 70%);
  box-shadow: inset 0 0 12px #000, 0 0 10px rgba(71, 122, 151, 0.1);
}

.slot.current.live,
.slot.current.blank {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(194, 164, 103, 0.12), 0 0 16px rgba(194, 164, 103, 0.18), inset 0 0 8px #000;
  animation: slot-reveal 260ms ease-out, current-glow 1.8s ease-in-out 260ms infinite;
}

.slot .mini-shell {
  position: relative;
  z-index: 1;
  display: block;
  width: 11px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.slot .mini-shell::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 5px;
  background: linear-gradient(#c6a662, #6e512b);
}

.slot.live .mini-shell {
  background: linear-gradient(90deg, #76201c, #cf493d 50%, #76201c);
}

.slot.blank .mini-shell {
  background: linear-gradient(90deg, #24475e, #5688a4 50%, #24475e);
}

.slot.fired {
  opacity: 0.48;
  transform: scale(0.9);
  animation: shell-fired 280ms ease-out;
}

.slot.fired.current {
  transform: scale(0.9);
}

.fire-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.fire-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.fire-button.live {
  border: 1px solid #b44a3e;
  color: #f6d9d0;
  background: linear-gradient(#78251f, #3e1512);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 7px rgba(0, 0, 0, 0.35);
}

.fire-button.blank {
  border: 1px solid #537e97;
  color: #dcecf4;
  background: linear-gradient(#2f586f, #172b38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 7px rgba(0, 0, 0, 0.35);
}

.fire-button:active {
  transform: translateY(1px);
  filter: brightness(1.12);
}

.fire-button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.shell-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 31px;
  flex: 0 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 5px 5px 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
  transform: rotate(9deg);
}

.shell-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: 7px;
  border-radius: 1px;
  background: linear-gradient(#d2b26d, #75552b);
}

.shell-icon.live {
  background: linear-gradient(90deg, #74201c, #d34b3e 52%, #74201c);
}

.shell-icon.blank {
  background: linear-gradient(90deg, #24475e, #5b8da8 52%, #24475e);
}

.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.item-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 76px;
  padding: 10px;
  border: 1px solid #514631;
  border-radius: 3px;
  color: var(--text);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 45%),
    linear-gradient(#282219, #15120e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 3px 8px rgba(0, 0, 0, 0.32);
  text-align: left;
  cursor: pointer;
}

.item-button:active {
  transform: translateY(1px);
  border-color: var(--amber);
}

.item-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.item-icon {
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  fill: none;
  stroke: #bfa777;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.item-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.item-copy strong {
  font-size: 13px;
  letter-spacing: 0.03em;
}

.item-copy small {
  color: var(--muted);
  font-size: 10px;
}

.tracker-message {
  min-height: 18px;
  margin: 13px 2px 0;
  color: #a99a80;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.modal-root {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal-root[hidden] {
  display: none;
}

.modal {
  width: min(100%, 500px);
  padding: 20px 17px 17px;
  border: 1px solid #8a734e;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 40%),
    #17130e;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(0, 0, 0, 0.7);
  animation: modal-in 180ms ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-heading {
  margin-bottom: 16px;
}

.modal-heading h2 {
  font-size: 20px;
}

.modal-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.position-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 18px;
}

.position-button {
  min-width: 0;
  height: 42px;
  border: 1px solid #554936;
  border-radius: 3px;
  color: #d3c6ad;
  background: linear-gradient(#2d261d, #17130f);
  cursor: pointer;
}

.position-button.selected {
  border-color: var(--amber);
  color: #17120b;
  background: linear-gradient(#d0b47a, #95763f);
  font-weight: 800;
  animation: select-pop 180ms ease-out;
}

.modal-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.modal-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  border-radius: 3px;
  font-weight: 700;
  cursor: pointer;
}

.modal-choice.live {
  border: 1px solid #b44a3e;
  color: #f6d9d0;
  background: linear-gradient(#78251f, #3e1512);
}

.modal-choice.blank {
  border: 1px solid #537e97;
  color: #dcecf4;
  background: linear-gradient(#2f586f, #172b38);
}

.modal-choice.selected {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(194, 164, 103, 0.65), inset 0 4px 10px rgba(0, 0, 0, 0.58);
  transform: translateY(1px);
  animation: select-pop 180ms ease-out;
}

.modal-choice.live.selected {
  background: linear-gradient(#4b1915, #28100e);
}

.modal-choice.blank.selected {
  background: linear-gradient(#1c3c4e, #0d1d26);
}

.modal-actions {
  display: flex;
  gap: 9px;
  margin-top: 16px;
}

.modal-action {
  flex: 1;
  min-height: 46px;
  border: 1px solid #5c4c35;
  border-radius: 3px;
  color: #cfc1a6;
  background: linear-gradient(#2d261d, #17130f);
  cursor: pointer;
}

.modal-action.confirm {
  border-color: #a68b58;
  color: #17120b;
  background: linear-gradient(#d2b579, #9a7c45);
  font-weight: 800;
}

.modal-action.danger {
  border-color: #984238;
  color: #f0d0c8;
  background: linear-gradient(#64231d, #351311);
}

.modal-action:active,
.donation-close:active,
.position-button:active {
  transform: translateY(1px);
}

@media (hover: hover) {
  .count-button:not(:disabled):hover {
    border-color: #8a734e;
    color: #f3e8d2;
    transform: translateY(-1px);
  }

  .primary-button:not(:disabled):hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
  }

  .icon-button:not(:disabled):hover,
  .social-button:not(:disabled):hover {
    border-color: var(--amber);
    color: #f0dfb7;
    transform: translateY(-1px);
  }

  .fire-button:not(:disabled):hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
  }

  .item-button:not(:disabled):hover {
    border-color: var(--amber);
    transform: translateY(-2px);
  }

  .modal-choice:not(.selected):hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
  }

  .position-button:hover {
    border-color: var(--amber);
    color: #f3e8d2;
    transform: translateY(-1px);
  }

  .modal-action:hover,
  .donation-close:hover {
    border-color: var(--amber);
    color: #f0dfb7;
    transform: translateY(-1px);
  }
}

@keyframes background-drift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.045) translate3d(-0.6%, 0.6%, 0);
  }
}

@keyframes scanline-drift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 4px;
  }
}

@keyframes shell-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -3px;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes select-pop {
  0% {
    transform: scale(1);
  }
  55% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes qr-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes current-glow {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(194, 164, 103, 0.1), 0 0 10px rgba(194, 164, 103, 0.14), inset 0 0 8px #000;
  }
  50% {
    box-shadow: 0 0 0 2px rgba(194, 164, 103, 0.2), 0 0 22px rgba(194, 164, 103, 0.28), inset 0 0 8px #000;
  }
}

@keyframes slot-reveal {
  from {
    opacity: 0.25;
    transform: scale(0.55);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shell-fired {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.48;
    transform: scale(0.9);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 480px) {
  .app-shell {
    padding-left: 22px;
    padding-right: 22px;
  }

  .setup-panel,
  .probability-panel,
  .chamber-panel,
  .items-panel {
    padding-left: 19px;
    padding-right: 19px;
  }
}

@media (max-height: 720px) {
  .app-shell {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .brand {
    margin-bottom: 14px;
  }

  .setup-panel {
    padding-top: 17px;
  }

  .panel-heading {
    margin-bottom: 16px;
  }

  .count-block + .count-block {
    margin-top: 14px;
  }

  .load-summary {
    margin-top: 18px;
  }
}

@media (max-width: 360px) {
  .tracker-header {
    gap: 8px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions .icon-button {
    min-width: 42px;
    padding: 0 6px;
  }

  .social-button {
    min-width: 30px !important;
    width: 30px;
  }

  html[lang="en"] .tracker-header {
    gap: 6px;
  }

  html[lang="en"] .header-actions {
    gap: 3px;
  }

  html[lang="en"] .header-actions .icon-button {
    min-width: 36px;
    padding: 0 5px;
  }

  html[lang="en"] #next-button span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
