:root {
  --bg: #050504;
  --panel: rgba(17, 17, 15, 0.86);
  --text: #f6efe4;
  --muted: #b7aa94;
  --gold: #d6ad69;
  --hot: #ffd58f;
  --iron-1: #121414;
  --iron-2: #8d8780;
  --bronze-1: #241512;
  --bronze-2: #a86137;
  --brass-1: #272114;
  --brass-2: #d1a552;
  --gold-1: #35220a;
  --gold-2: #f1c15e;
  --metal-accent: var(--gold);
  --metal-glow: rgba(255, 203, 120, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 12%, rgba(239, 200, 136, 0.1), transparent 22rem),
    linear-gradient(180deg, #11100d, var(--bg) 58%, #020202);
}

button,
select,
input {
  font: inherit;
}

body.is-private {
  user-select: none;
}

.auth-screen,
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(214, 173, 105, 0.16), transparent 22rem),
    linear-gradient(180deg, rgba(7, 7, 6, 0.96), #020202);
}

.auth-screen[hidden],
.admin-modal[hidden] {
  display: none;
}

.auth-card,
.admin-card {
  width: min(100%, 430px);
  padding: 24px;
  border: 1px solid rgba(216, 167, 95, 0.28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 42% 0%, rgba(255, 223, 172, 0.11), transparent 13rem),
    rgba(18, 18, 16, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 30px 90px rgba(0, 0, 0, 0.72);
}

.auth-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-card h1,
.admin-card h2 {
  margin: 8px 0 10px;
  font-size: 34px;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card p,
.admin-card p {
  margin: 0 0 18px;
  color: rgba(246, 239, 228, 0.72);
  line-height: 1.55;
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 225, 178, 0.22);
  border-radius: 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.42);
  outline: none;
}

.auth-card input:focus {
  border-color: rgba(255, 213, 143, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 213, 143, 0.12);
}

.auth-card .gold-button,
.auth-card .ghost-button {
  margin-top: 14px;
}

.ghost-button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.auth-card small {
  display: block;
  min-height: 18px;
  margin-top: 12px;
  color: rgba(255, 213, 143, 0.82);
  line-height: 1.4;
}

.app {
  position: relative;
  display: grid;
  width: min(100%, 520px);
  max-width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  overflow-x: clip;
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  gap: 14px;
  isolation: isolate;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 12%),
    radial-gradient(circle at 50% 18%, rgba(255, 220, 166, 0.07), transparent 34%),
    linear-gradient(180deg, rgba(35, 34, 30, 0.72), rgba(9, 10, 9, 0.92));
  border: 1px solid rgba(255, 237, 202, 0.18);
  box-shadow:
    inset 0 0 0 4px rgba(0, 0, 0, 0.45),
    inset 0 0 0 6px rgba(255, 255, 255, 0.04),
    0 34px 100px rgba(0, 0, 0, 0.68);
}

.app.is-locked {
  filter: blur(12px);
  pointer-events: none;
}

.admin-fab {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 13;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(216, 167, 95, 0.4);
  border-radius: 999px;
  color: #161009;
  background: linear-gradient(135deg, #ffe4a8, #c68438);
  font-size: 11px;
  font-weight: 900;
}

.session-button {
  grid-column: 1 / -1;
  width: 100%;
}

.admin-modal {
  z-index: 40;
}

.admin-card {
  width: min(100%, 560px);
  max-height: min(86vh, 720px);
  overflow: auto;
}

.admin-head {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: start;
  gap: 14px;
}

.admin-head .icon-button {
  min-height: 38px;
  border-radius: 12px;
}

.admin-head .icon-button span {
  font-size: 20px;
}

.admin-list {
  display: grid;
  gap: 8px;
}

.admin-user {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.admin-user strong {
  color: var(--hot);
}

.admin-user span {
  color: rgba(246, 239, 228, 0.66);
  font-size: 12px;
}

.app::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, transparent, black 12%, black 82%, transparent);
}

