:root {
  color-scheme: dark;
  --bg: #0c111a;
  --panel: #151d2b;
  --line: #2a3650;
  --text: #e8edf6;
  --muted: #a3b0c7;
  --accent: #ffb84a;
  --gem: #4cc9f5;
  --ok: #3fe0b5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

main,
header,
footer {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  padding-top: 20px;
}

h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--accent);
}

h2 {
  margin: 28px 0 8px;
  font-size: 1.2rem;
}

p {
  margin: 8px 0;
}

a {
  color: var(--gem);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.tagline {
  color: var(--muted);
}

.notice {
  margin: 14px 0;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 6px;
  padding: 0;
  list-style: none;
}

.hud li {
  padding: 6px 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.hud .label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hud .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.best {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.board-wrap {
  margin: 10px auto;
  padding: 8px;
  max-width: 496px;
  background: #111824;
  border: 2px solid var(--line);
  border-radius: 14px;
}

#board {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  touch-action: none;
}

.message {
  min-height: 3em;
  margin: 8px 0;
  text-align: center;
  font-weight: 600;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #20140a;
  font-weight: 700;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 10px 0;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(2, 54px);
  gap: 6px;
}

.dpad button {
  padding: 0;
  font-size: 1.4rem;
}

#btn-up {
  grid-column: 2;
  grid-row: 1;
}

#btn-left {
  grid-column: 1;
  grid-row: 2;
}

#btn-down {
  grid-column: 2;
  grid-row: 2;
}

#btn-right {
  grid-column: 3;
  grid-row: 2;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
}

.level-list {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.level-button {
  padding: 8px 0;
  font-variant-numeric: tabular-nums;
}

.level-button.solved {
  border-color: var(--ok);
  color: var(--ok);
}

.level-button.locked {
  color: var(--muted);
  border-style: dashed;
}

.level-button.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #20140a;
  font-weight: 700;
}

.legend {
  color: var(--muted);
  font-size: 0.9rem;
}

.licence-box {
  margin: 14px 0;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.licence-box label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.licence-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.licence-row input {
  flex: 1 1 220px;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.status {
  min-height: 1.5em;
  font-weight: 600;
}

.shot {
  margin: 14px auto 6px;
  padding: 8px;
  max-width: 368px;
  background: #111824;
  border: 2px solid var(--line);
  border-radius: 14px;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.cta-row {
  margin: 18px 0;
  text-align: center;
}

a.cta {
  display: inline-block;
  padding: 12px 24px;
  background: var(--accent);
  border-radius: 10px;
  color: #20140a;
  font-weight: 700;
  text-decoration: none;
}

a.cta:hover {
  background: #ffc76e;
}

.steps {
  margin: 8px 0;
  padding-left: 1.4em;
}

.steps li {
  margin: 6px 0;
}

footer {
  margin-top: 36px;
  padding-top: 14px;
  padding-bottom: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 420px) {
  .level-list {
    grid-template-columns: repeat(6, 1fr);
  }

  .hud {
    grid-template-columns: repeat(2, 1fr);
  }
}
