:root {
  color-scheme: dark;
  --obsidian: #070b12;
  --ink: #0d1420;
  --glass: rgba(16, 27, 41, .72);
  --glass-strong: rgba(19, 34, 51, .9);
  --line: rgba(153, 202, 235, .18);
  --line-bright: rgba(168, 224, 255, .38);
  --text: #e8f3fa;
  --muted: #8399aa;
  --quiet: #587080;
  --azure: #52c8ff;
  --azure-bright: #d8f7ff;
  --blue-deep: #1764c4;
  --shadow: rgba(0, 0, 0, .42);
  --radius: 18px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", ui-monospace, monospace;
  --body: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --display: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--obsidian); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 72% 12%, rgba(27, 104, 158, .18), transparent 34rem),
    radial-gradient(circle at 16% 84%, rgba(25, 59, 104, .16), transparent 30rem),
    var(--obsidian);
  font-family: var(--body);
  line-height: 1.5;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .26;
  background-image: linear-gradient(rgba(126, 188, 220, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(126, 188, 220, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--azure); outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(100% - 32px, 1120px); margin-inline: auto; }

.ambient-field {
  position: fixed;
  z-index: -1;
  top: 4rem;
  right: -9rem;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(82, 200, 255, .12);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(34, 136, 212, .12), inset 0 0 80px rgba(34, 136, 212, .08);
  opacity: .7;
}

.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 76px; border-bottom: 1px solid rgba(153, 202, 235, .12); }
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: var(--azure-bright); font-family: var(--mono); font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-decoration: none; text-transform: uppercase; }
.wordmark-mark { display: grid; width: 1.65rem; height: 1.65rem; place-items: center; border: 1px solid rgba(82, 200, 255, .58); color: var(--azure); font-size: 1rem; line-height: 1; transform: rotate(45deg); }
.header-account { display: flex; align-items: center; gap: .85rem; }
.account-state { color: var(--muted); font-family: var(--mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: .6rem; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 8px; color: var(--text); font-size: .82rem; font-weight: 650; line-height: 1.1; text-decoration: none; transition: border-color .2s ease, background-color .2s ease, color .2s ease, opacity .2s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .42; }
.button-primary { border-color: rgba(126, 220, 255, .5); background: linear-gradient(135deg, #268fd0, #1458b4); box-shadow: 0 8px 28px rgba(20, 102, 188, .22); }
.button-primary:hover:not(:disabled) { border-color: var(--azure-bright); background: linear-gradient(135deg, #3caee8, #1a67c9); }
.button-secondary { border-color: var(--line-bright); background: rgba(56, 92, 120, .18); }
.button-secondary:hover:not(:disabled) { border-color: var(--azure); background: rgba(70, 137, 177, .24); }
.button-quiet { min-height: 38px; padding-inline: .75rem; border-color: var(--line); background: rgba(27, 47, 66, .3); color: var(--azure-bright); font-size: .72rem; }
.button-quiet:hover:not(:disabled) { border-color: var(--line-bright); background: rgba(27, 66, 96, .42); }
.text-button { padding: .35rem 0; border: 0; background: transparent; color: var(--azure); font-size: .76rem; font-weight: 650; }
.text-button:hover { color: var(--azure-bright); text-decoration: underline; text-underline-offset: .25em; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.icon-button:hover { border-color: var(--azure); color: var(--azure-bright); }

.glass-panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, rgba(27, 48, 67, .72), rgba(8, 16, 27, .78)); box-shadow: 0 28px 70px var(--shadow), inset 0 1px rgba(220, 247, 255, .07); backdrop-filter: blur(18px); }
.eyebrow { margin: 0 0 .55rem; color: var(--azure); font-family: var(--mono); font-size: .62rem; font-weight: 700; letter-spacing: .15em; line-height: 1.3; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 560; letter-spacing: -.045em; }
h1 { margin-bottom: 1rem; font-size: clamp(2.7rem, 13vw, 5.9rem); line-height: .94; }
h1 em { color: var(--azure); font-style: normal; }
h2 { margin-bottom: .55rem; font-size: clamp(1.7rem, 7vw, 2.65rem); line-height: 1; }
h3 { margin-bottom: .9rem; font-size: 1.35rem; line-height: 1.05; }

.hub { padding-block: clamp(4.5rem, 12vw, 9rem) 4rem; }
.hub-intro { max-width: 720px; margin-bottom: clamp(2.5rem, 8vw, 5.5rem); }
.intro-copy { max-width: 33rem; margin-bottom: 0; color: var(--muted); font-size: 1rem; }
.game-card { display: grid; overflow: hidden; }
.game-card-art { position: relative; display: grid; min-height: 250px; place-items: center; border-bottom: 1px solid var(--line); background: radial-gradient(circle, rgba(48, 154, 216, .2), transparent 60%); }
.game-card-art svg { position: relative; z-index: 1; width: min(72%, 220px); filter: drop-shadow(0 18px 24px rgba(39, 155, 231, .24)); }
.card-diamond-glow { fill: none; stroke: var(--azure); stroke-width: 16; opacity: .12; filter: blur(10px); }
.card-orbit { position: absolute; display: block; border: 1px solid rgba(82, 200, 255, .2); border-radius: 50%; transform: rotate(-25deg); }
.orbit-one { width: 16rem; height: 5rem; }
.orbit-two { width: 11rem; height: 3.5rem; transform: rotate(44deg); opacity: .7; }
.game-card-copy { padding: 1.45rem; }
.game-card-copy h2 { margin-bottom: .7rem; }
.game-card-copy > p:not(.eyebrow) { max-width: 31rem; margin-bottom: 1.35rem; color: var(--muted); }
.hub-note { display: flex; align-items: center; gap: .65rem; margin: 1.15rem 0 0; color: var(--quiet); font-family: var(--mono); font-size: .65rem; }
.status-dot { width: .45rem; height: .45rem; flex: 0 0 auto; border-radius: 50%; background: var(--azure); box-shadow: 0 0 12px var(--azure); }

.game-shell { padding-block: 2.4rem 4rem; }
.game-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2.2rem; }
.game-heading h1 { margin-bottom: .55rem; font-size: clamp(2.25rem, 9vw, 4.7rem); }
.game-subtitle { margin-bottom: 0; color: var(--muted); font-family: var(--mono); font-size: .67rem; }
.counter-strip { display: flex; align-items: center; gap: .9rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(12, 24, 37, .65); }
.counter { min-width: 4.25rem; }
.counter-label { display: block; color: var(--quiet); font-family: var(--mono); font-size: .58rem; letter-spacing: .09em; text-transform: uppercase; }
.counter-value { display: block; margin-top: .15rem; color: var(--azure-bright); font-family: var(--mono); font-size: 1.25rem; font-weight: 500; line-height: 1; }
.counter-divider { width: 1px; height: 2rem; background: var(--line); }

.game-tabs { display: flex; gap: 1.25rem; margin-bottom: 1px; border-bottom: 1px solid var(--line); }
.tab-button { position: relative; padding: .75rem .1rem .85rem; border: 0; background: transparent; color: var(--quiet); font-size: .8rem; font-weight: 700; }
.tab-button::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--azure); content: ""; opacity: 0; transform: scaleX(.4); transition: opacity .2s ease, transform .2s ease; }
.tab-button:hover, .tab-button.is-active { color: var(--azure-bright); }
.tab-button.is-active::after { opacity: 1; transform: scaleX(1); }
.tab-panel { min-height: 620px; padding: 2.6rem 0 1rem; }
.panel-intro { max-width: 33rem; }
.panel-intro > p:last-child { margin-bottom: 0; color: var(--muted); }
.rock-stage { position: relative; display: grid; min-height: 350px; place-items: center; margin: 1rem auto 0; }
.rock-button { position: relative; z-index: 1; width: min(100%, 350px); padding: 2rem .75rem .5rem; border: 0; background: transparent; color: var(--text); }
.rock-button-label { position: absolute; top: 1.5rem; left: 50%; width: max-content; max-width: 100%; color: var(--azure-bright); font-family: var(--mono); font-size: .62rem; letter-spacing: .11em; text-transform: uppercase; transform: translateX(-50%); }
.rock-svg { display: block; width: 100%; overflow: visible; filter: drop-shadow(0 20px 18px rgba(0, 0, 0, .5)); }
.rock-button:not(:disabled):hover .rock-body { fill: #263a4e; }
.rock-button:not(:disabled):active .rock-body { fill: #304b62; }
.rock-body { transition: fill .2s ease; }
.rock-facet-light { fill: rgba(109, 139, 163, .2); }
.rock-facet-mid { fill: rgba(71, 111, 142, .2); }
.rock-facet-dark { fill: rgba(2, 7, 13, .28); }
.rock-fracture { fill: rgba(82, 200, 255, .25); filter: drop-shadow(0 0 8px rgba(82, 200, 255, .75)); }
.rock-fracture-line { fill: none; stroke: url(#rock-fracture); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.rock-spark { fill: var(--azure-bright); filter: drop-shadow(0 0 5px var(--azure)); }
.rock-shadow { fill: rgba(0, 0, 0, .4); }
.rock-halo { position: absolute; width: min(68vw, 290px); height: min(68vw, 290px); border: 1px solid rgba(82, 200, 255, .33); border-radius: 50%; box-shadow: 0 0 42px rgba(39, 157, 235, .12), inset 0 0 32px rgba(39, 157, 235, .1); opacity: .75; }
.control-hint { min-height: 1.6em; margin: .3rem 0 0; color: var(--quiet); font-size: .76rem; text-align: center; }
.float-message { position: absolute; z-index: 3; top: 19%; left: 50%; color: var(--azure-bright); font-family: var(--mono); font-size: .75rem; font-weight: 700; letter-spacing: .08em; pointer-events: none; text-shadow: 0 0 16px rgba(82, 200, 255, .9); white-space: nowrap; transform: translateX(-50%); }
.float-message.is-static-feedback { opacity: 1; }

.machine-stage { position: relative; display: grid; min-height: 235px; place-items: center; margin: 1.3rem auto 1.1rem; overflow: hidden; border: 1px solid rgba(82, 200, 255, .12); border-radius: 14px; background: linear-gradient(135deg, rgba(26, 49, 68, .34), rgba(8, 15, 24, .55)); }
.machine-svg { position: relative; z-index: 1; width: min(100%, 390px); }
.machine-shadow { fill: rgba(0, 0, 0, .48); }
.machine-edge { fill: none; stroke: rgba(156, 211, 239, .28); stroke-width: 1; }
.machine-window { fill: rgba(4, 13, 22, .74); stroke: rgba(82, 200, 255, .28); stroke-width: 1; }
.machine-diamond { filter: drop-shadow(0 0 9px rgba(82, 200, 255, .8)); }
.machine-line { fill: none; stroke: rgba(156, 211, 239, .28); stroke-linecap: round; stroke-width: 2; }
.machine-light { fill: var(--azure); filter: drop-shadow(0 0 5px var(--azure)); }
.machine-light-dim { fill: #476878; filter: none; }
.machine-halo { position: absolute; width: 9rem; height: 9rem; border-radius: 50%; background: rgba(63, 179, 240, .08); filter: blur(25px); }
.machine-stage.is-processing .machine-diamond { animation: machine-glint 1.2s ease-in-out infinite alternate; }
@keyframes machine-glint { from { opacity: .65; } to { opacity: 1; filter: drop-shadow(0 0 17px rgba(82, 200, 255, 1)); } }
.process-controls { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.process-readout strong { display: block; margin-top: .25rem; color: var(--text); font-size: .9rem; font-weight: 600; }
.process-countdown { display: block; min-height: 1.4em; color: var(--azure); font-family: var(--mono); font-size: .68rem; }
.progress-track { height: 4px; margin-top: 1rem; overflow: hidden; border-radius: 99px; background: rgba(82, 200, 255, .1); }
.progress-fill { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-deep), var(--azure)); box-shadow: 0 0 15px var(--azure); transform: scaleX(0); transform-origin: left center; }
.process-controls + .progress-track + .control-hint { text-align: left; }
.collection-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-top: 3.6rem; }
.collection-heading h2 { font-size: 1.5rem; }
.collection-count { color: var(--quiet); font-family: var(--mono); font-size: .65rem; }
.polished-list { display: grid; gap: .75rem; margin-top: 1.15rem; }
.empty-collection { margin: 0; padding: 1.3rem; border: 1px dashed var(--line); border-radius: 10px; color: var(--quiet); font-size: .8rem; }
.diamond-card { padding: 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, rgba(23, 50, 72, .6), rgba(9, 16, 26, .7)); }
.diamond-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.diamond-card-title { margin: 0; color: var(--azure-bright); font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.diamond-card-time { color: var(--quiet); font-family: var(--mono); font-size: .58rem; }
.trait-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; padding-top: .9rem; }
.trait-label { display: block; margin-bottom: .2rem; color: var(--quiet); font-family: var(--mono); font-size: .57rem; letter-spacing: .08em; text-transform: uppercase; }
.trait-value { display: block; color: var(--text); font-family: var(--mono); font-size: .7rem; overflow-wrap: anywhere; }
.status-region { min-height: 1.7em; margin: 1.5rem 0 0; color: var(--azure-bright); font-family: var(--mono); font-size: .7rem; }

.account-modal { width: min(100% - 32px, 440px); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line-bright); border-radius: var(--radius); background: var(--glass-strong); color: var(--text); box-shadow: 0 30px 100px rgba(0, 0, 0, .7), 0 0 60px rgba(29, 118, 188, .12); }
.account-modal::backdrop { background: rgba(3, 7, 12, .76); backdrop-filter: blur(5px); }
.modal-card { padding: 1.3rem; }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-bottom: 1.15rem; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin-bottom: 0; font-size: 1.65rem; }
.modal-copy { margin: 1.2rem 0; color: var(--muted); font-size: .85rem; }
.login-choices { display: grid; gap: .65rem; }
.login-panel { margin-top: 1.2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 16, 26, .46); }
.login-panel-heading { margin-bottom: 1rem; }
.login-panel-heading h3 { margin-bottom: 0; }
.login-qr { display: block; width: min(100%, 190px); margin: 0 auto 1rem; padding: .5rem; border-radius: 8px; background: white; }
.login-panel .button { width: 100%; }
.login-status { min-height: 1.5em; margin: .85rem 0 0; color: var(--muted); font-family: var(--mono); font-size: .65rem; }
.field-label { display: block; margin-bottom: .45rem; color: var(--muted); font-size: .75rem; }
.text-input { width: 100%; min-height: 46px; margin-bottom: .8rem; padding: .65rem .75rem; border: 1px solid var(--line-bright); border-radius: 8px; outline: 0; background: rgba(3, 10, 17, .68); color: var(--text); font-family: var(--mono); letter-spacing: .18em; }
.text-input:focus { border-color: var(--azure); box-shadow: 0 0 0 3px rgba(82, 200, 255, .15); }
.modal-footer { display: flex; justify-content: end; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (min-width: 640px) {
  .shell { width: min(100% - 64px, 1120px); }
  .game-card { grid-template-columns: 1fr 1fr; }
  .game-card-art { min-height: 330px; border-right: 1px solid var(--line); border-bottom: 0; }
  .game-card-copy { display: flex; flex-direction: column; justify-content: center; padding: 2.5rem; }
  .game-card-copy .button { align-self: start; }
  .tab-panel { max-width: 800px; margin-inline: auto; }
  .rock-stage { min-height: 420px; }
  .machine-stage { min-height: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .button:hover:not(:disabled) { transform: none; }
  .rock-halo { box-shadow: 0 0 28px rgba(39, 157, 235, .16), inset 0 0 24px rgba(39, 157, 235, .1); }
}
