:root {
  color-scheme: dark;
  --bg: #101516;
  --panel: rgba(22, 31, 31, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(234, 242, 232, 0.14);
  --text: #eff6ed;
  --muted: #a9b7ae;
  --gold: #d8c071;
  --green: #74d48b;
  --cyan: #66cad2;
  --orange: #dc9545;
  --red: #ef6f62;
  --shadow: rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(116, 212, 139, 0.08), transparent 26rem),
    linear-gradient(180deg, #182021, var(--bg));
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #253434;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1718;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1718;
  color: var(--text);
  padding: 0 10px;
}

select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.9rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.player-stats span,
.env-chip,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19, 27, 28, 0.78);
}

.player-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 11px;
  color: var(--muted);
  white-space: nowrap;
}

.account-button {
  min-height: 36px;
  padding: 0 12px;
  background: rgba(102, 202, 210, 0.16);
  color: var(--text);
  border: 1px solid rgba(102, 202, 210, 0.36);
}

.player-stats strong {
  color: var(--text);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(460px, 1fr) minmax(280px, 340px);
  gap: 14px;
  align-items: start;
}

.panel,
.stage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 70px var(--shadow);
}

.panel {
  padding: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-header h2 {
  margin-bottom: 0;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  padding: 0;
  place-items: center;
}

.icon-button img {
  width: 22px;
  height: 22px;
}

.primary-button {
  background: linear-gradient(180deg, #e3cf89, #b9984d);
  color: #15160f;
}

.danger-button {
  background: linear-gradient(180deg, #f08f7a, #c94a3e);
  color: #160908;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  min-height: 36px;
  padding: 0 6px;
  color: var(--muted);
}

.tab.active {
  background: var(--gold);
  color: #171408;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: grid;
  gap: 10px;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  gap: 12px;
  background: #101516;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.loading-screen img {
  width: 74px;
}

.loading-screen.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.toast-host {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 32px));
}

.toast {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 21, 22, 0.94);
  padding: 11px 12px;
  box-shadow: 0 16px 44px var(--shadow);
}

.result-modal {
  width: min(420px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151e1f;
  color: var(--text);
  padding: 18px;
}

.account-dialog {
  width: min(460px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151e1f;
  color: var(--text);
  padding: 18px;
}

.account-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-close-row {
  display: flex;
  justify-content: flex-end;
  margin: -6px -6px 4px;
}

.dialog-close-row button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.account-grid {
  display: grid;
  gap: 8px;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.account-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--gold);
}

.copyright-bar {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.result-modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
}