.topbar,
.code-panel,
.controls,
.stats,
.collection {
  width: min(100%, 520px);
  margin: 0 auto;
}

.product-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 12px;
  border: 1px solid rgba(216, 167, 95, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.product-strip div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.product-strip span,
.product-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.product-strip strong {
  color: var(--text);
  font-size: 14px;
}

.product-action {
  display: inline-grid;
  min-height: 42px;
  place-items: center;
  padding: 0 16px;
  text-decoration: none;
}

.product-page {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 40px 16px 72px;
}

.product-section {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.product-section h1,
.product-section h2 {
  margin: 0;
  color: #ffe5aa;
  font-size: clamp(30px, 7vw, 54px);
  line-height: 1.03;
}

.product-section h2 {
  font-size: clamp(26px, 5vw, 42px);
}

.product-section p,
.product-section li,
.product-grid p {
  color: rgba(246, 239, 228, 0.74);
  line-height: 1.65;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 28px auto;
}

.product-grid article {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background:
    radial-gradient(circle at 40% 0%, rgba(255, 216, 150, 0.12), transparent 11rem),
    rgba(255, 255, 255, 0.055);
}

.product-grid span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-grid h2 {
  margin: 0;
  color: #ffe5aa;
  font-size: 22px;
  line-height: 1.15;
}

.product-grid p {
  margin: 0;
  font-size: 14px;
}

.product-access {
  padding-top: 10px;
}

.product-access ul {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
  margin: 0 auto 10px;
  padding-left: 20px;
  text-align: left;
}

.error-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
}

@media (max-width: 760px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-grid article {
    min-height: auto;
  }
}

@media (max-width: 420px) {
  .product-strip {
    grid-template-columns: 1fr;
  }

  .product-action {
    width: 100%;
  }
}

.topbar {
  display: grid;
  grid-template-columns: 62px 1fr 62px;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
}

.brand {
  display: grid;
  gap: 2px;
  text-align: center;
  min-width: 0;
}

.brand strong {
  font-size: clamp(28px, 7vw, 42px);
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd76d;
  -webkit-text-fill-color: #ffd76d;
  background: none;
  text-shadow:
    0 1px 0 #6f3f06,
    0 2px 0 rgba(35, 18, 2, 0.86),
    0 0 10px rgba(255, 215, 109, 0.55),
    0 0 24px rgba(255, 184, 58, 0.34);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.66));
}

.brand strong::first-letter {
  letter-spacing: 0.18em;
}

.brand span,
.code-panel span,
.stats span,
.collection span,
.controls label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand span {
  line-height: 1.35;
}

