:root {
  color-scheme: dark;
  --bg: #11130f;
  --panel: #20231b;
  --panel-2: #2b2a21;
  --line: #6f694b;
  --text: #f2dfb0;
  --muted: #c0b486;
  --green: #76b960;
  --amber: #f0b84a;
  --rust: #b75f34;
  --red: #d94a3d;
  --teal: #52a3a6;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(115deg, rgba(17, 19, 15, .94), rgba(29, 27, 20, .9)),
    url("/assets/wasteland-table.png") center / cover fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #fff2c2;
  font-size: clamp(28px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 0 #57351f, 0 0 24px rgba(240, 184, 74, .25);
}

.status-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.status-strip span {
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid rgba(118, 185, 96, .45);
  background: rgba(20, 40, 24, .78);
  text-align: center;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(360px, 740px) minmax(220px, 290px);
  gap: 18px;
  align-items: start;
}

.score-panel,
.control-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(111, 105, 75, .7);
  background: rgba(32, 35, 27, .88);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .32);
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meter {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(111, 105, 75, .55);
  background: rgba(17, 19, 15, .62);
}

.meter span,
.keys dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.meter strong {
  display: block;
  overflow-wrap: anywhere;
  color: #fff4c9;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  line-height: 1.1;
}

.lamp-bank {
  display: grid;
  gap: 8px;
}

.lamp {
  padding: 9px 10px;
  border: 1px solid rgba(111, 105, 75, .55);
  background: #171914;
  color: #8f8768;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.lamp.active {
  border-color: rgba(240, 184, 74, .9);
  background: rgba(116, 67, 30, .82);
  color: #ffe6a2;
  box-shadow: 0 0 20px rgba(240, 184, 74, .22) inset;
}

.table-wrap {
  position: relative;
  width: min(100%, 740px);
  margin: 0 auto;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(240, 184, 74, .35);
  background: #080907;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .58);
  overflow: hidden;
}

#table {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 8, 6, .58);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-inner {
  width: min(360px, 100%);
  padding: 18px;
  border: 1px solid rgba(240, 184, 74, .65);
  background: rgba(28, 31, 23, .92);
  text-align: center;
}

.overlay h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.overlay p {
  margin: 0 0 14px;
  color: var(--muted);
}

.control-panel {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.control,
#start {
  min-height: 44px;
  border: 1px solid rgba(240, 184, 74, .72);
  background: #67411f;
  color: #ffe8ac;
  cursor: pointer;
  font-weight: 800;
}

.control:active,
.control.pressed,
#start:active {
  background: #98602b;
  transform: translateY(1px);
}

.control.secondary {
  border-color: rgba(82, 163, 166, .65);
  background: #1f4b4d;
  color: #c9fbff;
}

.control.wide,
.keys {
  grid-column: 1 / -1;
}

.keys {
  display: grid;
  gap: 8px;
  margin: 2px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(111, 105, 75, .55);
}

.keys div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.keys dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

@media (max-width: 1080px) {
  .game-layout {
    grid-template-columns: 1fr minmax(360px, 700px);
  }

  .control-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

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

  .topbar,
  .game-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-strip {
    justify-content: stretch;
  }

  .status-strip span {
    flex: 1;
  }

  .table-wrap {
    width: 100%;
  }
}
