:root {
  --bg: #0f1115;
  --card: #181b22;
  --border: #2a2f3a;
  --fg: #e6e6e6;
  --muted: #9aa0aa;
  --accent: #4caf50;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:#f6f7f9;
    --card:#ffffff;
    --border:#dcdfe4;
    --fg:#111;
    --muted:#666;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
}

header {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

header h1 {
  font-size: 1.1rem;
  margin: 0;
}

header button {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 6px 10px;
  border-radius: 8px;
}

main {
  padding: 12px;
}

/* -------- GAME META -------- */

#gameType, #notes {
  width: 100%;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 10px;
  padding: 10px;
}

/* -------- FRAMES -------- */

#frames {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.frame {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.frame-header {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 4px;
  border-bottom: 1px solid var(--border);
}

.frame-rolls {
  display: flex;
  height: 48px;
}

.roll {
  flex: 1;
  border-right: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
}

.roll:last-child {
  border-right: none;
}

.frame-total {
  text-align: center;
  padding: 6px;
  font-size: 1rem;
  font-weight: 700;
  border-top: 1px solid var(--border);
}

/* -------- CONTROLS -------- */

#controls {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

#controls button {
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 1rem;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
}

#controls button.secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
}

/* -------- PINS -------- */

#pins {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.pin-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--fg);
  color: var(--bg);
  font-weight: 700;
}

.pin-btn.hit {
  background: var(--border);
  color: var(--muted);
}

/* -------- HISTORY -------- */

#historyScreen ul {
  list-style: none;
  padding: 0;
}

#historyScreen li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 8px;
}