.icon-button,
.gold-button {
  min-height: 44px;
  border: 1px solid rgba(216, 167, 95, 0.48);
  border-radius: 18px;
  color: var(--text);
  background:
    radial-gradient(circle at 38% 20%, rgba(255, 255, 255, 0.14), transparent 52%),
    linear-gradient(180deg, rgba(70, 66, 58, 0.72), rgba(25, 24, 22, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.35);
}

.icon-button span {
  color: var(--metal-accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.code-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 167, 95, 0.22);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.code-track {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  min-width: 0;
}

.code-digit {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #f3dec0;
  background: rgba(255, 255, 255, 0.06);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 900;
}

.code-digit.is-done {
  color: #17100a;
  background: var(--gold);
}

.code-digit.is-active {
  border-color: var(--hot);
  box-shadow: 0 0 22px rgba(255, 203, 120, 0.28);
}

.task-line,
.stats {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.task-line strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  color: var(--hot);
}

.task-line span:last-child {
  text-align: right;
}

.accept-line {
  min-height: 18px;
  color: rgba(246, 239, 228, 0.62);
  font-size: 12px;
  text-align: center;
}

.accept-line.is-ready {
  color: rgba(130, 232, 220, 0.95);
}

.accept-line.is-accepted {
  color: var(--hot);
}

body.accept-pulse .safe-body {
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.05),
    inset 0 0 0 17px rgba(0, 0, 0, 0.28),
    0 34px 80px rgba(0, 0, 0, 0.58),
    0 0 34px rgba(255, 203, 120, 0.22);
}

body.accept-pulse .dial-core span {
  animation: counter-lock 0.42s ease;
}

.safe-stage {
  display: grid;
  place-items: center;
  min-height: 44svh;
}

.safe-body {
  --safe-a: var(--iron-1);
  --safe-b: var(--iron-2);
  --metal-accent: var(--gold);
  --metal-glow: rgba(255, 203, 120, 0.26);
  position: relative;
  display: grid;
  place-items: center;
  width: min(92vw, 430px);
  aspect-ratio: 0.88;
  border-radius: 34px;
  background:
    radial-gradient(circle at 34% 20%, rgba(255, 255, 255, 0.22), transparent 15rem),
    radial-gradient(circle at 68% 82%, rgba(0, 0, 0, 0.34), transparent 11rem),
    linear-gradient(145deg, color-mix(in srgb, var(--safe-b), white 12%), var(--safe-a) 44%, #090908);
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.05),
    inset 0 0 0 17px rgba(0, 0, 0, 0.28),
    0 34px 80px rgba(0, 0, 0, 0.58);
}

.safe-body::after {
  position: absolute;
  inset: 18% 5% auto;
  height: 46%;
  pointer-events: none;
  content: "";
  border-radius: 999px;
  opacity: 0;
  background:
    radial-gradient(circle at 35% 55%, rgba(240, 235, 220, 0.36), transparent 28%),
    radial-gradient(circle at 60% 45%, rgba(210, 225, 220, 0.24), transparent 32%),
    radial-gradient(circle at 48% 72%, rgba(255, 255, 255, 0.16), transparent 38%);
  filter: blur(18px);
  transform: translateY(22px) scale(0.72);
}

body.safe-opening .safe-body::after {
  animation: smoke-release 2.1s ease-out forwards;
}

body.safe-opening .safe-door {
  animation: vault-door-shift 1.4s cubic-bezier(0.2, 0.7, 0.12, 1) forwards;
}

@keyframes smoke-release {
  0% {
    opacity: 0;
    transform: translateY(34px) scale(0.6);
  }
  22% {
    opacity: 0.86;
  }
  100% {
    opacity: 0;
    transform: translateY(-48px) scale(1.45);
  }
}

@keyframes vault-door-shift {
  0% {
    transform: translateX(0) scale(1);
  }
  18% {
    transform: translateX(-2px) scale(1.006);
  }
  100% {
    transform: translateX(18px) scale(0.992);
  }
}

@keyframes counter-lock {
  0% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(-5px);
  }
  70% {
    transform: translateY(3px);
  }
  100% {
    transform: translateY(0);
  }
}

[data-material="bronze"] .safe-body {
  --safe-a: var(--bronze-1);
  --safe-b: var(--bronze-2);
  --metal-accent: #c47848;
  --metal-glow: rgba(210, 117, 64, 0.28);
}

[data-material="brass"] .safe-body {
  --safe-a: var(--brass-1);
  --safe-b: var(--brass-2);
  --metal-accent: #d8b35c;
  --metal-glow: rgba(222, 180, 86, 0.28);
}

[data-material="gold"] .safe-body {
  --safe-a: var(--gold-1);
  --safe-b: var(--gold-2);
  --metal-accent: #f0c974;
  --metal-glow: rgba(255, 205, 97, 0.34);
}

[data-material="bronze"] {
  --metal-accent: #c47848;
}

[data-material="brass"] {
  --metal-accent: #d8b35c;
}

[data-material="gold"] {
  --metal-accent: #f0c974;
}

.safe-rivets {
  position: absolute;
  inset: 20px;
  border: 2px solid rgba(0, 0, 0, 0.28);
  border-radius: 24px;
}

