:root {
  color-scheme: light;
  --ink: #142228;
  --deep: #12343b;
  --sky: #8fc9dd;
  --mist: #f5fbfb;
  --cloud: #e6f0ec;
  --gold: #c99c35;
  --laurel: #526f3f;
  --coral: #c9674b;
  --violet: #5f568f;
  --line: rgba(20, 34, 40, 0.18);
  --shadow: 0 18px 40px rgba(18, 52, 59, 0.22);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #d7eef4 0%, #f7fbf5 48%, #dce9df 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid rgba(20, 34, 40, 0.28);
  border-radius: 8px;
  color: #fff;
  background: var(--deep);
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(18, 52, 59, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(20, 34, 40, 0.78);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 410px);
  min-height: calc(100svh - 34px);
  gap: 18px;
  padding: 18px;
}

.game-stage {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  box-shadow: var(--shadow);
  background: #cceaf2;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 620px;
}

.top-hud,
.bottom-hud {
  position: absolute;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.top-hud {
  top: 16px;
  justify-content: space-between;
}

.bottom-hud {
  bottom: 16px;
  flex-wrap: wrap;
}

.top-hud button,
.bottom-hud button {
  pointer-events: auto;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--laurel);
  font-weight: 800;
}

h1,
h2 {
  margin: 4px 0 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.5vw, 4.8rem);
  color: #fffdf5;
  text-shadow: 0 3px 18px rgba(18, 52, 59, 0.38);
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.hud-pill,
.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  background: rgba(18, 52, 59, 0.68);
  backdrop-filter: blur(10px);
  font-size: 0.86rem;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100svh - 36px);
  overflow: auto;
}

.panel-section {
  border: 1px solid rgba(20, 34, 40, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 30px rgba(18, 52, 59, 0.1);
}

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

form {
  display: grid;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: rgba(18, 52, 59, 0.06);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--deep);
  box-shadow: none;
}

.segmented button.active {
  color: #fff;
  background: var(--deep);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
}

.stats-grid div {
  border-left: 3px solid var(--gold);
  padding-left: 8px;
}

dt {
  font-size: 0.72rem;
  color: rgba(20, 34, 40, 0.62);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

dd {
  margin: 2px 0 0;
  font-weight: 900;
}

.meter-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.meter-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 800;
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(20, 34, 40, 0.12);
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--laurel), var(--gold), var(--coral));
}

.forecast-grid,
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status {
  min-height: 1.25rem;
  margin: 10px 0 0;
  color: rgba(20, 34, 40, 0.76);
  font-size: 0.86rem;
  line-height: 1.35;
}

.status.error {
  color: #8b2d24;
}

.status.success {
  color: #2e6332;
}

.confirm-row {
  margin-top: 8px;
}

#leaderboard {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

#leaderboard li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.legal {
  margin: 0;
  padding: 0 18px 14px;
  color: rgba(20, 34, 40, 0.64);
  font-size: 0.78rem;
}

.hidden {
  display: none !important;
}

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

  .control-panel {
    max-height: none;
  }

  .game-stage,
  #game {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  .top-hud,
  .bottom-hud {
    left: 10px;
    right: 10px;
  }

  .top-hud {
    align-items: flex-start;
  }

  h1 {
    font-size: 2.35rem;
  }

  .forecast-grid,
  .form-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
