:root {
  --bg-primary: #000000; /* pure black = transparent on additive display */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --accent-good: #00ff88;
  --accent-warm: #ffd166;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
}

#app { width: 100%; height: 100%; position: relative; }

/* --- Screens --- */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
}
.screen.hidden { display: none; }

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
}
.header h1 { font-size: 22px; font-weight: 600; flex: 1; }
.header-meta {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  background: var(--bg-tertiary);
  padding: 4px 12px;
  border-radius: 20px;
}

/* --- Content --- */
.content {
  flex: 1;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* --- Focus states --- */
.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
}
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

/* --- Nav bar --- */
.nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}
.nav-item:focus { background: var(--bg-card); }
.nav-item.primary { background: var(--accent-primary); color: #0a0a0f; }
.nav-item.primary:focus { background: #33ddff; }

/* --- Home screen --- */
.home-content { justify-content: center; text-align: center; gap: 20px; }
.home-icon { display: flex; justify-content: center; }
.home-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.6; padding: 0 12px; }

/* --- Dice screen --- */
.dice-content { justify-content: flex-start; padding-top: 20px; gap: 12px; }

.dice-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  min-height: 130px;
  align-items: center;
}
.die {
  width: 110px;
  height: 110px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 14px;
  box-shadow: 0 0 0 2px var(--bg-card) inset;
  transition: transform 0.1s ease;
}
.die.rolling { animation: dice-shake 0.1s linear infinite; }
@keyframes dice-shake {
  0% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
  100% { transform: rotate(-4deg); }
}
.pip {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pip::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
}
.pip.on::after { background: var(--accent-primary); }

.sum-readout {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-warm);
}

.history-row {
  display: flex;
  gap: 8px;
  min-height: 28px;
  flex-wrap: wrap;
  justify-content: center;
}
.history-chip {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: 12px;
}

.shake-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Controls --- */
.control-row {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.stepper-btn {
  width: 64px;
  height: 56px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:focus { background: var(--bg-card); }

.hidden { display: none !important; }