.safe-rivets::before,
.safe-rivets::after {
  display: none;
}

.safe-rivets::after {
  transform: rotate(90deg);
}

.safe-door {
  position: relative;
  display: grid;
  place-items: center;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px),
    conic-gradient(from 225deg, #0a0a09, color-mix(in srgb, var(--safe-b), white 15%), var(--safe-a), #050505, color-mix(in srgb, var(--safe-b), white 8%), #0a0a09);
  box-shadow:
    inset 0 0 0 6px rgba(0, 0, 0, 0.55),
    inset 0 0 0 15px rgba(255, 255, 255, 0.08),
    inset 0 0 0 24px rgba(0, 0, 0, 0.26),
    0 20px 52px rgba(0, 0, 0, 0.55);
}

.safe-door::before {
  position: absolute;
  inset: -8.5%;
  content: "";
  border-radius: 50%;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.2), transparent 22% 66%, rgba(0, 0, 0, 0.36)),
    conic-gradient(from 220deg, #111, #858077, #292824, #050505, #625d54, #111);
  box-shadow:
    inset 0 0 0 2px rgba(255, 240, 210, 0.16),
    inset 0 0 0 12px rgba(0, 0, 0, 0.38),
    0 16px 42px rgba(0, 0, 0, 0.55);
  z-index: -1;
}

.dial-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 91%;
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dial-wrap.is-armed .dial-core {
  border-color: rgba(130, 232, 220, 0.82);
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.8),
    0 0 22px rgba(130, 232, 220, 0.38);
}

.dial-wrap.is-armed .dial::before {
  filter:
    drop-shadow(0 0 10px rgba(255, 206, 128, 0.7))
    drop-shadow(0 0 18px rgba(130, 232, 220, 0.35));
}

.dial-scale,
.dial {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.dial-scale {
  z-index: 1;
  background:
    repeating-conic-gradient(from 0deg, rgba(255, 238, 202, 0.74) 0deg 0.38deg, transparent 0.38deg 3.64deg),
    radial-gradient(circle, transparent 0 56%, rgba(6, 6, 5, 0.96) 57%, rgba(0, 0, 0, 0.92) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 226, 172, 0.2),
    inset 0 0 34px rgba(0, 0, 0, 0.82);
}

.dial {
  z-index: 2;
  background:
    radial-gradient(circle, transparent 0 70%, rgba(255, 255, 255, 0.14) 71%, rgba(13, 13, 12, 0.58) 74%, rgba(255, 234, 190, 0.24) 77%, rgba(20, 20, 18, 0.92) 88%, transparent 89%),
    conic-gradient(from 220deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.14), rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.18));
  box-shadow:
    inset 0 0 0 2px rgba(255, 239, 210, 0.24),
    inset 0 0 0 9px rgba(0, 0, 0, 0.42),
    inset 0 0 34px rgba(0, 0, 0, 0.72),
    0 12px 34px rgba(0, 0, 0, 0.54);
}

.dial::before {
  position: absolute;
  top: -2px;
  left: 50%;
  width: 28px;
  height: 36px;
  content: "";
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 36%),
    linear-gradient(180deg, #fff0bc, var(--metal-accent) 58%, #6f4211);
  filter: drop-shadow(0 0 12px rgba(255, 206, 128, 0.48));
  transform: translateX(-50%);
}

.dial::after {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 3px;
  height: 11px;
  content: "";
  border-radius: 999px;
  background: rgba(20, 12, 5, 0.85);
  transform: translateX(-50%);
}

.dial-number {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 20px;
  margin-left: -10px;
  margin-top: -10px;
  color: rgba(255, 230, 191, 0.92);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(7px, 2.12vw, 11px);
  font-weight: 900;
  line-height: 20px;
  text-align: center;
  transform-origin: center;
}

