:root {
  --clawd: #d97757;
  --fg: #f4f1ea;
  --muted: #9a958c;
  --panel: rgba(0, 0, 0, 0.86);
  font-family: "Courier New", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--fg);
  overflow: hidden;
}

#app {
  height: 100%;
  display: grid;
  place-items: center;
}

#stage {
  position: relative;
  aspect-ratio: 672 / 864;
  height: min(100vh, calc(100vw * 864 / 672));
  max-width: 100vw;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  image-rendering: pixelated;
}

.toolbar {
  position: absolute;
  bottom: 1%;
  left: 50%;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.toolbar button {
  width: 34px;
  height: 30px;
  padding: 0;
  font-size: 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
}

.toolbar button:hover,
.toolbar button:focus-visible { color: var(--fg); border-color: var(--clawd); }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  text-align: center;
}

.overlay[hidden] { display: none; }

h1 {
  margin: 0;
  font-size: clamp(32px, 7vh, 56px);
  letter-spacing: 4px;
  color: var(--clawd);
  text-shadow: 3px 3px 0 #7a3a24;
}

h1 span { color: #ffff00; text-shadow: none; }

h2 { margin: 0; font-size: clamp(22px, 4vh, 34px); color: #ffff00; }
h2.red { color: #ff3030; }

.subtitle { margin: 0; color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.hint strong { color: var(--fg); }

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: min(300px, 80%);
}

.menu button,
#name-form button {
  font: inherit;
  font-size: 18px;
  font-weight: bold;
  padding: 10px 18px;
  color: var(--fg);
  background: #111;
  border: 2px solid #2121de;
  border-radius: 6px;
  cursor: pointer;
}

.menu button:hover,
.menu button:focus-visible,
#name-form button:hover,
#name-form button:focus-visible {
  border-color: var(--clawd);
  color: var(--clawd);
  outline: none;
}

#btn-continue { border-color: var(--clawd); }
#btn-difficulty.hard { border-color: #ff3030; color: #ff3030; }
td.hard { color: #ff3030; }

#name-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

#name-form label { width: 100%; color: #ffff00; }

#name-input {
  font: inherit;
  font-size: 20px;
  width: 9em;
  padding: 8px;
  text-align: center;
  text-transform: uppercase;
  color: var(--fg);
  background: #000;
  border: 2px solid var(--clawd);
  border-radius: 6px;
}

table { border-collapse: collapse; min-width: 80%; font-size: 16px; }
th, td { padding: 6px 10px; border-bottom: 1px solid #222; }
th { color: var(--muted); font-weight: normal; }
td:nth-child(3) { color: #ffff00; text-align: right; }

.help { text-align: left; line-height: 1.9; padding-left: 1.2em; margin: 0; }

kbd {
  padding: 1px 6px;
  border: 1px solid #555;
  border-radius: 4px;
  background: #1a1a1a;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
