:root {
  --bg1: #121834;
  --bg2: #070a14;
  --panel: rgba(19, 25, 46, 0.92);
  --border: #2b3560;
  --border-hi: #4a5da8;
  --text: #e8ecf8;
  --muted: #8593bd;
  --accent: #ffd23f;
}

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

html, body { overscroll-behavior: none; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1100px 750px at 50% 18%, var(--bg1), var(--bg2));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }

.panel { display: flex; flex-direction: column; gap: 14px; width: 186px; }

.box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--muted);
  margin-bottom: 8px;
}

canvas { display: block; margin: 0 auto; }

.value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin: 7px 0;
  cursor: pointer;
  user-select: none;
}

.opt input { accent-color: var(--accent); width: 15px; height: 15px; }

.lvl { margin-top: 8px; font-size: 12px; color: var(--muted); }
.lvl span { display: block; margin-bottom: 6px; }

select, button {
  width: 100%;
  background: #1b2342;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

button { margin-top: 8px; }
select:hover, button:hover { border-color: var(--border-hi); background: #202a52; }

.keys div { font-size: 12px; color: var(--muted); margin: 6px 0; }

kbd {
  background: #232c52;
  border: 1px solid #3a4780;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  color: #cdd6f4;
  white-space: nowrap;
}

main { display: flex; flex-direction: column; align-items: center; }

h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 12px;
  margin: 2px 0 14px 12px;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(255, 210, 63, 0.35);
}

.board-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 0 45px rgba(80, 120, 255, 0.14), 0 12px 32px rgba(0, 0, 0, 0.55);
}

#board { display: block; background: #0a0e1c; }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 20, 0.84);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  cursor: pointer;
}

.overlay.hidden { display: none; }

.ov-title { font-size: 28px; font-weight: 800; letter-spacing: 8px; }
.ov-sub { color: var(--muted); font-size: 14px; line-height: 1.7; }
.ov-hint { margin-top: 12px; font-size: 14px; color: var(--accent); }

.blink { animation: blink 1.3s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.seed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.seed-input {
  width: 200px;
  background: #10162e;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  padding: 8px 10px;
  outline: none;
}

.seed-input:focus { border-color: var(--border-hi); box-shadow: 0 0 0 2px rgba(74, 93, 168, 0.35); }
.seed-input::placeholder { letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; }

.seed-dice {
  width: auto;
  margin: 0;
  padding: 7px 10px;
  font-size: 15px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

.seed-value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--text);
}

.touch-controls { display: none; gap: 5px; align-items: center; padding: 6px; }
.touch-controls .tc {
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  border-radius: 12px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board-wrap, main { touch-action: none; }

@media (max-width: 860px) {
  body {
    position: fixed;
    inset: 0;
    padding: 6px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }

  .app {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    height: 100%;
  }

  .panel.right { order: 1; }
  main { order: 2; }
  .panel.left { order: 3; }

  .panel.right {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    gap: 6px;
  }

  .panel.left {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px;
    width: 100%;
  }

  .box.hold-box { grid-column: 1; grid-row: 1; }
  .touch-controls { grid-column: 2; grid-row: 1; }
  .box.settings { grid-column: 1 / -1; grid-row: 2; }

  main h1 { display: none; }
  main { width: 100%; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }

  .box { padding: 6px 8px; border-radius: 10px; }
  .label { font-size: 9px; letter-spacing: 1.1px; margin-bottom: 3px; }

  .panel.right .box.stat { flex: 1 1 0; min-width: 56px; }
  .panel.right .box.stat .value { font-size: 15px; }
  .box.stat-high { display: none; }

  .box.keys { display: none; }

  .touch-controls { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; }

  .box.hold-box { display: flex; flex-direction: column; justify-content: center; touch-action: none; }
  .box.hold-box .label { margin-bottom: 2px; }

  .box.settings { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 14px; row-gap: 8px; }
  .box.settings .label { display: none; }
  .box.settings .opt { margin: 0; font-size: 13px; gap: 7px; min-height: 26px; }
  .box.settings .opt input { width: 19px; height: 19px; }
  .box.settings .lvl { margin-top: 0; display: flex; align-items: center; gap: 7px; font-size: 12px; }
  .box.settings .lvl span { margin-bottom: 0; }
  .box.settings select { width: auto; margin-top: 0; padding: 6px 12px; font-size: 13px; border-radius: 8px; }
  .box.settings kbd { display: none; }
  #pauseBtn, #restartBtn { width: auto; margin-top: 0; padding: 8px 16px; font-size: 13px; border-radius: 8px; }

  .ov-title { font-size: 20px; letter-spacing: 5px; }
  .ov-sub { font-size: 12px; }
  .ov-hint { font-size: 12px; }
}