.dial-number {
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.85),
    0 0 4px rgba(255, 210, 136, 0.22);
}

.dial-core {
  position: relative;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 42%;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 230, 178, 0.38);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 255, 255, 0.22), transparent 34%),
    conic-gradient(from 220deg, #050505, #3a3833, #11100e, #4d4941, #050505);
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, 0.38),
    inset 0 0 0 13px rgba(255, 229, 179, 0.12),
    inset 0 0 34px rgba(0, 0, 0, 0.84),
    0 0 0 10px rgba(0, 0, 0, 0.32),
    0 0 0 13px color-mix(in srgb, var(--metal-accent), transparent 38%);
}

.dial-core span {
  display: flex;
  gap: 5px;
  padding: 5px;
  margin: 0;
  border: 1px solid rgba(255, 226, 177, 0.2);
  border-radius: 12px;
  background: #060606;
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.92),
    0 0 18px rgba(0, 0, 0, 0.42);
}

.dial-core b {
  display: grid;
  place-items: center;
  width: clamp(32px, 8.5vw, 46px);
  height: clamp(48px, 12vw, 64px);
  border: 1px solid rgba(255, 226, 177, 0.28);
  border-radius: 8px;
  color: #ffd58f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 22% 74%, rgba(0, 0, 0, 0.36)),
    linear-gradient(90deg, #090909, #2b2924 48%, #070707);
  box-shadow:
    inset 0 18px 28px rgba(255, 255, 255, 0.06),
    inset 0 -18px 26px rgba(0, 0, 0, 0.56);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 10vw, 58px);
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 0 10px rgba(255, 199, 112, 0.36),
    0 1px 0 #000;
}

.dial-core small {
  display: none;
  margin-top: 0;
  color: rgba(255, 235, 202, 0.58);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.safe-handle {
  display: none;
}

.unlock-glow {
  position: absolute;
  inset: 8%;
  pointer-events: none;
  border-radius: 30px;
  opacity: 0;
  box-shadow: 0 0 100px rgba(255, 202, 112, 0.75);
  transition: opacity 240ms ease;
}

.unlock-glow.is-on {
  opacity: 1;
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.controls label {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
}

select,
input[type="range"] {
  width: 100%;
  color: var(--text);
}

select {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.32);
}

select:disabled,
input:disabled {
  opacity: 0.76;
}

input[type="range"] {
  accent-color: var(--gold);
}

.stats {
  gap: 8px;
}

.stats div {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.stats strong {
  font-size: 18px;
}

.collection {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(216, 167, 95, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.collection-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.collection-head div,
.coin-stat {
  display: grid;
  gap: 3px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 217, 151, 0.08), transparent 7rem),
    rgba(0, 0, 0, 0.18);
}

.collection strong {
  color: var(--hot);
  font-size: 18px;
}

.coin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.coin-stat {
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.coin-stat::after {
  position: absolute;
  right: -10px;
  bottom: -12px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  content: "";
  border-radius: 50%;
  opacity: 0.24;
  color: rgba(20, 12, 4, 0.88);
  background: var(--coin-dot, #aaa);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.coin-stat[data-coin="iron"] {
  --coin-dot: #aeb5b1;
}

.coin-stat[data-coin="iron"]::after {
  content: "Fe";
}

.coin-stat[data-coin="silver"] {
  --coin-dot: #d9eefc;
}

.coin-stat[data-coin="silver"]::after {
  content: "Ag";
}

.coin-stat[data-coin="gold"] {
  --coin-dot: #ffc44a;
}

.coin-stat[data-coin="gold"]::after {
  content: "Au";
}

.collection small {
  min-height: 17px;
  color: rgba(246, 239, 228, 0.66);
  font-size: 12px;
  line-height: 1.45;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background: #000;
  backdrop-filter: none;
}

.result-modal::before {
  display: none;
}

.result-modal::after {
  display: none;
}

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

.reward-scene {
  width: min(100%, 380px);
  min-height: min(82vh, 620px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px 20px;
  text-align: center;
  perspective: 900px;
  z-index: 1;
}

.reward-coin {
  position: relative;
  display: grid;
  place-items: center;
  width: min(78vw, 330px);
  height: min(78vw, 330px);
  margin: 0 auto 0;
  border-radius: 50%;
  transform-style: preserve-3d;
  animation: coin-showcase 10s cubic-bezier(0.16, 0.8, 0.24, 1) both;
  will-change: transform, opacity;
  --coin-image: image-set(url("assets/coin-gold.webp") type("image/webp"), url("assets/coin-gold.png") type("image/png"));
  --coin-glow: rgba(255, 190, 54, 0.82);
  --coin-edge: #d2962c;
}

.reward-coin::before {
  position: absolute;
  inset: 3.5%;
  content: "";
  border-radius: 50%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45), var(--coin-edge) 21%, rgba(255, 255, 255, 0.55) 50%, var(--coin-edge) 79%, rgba(0, 0, 0, 0.46)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.25) 0 2px, rgba(0, 0, 0, 0.18) 2px 5px);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.55);
  transform: translateZ(-16px);
}

.reward-coin::after {
  display: none;
}

.coin-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  background:
    radial-gradient(circle at 50% 42%, transparent 0 58%, rgba(0, 0, 0, 0.08) 66%, rgba(0, 0, 0, 0.42) 100%),
    var(--coin-image) center / cover no-repeat;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.26),
    inset 0 0 34px rgba(255, 255, 255, 0.16),
    inset -28px -18px 48px rgba(0, 0, 0, 0.44);
}

