:root {
  color-scheme: dark;
  --bg: #12100d;
  --panel: #181611;
  --panel-border: #5f563f;
  --text: #eeeeee;
  --muted: #b7a879;
  --green: #8fd36a;
  --yellow: #f1df49;
  --red: #ef7f7f;
  --blue: #78b7df;
  --cyan: #73d7d7;
  --magenta: #df8fe7;
  --shadow: rgba(0, 0, 0, 0.35);
  --battle-target-size: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 30% 20%, rgba(143, 211, 106, 0.12), transparent 30%),
    var(--bg);
  background-size: 100% 4px, auto, auto;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.terminal {
  height: calc(100dvh - 32px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(24, 22, 17, 0.94);
  box-shadow: 0 18px 50px var(--shadow);
  overflow: hidden;
}

.terminal__bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(239, 230, 200, 0.16);
  background: #211e17;
}

.terminal__title {
  margin-left: 8px;
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.bgm-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(239, 230, 200, 0.24);
  border-radius: 6px;
  background: #15130f;
  color: var(--green);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.bgm-toggle:hover,
.bgm-toggle:focus-visible {
  background: #22301d;
  outline: 2px solid rgba(143, 211, 106, 0.35);
  outline-offset: 2px;
}

.bgm-toggle[aria-pressed="false"] {
  color: var(--muted);
  text-decoration: line-through;
}

.lamp {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.lamp--red {
  background: #d46b5f;
}

.lamp--yellow {
  background: #d6b45d;
}

.lamp--green {
  background: #7fb96a;
}

.screen {
  margin: 0;
  padding: 16px 18px;
  overflow: hidden;
  white-space: pre-wrap;
  line-height: 1.42;
  font-size: 14px;
}

.command {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-top: 1px solid rgba(239, 230, 200, 0.16);
  background: #15130f;
}

.command label {
  color: var(--green);
  font-weight: 700;
}

.command input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(239, 230, 200, 0.22);
  border-radius: 6px;
  padding: 11px 12px;
  background: #0f0e0b;
  color: var(--text);
  font: inherit;
}

.command input:focus {
  outline: 2px solid rgba(143, 211, 106, 0.42);
  outline-offset: 2px;
}

.command button {
  border: 1px solid rgba(143, 211, 106, 0.65);
  border-radius: 6px;
  padding: 11px 14px;
  background: #22301d;
  color: var(--green);
  font: inherit;
  cursor: pointer;
}

.command button:hover,
.command button:focus-visible {
  background: #2b3f24;
}

.green {
  color: var(--green);
}

.yellow {
  color: var(--yellow);
}

.red {
  color: var(--red);
}

.blue {
  color: var(--blue);
}

.map-tile {
  font-weight: 700;
}

.map-tile--player {
  color: var(--cyan);
}

.map-tile--heal,
.map-tile--gold {
  color: var(--green);
}

.battle-target-line {
  color: var(--yellow);
  font-size: var(--battle-target-size);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.map-tile--trap {
  color: var(--red);
}

.map-tile--key {
  color: var(--yellow);
}

.map-tile--special {
  color: var(--magenta);
}

.map-tile--item {
  color: var(--blue);
}

@media (max-width: 720px) {
  .shell {
    padding: 10px;
  }

  .terminal {
    height: calc(100dvh - 20px);
  }

  .screen {
    padding: 10px;
    font-size: 11px;
    line-height: 1.28;
  }

  .command {
    grid-template-columns: auto 1fr;
  }

  .command button {
    grid-column: 1 / -1;
  }
}
