@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
  background: #1a1a1a;
  font-family: 'Press Start 2P', monospace;
  touch-action: none;
  user-select: none;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  display: flex;
}

.hidden { display: none !important; }

.sidebar {
  width: 200px;
  min-width: 200px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #111;
  border-right: 1px solid #1a1a1a;
  flex-shrink: 0;
  overflow: hidden;
}

.sb-top {
  padding: 16px 16px 12px;
  border-bottom: 1px solid #1a1a1a;
}

.brand {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  letter-spacing: 4px;
}

.user-label {
  display: block;
  font-size: 6px;
  color: #444;
  margin-top: 6px;
  cursor: pointer;
  letter-spacing: 1px;
}

.user-label:hover { color: #888; }

.sb-section {
  padding: 10px 16px;
  border-bottom: 1px solid #1a1a1a;
}

.sb-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.stat {
  font-size: 7px;
  color: #555;
}

.stat b { color: #aaa; font-weight: 400; }

.sizes { display: flex; gap: 3px; }

.toggles { display: flex; gap: 3px; flex-wrap: wrap; }

button, input {
  background: none;
  border: 1px solid #262626;
  color: #555;
  padding: 5px 9px;
  font-size: 7px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

button:hover { color: #bbb; border-color: #444; }
button.on { color: #eee; border-color: #444; }

.action-btn {
  flex: 1;
  padding: 5px 6px;
  border-color: #333;
  color: #777;
  letter-spacing: 1px;
  text-align: center;
  font-size: 8px;
}

.action-btn:hover { color: #eee; border-color: #555; }

.seed-row {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.seed-label {
  font-size: 7px;
  color: #666;
  padding: 4px 8px;
  border: 1px solid #262626;
  cursor: pointer;
  flex-shrink: 0;
}

.seed-label:hover { color: #bbb; border-color: #444; }

.seed-input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  color: #666;
  font-size: 7px;
}

.seed-input:focus { color: #eee; border-color: #444; }
.seed-input::placeholder { color: #333; }

.sb-history {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 6px;
}

.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-track { background: #111; }
.history-list::-webkit-scrollbar-thumb { background: #262626; }

.history-item {
  padding: 5px 7px;
  border: 1px solid #1a1a1a;
  cursor: pointer;
  color: #555;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.history-item:hover { border-color: #333; color: #888; }

.history-item .h-seed { color: #666; }
.history-item .h-seed.won { color: #3a8; }
.history-item .h-seed.bad { color: #a55; }
.history-item .h-stats { color: #333; }

.history-empty { color: #333; font-size: 6px; padding: 8px 0; }

.sb-bottom {
  padding: 10px 16px;
  border-top: 1px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 6px;
  color: #444;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
}

.legend i.p { background: #cc4444; border-radius: 50%; }
.legend i.g { background: #1a2a1a; border: 1px solid #3a8; }
.legend i.s { background: none; border: 1px solid #3a8; }

.controls {
  display: flex;
  align-items: center;
  gap: 2px;
  color: #333;
}

.controls kbd {
  background: none;
  padding: 0 2px;
  color: #444;
  border: none;
  font-family: inherit;
  font-size: 6px;
}

.controls span {
  margin-left: 2px;
  color: #333;
}

.board {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  position: relative;
  min-width: 0;
}

canvas {
  display: block;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 10;
}

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

.overlay h2 {
  font-size: 30px;
  color: #eee;
  font-weight: 700;
  letter-spacing: 6px;
}

.overlay .result {
  font-size: 12px;
  color: #888;
  margin-top: 10px;
}

.overlay .best {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

.overlay .verified {
  font-size: 10px;
  margin-top: 8px;
}

.overlay .verified.ok { color: #888; }
.overlay .verified.bad { color: #aa5555; }

.overlay button {
  margin-top: 24px;
  border-color: #444;
  color: #aaa;
  padding: 10px 32px;
  font-size: 10px;
  letter-spacing: 1px;
}

.overlay button:hover { color: #eee; border-color: #666; }

.leaderboard {
  position: absolute;
  inset: 0;
  background: #111;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 12;
}

.leaderboard.show { opacity: 1; pointer-events: auto; }

.lb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #1a1a1a;
}

.lb-header h2 {
  font-size: 10px;
  color: #999;
  letter-spacing: 3px;
}

.lb-header button {
  font-size: 8px;
  border: 1px solid #262626;
  color: #666;
  padding: 5px 14px;
  letter-spacing: 1px;
}

.lb-header button:hover { color: #eee; border-color: #444; }

.lb-filters {
  display: flex;
  gap: 3px;
  padding: 12px 20px;
  border-bottom: 1px solid #1a1a1a;
}

.lb-filter {
  font-size: 7px;
  padding: 5px 10px;
  border: 1px solid #262626;
  color: #555;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.lb-filter:hover { color: #999; border-color: #444; }
.lb-filter.on { color: #eee; border-color: #444; }

.lb-status {
  font-size: 7px;
  color: #444;
  padding: 10px 20px 8px;
}

.lb-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.lb-table-wrap::-webkit-scrollbar { width: 3px; }
.lb-table-wrap::-webkit-scrollbar-track { background: #111; }
.lb-table-wrap::-webkit-scrollbar-thumb { background: #262626; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7px;
}

.lb-table th {
  text-align: left;
  color: #444;
  font-weight: 400;
  padding: 8px 8px;
  border-bottom: 1px solid #1a1a1a;
  position: sticky;
  top: 0;
  background: #111;
}

.lb-table td {
  padding: 7px 8px;
  color: #555;
  border-bottom: 1px solid #1a1a1a;
}

.lb-table tr:hover td { color: #888; }

.lb-table .lb-rank { color: #333; width: 30px; text-align: center; }
.lb-table .lb-rank.top { font-size: 7px; }

.crown-img { display: inline-block; vertical-align: middle; height: 14px; width: auto; image-rendering: pixelated; }

.lb-table tr:nth-child(1) .lb-rank { color: #cc9933; }
.lb-table tr:nth-child(2) .lb-rank { color: #999; }
.lb-table tr:nth-child(3) .lb-rank { color: #996633; }

.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 11;
}

.confetti {
  position: absolute;
  top: -10px;
  opacity: 0;
}

#timerWrap.urgent b { color: #cc6666; }

@media (max-width: 600px) {
  .sidebar {
    width: 150px;
    min-width: 150px;
  }
  .sb-top, .sb-section, .sb-bottom { padding-left: 12px; padding-right: 12px; }
  .brand { font-size: 9px; letter-spacing: 3px; }
  .stat { font-size: 6px; }
  button, input { font-size: 6px; padding: 4px 7px; }
  .board { padding: 16px; }
  .overlay h2 { font-size: 18px; letter-spacing: 4px; }
}