.coin-face::before {
  display: none;
}

.coin-face::after {
  display: none;
}

.coin-front {
  transform: translateZ(18px);
}

.coin-back {
  transform: rotateY(180deg) translateZ(18px);
}

.reward-coin[data-reward="iron"] {
  --coin-image: image-set(url("assets/coin-iron.webp") type("image/webp"), url("assets/coin-iron.png") type("image/png"));
  --coin-glow: rgba(183, 190, 186, 0.62);
  --coin-edge: #8c918c;
  box-shadow:
    0 0 82px rgba(190, 198, 194, 0.28),
    0 38px 100px rgba(0, 0, 0, 0.78);
}

.reward-coin[data-reward="silver"] {
  --coin-image: image-set(url("assets/coin-silver.webp") type("image/webp"), url("assets/coin-silver.png") type("image/png"));
  --coin-glow: rgba(218, 238, 255, 0.76);
  --coin-edge: #c7d2dc;
  box-shadow:
    0 0 96px rgba(220, 238, 255, 0.46),
    0 38px 104px rgba(0, 0, 0, 0.74);
}

.reward-coin[data-reward="gold"] {
  --coin-image: image-set(url("assets/coin-gold.webp") type("image/webp"), url("assets/coin-gold.png") type("image/png"));
  --coin-glow: rgba(255, 196, 46, 0.9);
  --coin-edge: #e0a229;
  box-shadow:
    0 0 120px rgba(255, 196, 46, 0.62),
    0 0 92px rgba(255, 132, 18, 0.34),
    0 38px 112px rgba(0, 0, 0, 0.76);
}

.reward-title {
  display: block;
  margin: -2px 0 10px;
  color: var(--hot);
  font-size: 20px;
}

.reward-hint {
  position: absolute;
  bottom: 8vh;
  left: 50%;
  width: min(78vw, 320px);
  color: rgba(255, 255, 255, 0.48);
  letter-spacing: 0.04em;
  line-height: 1.35;
  transform: translateX(-50%);
  animation: reward-hint-pulse 2.8s ease-in-out infinite;
}

