:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

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

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
}

.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

.hidden { display: none !important; }

/* Home */
.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.title {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}

.title.small { font-size: 44px; letter-spacing: 6px; }

.subtitle {
  font-size: 22px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.rules {
  list-style: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 32px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
}

.rules li {
  color: var(--text-secondary);
  font-size: 16px;
  letter-spacing: 1px;
}

.kw { color: var(--accent); font-weight: 700; }
.ok { color: var(--accent-secondary); font-weight: 700; }
.bad { color: var(--danger); font-weight: 700; }

.btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 16px 32px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  min-height: 88px;
  min-width: 240px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.btn.primary {
  background: linear-gradient(135deg, #003a4a, #002233);
  color: var(--accent);
}

.btn.small {
  min-height: 76px;
  min-width: 0;
  padding: 12px 14px;
  font-size: 19px;
  letter-spacing: 2px;
}

/* Game */
.hud {
  display: flex;
  justify-content: space-around;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  margin-bottom: 22px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 3px;
}

.hud-val {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hud-val.accent2 { color: var(--accent-secondary); }

.slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.slot {
  height: 84px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-bottom: 4px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 800;
  color: var(--text-primary);
}

.slot.active {
  border-bottom-color: var(--accent);
  background: var(--bg-tertiary);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.tile {
  height: 84px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 800;
  color: var(--text-primary);
}

.tile.used {
  opacity: 0.25;
  color: var(--text-muted);
  background: var(--bg-secondary);
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: auto;
}

/* Flash */
.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.flash.ok {
  background: radial-gradient(ellipse at center, rgba(0, 255, 136, 0.22), transparent 70%);
  opacity: 1;
}

.flash.bad {
  background: radial-gradient(ellipse at center, rgba(255, 68, 102, 0.25), transparent 70%);
  opacity: 1;
}

/* Result */
.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.score-display {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 28px 72px;
  text-align: center;
  margin-bottom: 12px;
}

.score-label {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.score-big {
  font-size: 96px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-sub {
  margin-top: 14px;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text-secondary);
}

.score-sub span {
  color: var(--accent-secondary);
  font-weight: 700;
  margin-left: 6px;
}
