/* Bricks: bright bricks over a night-blue field. */

:root {
  --field: #1b2440;
  --b0: #e5483b;
  --b1: #f28a2e;
  --b2: #f2c230;
  --b3: #2fb36a;
  --b4: #2f7de0;
  --b5: #9a5ad8;
  --paddle: #c9d3e6;
  --paddle-hi: #ffffff;
  --ball: #ffffff;
}
:root[data-theme='hallows'] {
  --field: #140e24;
  --b0: #d8402c;
  --b1: #f08a24;
  --b2: #e8b04a;
  --b3: #8fd16a;
  --b4: #8a9fe0;
  --b5: #b07ae0;
  --paddle: #e8b04a;
  --paddle-hi: #ffe29a;
  --ball: #ffe29a;
}
:root[data-theme='hallows'] .hw-candle {
  display: none;
}
body {
  min-height: var(--app-height);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
#announce {
  margin: 0;
  top: 0;
}
.app {
  display: flex;
  flex-direction: column;
  height: calc(var(--app-height) - var(--safe-top) - var(--safe-bottom));
  min-height: 520px;
  max-width: 520px;
  margin: 0 auto;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 6px;
}
.title-btn {
  appearance: none;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 12px;
  color: var(--text);
  min-width: 0;
}
.title-btn:hover {
  background: var(--accent-soft);
}
.title-main {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.title-main::after {
  content: ' ▾';
  font-size: 0.7em;
  color: var(--text-muted);
}
.title-sub {
  display: block;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}
.score {
  display: flex;
  gap: 8px;
}
.chip {
  min-width: 64px;
  text-align: center;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.chip small {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.chip b {
  display: block;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.stage {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#canvas {
  border-radius: 14px;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.45);
}
.overlay {
  position: absolute;
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 14px 20px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-lg);
  text-align: center;
  pointer-events: none;
}
.overlay[hidden] {
  display: none;
}
.overlay b {
  font-size: 1.3rem;
}
.overlay small {
  color: var(--text-muted);
  font-weight: 600;
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 44px);
  justify-content: center;
  gap: 4px;
}
.pad[hidden] {
  display: none;
}
.pad button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  touch-action: none;
}
.pad [data-dir='up'] { grid-area: 1 / 2; }
.pad [data-dir='left'] { grid-area: 2 / 1; }
.pad [data-dir='right'] { grid-area: 2 / 3; }
.pad [data-dir='down'] { grid-area: 3 / 2; }
.small {
  font-size: 0.85rem;
}
.toolbar {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px 10px;
}
.tool {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
  min-height: 50px;
  padding: 6px 8px;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.tool:hover:not(:disabled) {
  background: var(--accent-soft);
}
.tool:disabled {
  opacity: 0.38;
}

.title {
  display: flex;
  flex-direction: column;
}
.chip.lives b {
  color: var(--danger);
  font-size: 1rem;
  letter-spacing: 1px;
}
.score {
  gap: 6px;
}
.title .title-main::after {
  content: none;
}