.reward-details {
  width: min(100%, 360px);
  margin-top: 26px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.result-modal.show-details .reward-details {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.result-modal.show-details .reward-hint {
  opacity: 0;
}

.result-modal.show-details .reward-coin {
  animation: coin-settle 0.75s ease both;
}

.reward-rest {
  display: block;
  max-width: 260px;
  margin: 18px auto 0;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.45;
}

.reward-share {
  width: 100%;
  margin-top: 16px;
}

.reward-next {
  opacity: 0;
  transform: translateY(12px);
  animation: reward-button-in 0.7s ease 0.35s forwards;
}

@keyframes coin-showcase {
  0% {
    opacity: 0;
    transform: translateY(76px) rotateX(12deg) rotateY(0deg) rotateZ(-8deg) scale(0.45);
  }
  12% {
    opacity: 1;
    transform: translateY(-18px) rotateX(9deg) rotateY(540deg) rotateZ(3deg) scale(1.04);
  }
  28% {
    transform: translateY(5px) rotateX(-4deg) rotateY(1120deg) rotateZ(-2deg) scale(1);
  }
  54% {
    transform: translateY(-10px) rotateX(5deg) rotateY(1980deg) rotateZ(2deg) scale(1.02);
  }
  78% {
    transform: translateY(4px) rotateX(-3deg) rotateY(2880deg) rotateZ(-1deg) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) rotateY(3600deg) rotateZ(0deg) scale(1);
  }
}

@keyframes coin-settle {
  from {
    transform: translateY(0) rotateX(0deg) rotateY(3600deg) scale(1);
  }
  to {
    transform: translateY(-28px) rotateX(0deg) rotateY(0deg) scale(0.72);
  }
}

@keyframes coin-glow-breathe {
  0%, 100% {
    opacity: 0.48;
    transform: translateZ(-32px) scale(0.94);
  }
  50% {
    opacity: 0.88;
    transform: translateZ(-32px) scale(1.08);
  }
}

@keyframes metal-glint {
  0% {
    opacity: 0;
    transform: translateX(-62%) rotate(8deg);
  }
  18% {
    opacity: 0.9;
  }
  52% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: translateX(62%) rotate(8deg);
  }
}

@keyframes reward-hint-pulse {
  0%, 100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.76;
  }
}

@keyframes reward-aura {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }
  34% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 0.82;
    transform: scale(1);
  }
}

@keyframes reward-sparks {
  0%, 100% {
    opacity: 0;
    transform: scale(0.8) rotate(0deg);
  }
  38% {
    opacity: 1;
  }
  80% {
    opacity: 0.32;
    transform: scale(1.2) rotate(8deg);
  }
}

@keyframes reward-button-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-modal p {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.result-modal h2 {
  margin: 8px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 54px;
}

.gold-button {
  width: 100%;
  margin-top: 22px;
  color: #161009;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe4a8, #c68438);
}

@media (min-width: 700px) {
  .app {
    align-content: center;
  }

  .safe-stage {
    min-height: 520px;
  }
}

@media (max-width: 390px) {
  .app {
    width: calc(100% - 15px);
    padding-inline: 10px;
    gap: 10px;
  }

  .topbar {
    width: 100%;
    grid-template-columns: 56px 1fr 56px;
    gap: 6px;
  }

  .code-panel,
  .safe-stage,
  .controls,
  .stats,
  .collection {
    width: 100%;
  }

  .brand strong {
    font-size: 28px;
    letter-spacing: 0.1em;
  }

  .brand span {
    font-size: 10px;
    letter-spacing: 0.09em;
  }

  .code-panel,
  .collection {
    padding: 10px;
  }

  .code-track {
    gap: 3px;
  }

  .code-digit {
    min-height: 37px;
    border-radius: 9px;
    font-size: 15px;
  }

  .safe-stage {
    min-height: 390px;
  }

  .safe-body {
    width: min(100%, 380px);
  }

  .controls label {
    grid-template-columns: 78px 1fr auto;
    gap: 8px;
    padding-inline: 10px;
  }

  .coin-grid {
    gap: 6px;
  }
}
