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

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1100px 680px at 72% 18%, rgba(242, 169, 59, 0.055), transparent 62%),
    radial-gradient(900px 620px at 12% 88%, rgba(143, 174, 82, 0.045), transparent 60%),
    linear-gradient(180deg, #0b0e09 0%, #080a07 55%, #060805 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(90, 102, 71, 0.045) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(90, 102, 71, 0.045) 1px, transparent 1px) 0 0 / 64px 64px;
  mask-image: radial-gradient(ellipse at 52% 42%, #000 0%, transparent 78%);
  opacity: 0.6;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--amber);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

::selection {
  background: var(--amber);
  color: #0a0c09;
}

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

#grain {
  position: fixed;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grain-shift 7s steps(6) infinite;
}

.shell,
.lobby {
  position: relative;
  z-index: 2;
}

[hidden] {
  display: none !important;
}

.panel-label {
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.kicker {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--amber);
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(242, 169, 59, 0.65);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s var(--ease-out);
}

.btn:hover:not(:disabled) {
  border-color: var(--amber);
  color: var(--ink);
  background: rgba(242, 169, 59, 0.06);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  border-color: var(--amber);
  background: var(--amber);
  color: #0a0c09;
}

.btn-primary:hover:not(:disabled) {
  background: var(--amber-hot);
  border-color: var(--amber-hot);
  color: #0a0c09;
}

.btn-ghost {
  border-color: var(--line);
  color: var(--ink-dim);
}

.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16px;
}

.btn.danger {
  border-color: rgba(210, 74, 50, 0.4);
  color: var(--red-ink);
}

.btn.danger:hover:not(:disabled) {
  border-color: var(--red);
  background: rgba(210, 74, 50, 0.1);
  color: #ff8a70;
}

.btn:disabled {
  opacity: 0.42;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--ink-dim);
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.icon-btn:hover {
  color: var(--amber);
  border-color: var(--line);
  background: rgba(242, 169, 59, 0.05);
}

.icon-btn.danger:hover {
  color: var(--red-ink);
  border-color: rgba(210, 74, 50, 0.35);
  background: rgba(210, 74, 50, 0.08);
}

.icon-btn.small {
  width: 30px;
  height: 30px;
}

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

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink-dim);
  font-size: 13px;
  user-select: none;
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-strong);
  background: var(--panel-deep);
  display: grid;
  place-items: center;
}

.check input::after {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--amber);
  transform: scale(0);
  transition: transform 0.14s var(--ease-out);
}

.check input:checked {
  border-color: var(--amber);
}

.check input:checked::after {
  transform: scale(1);
}

.check input:disabled + span,
.check:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  color: var(--ink-faint);
  font-family: var(--font-cond);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.serial {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

.linkish {
  color: var(--ink-faint);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linkish:hover {
  color: var(--amber);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 80;
  transform: translate(-50%, 14px);
  min-width: 220px;
  max-width: min(520px, 82vw);
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  background: #10150d;
  color: var(--ink);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.24s var(--ease-out);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: rgba(210, 74, 50, 0.6);
  color: #ffb4a3;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2c3524;
  border: 2px solid transparent;
  background-clip: content-box;
}
