:root {
  --bg: #0c0e12;
  --paper: #d4c6a8;
  --muted: #8a8070;
  --btn: #cfc3a6;
  --btn-text: #14120e;
  --card: #16181e;
  --line: rgba(180, 168, 140, 0.28);
  --accent: #8a2018;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  color: var(--paper);
  font-family: "DotGothic16", "Hiragino Sans", monospace;
  font-synthesis: none;
  -webkit-font-smoothing: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

#mute-btn {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  right: 8px;
  z-index: 5;
  width: 112px;
  min-width: 112px;
  min-height: 48px;
  padding: 0 6px;
  background: rgba(10, 12, 16, 0.88);
  color: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(160, 150, 130, 0.38);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#mute-btn[aria-pressed="true"] {
  color: var(--accent);
}

#hud {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  left: 8px;
  right: 128px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
  pointer-events: none;
}

.hud-cell {
  padding: 6px 4px 7px;
  background: rgba(10, 12, 16, 0.84);
  box-shadow: inset 0 0 0 2px rgba(160, 150, 130, 0.38);
  text-align: center;
}

.hud-cell small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.hud-cell b {
  display: block;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 22px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(8, 10, 14, 0.94) 0%, rgba(8, 10, 14, 0.55) 46%, transparent 78%);
}

.screen.pick {
  justify-content: center;
  background: rgba(8, 10, 14, 0.78);
}

.pick-lv {
  margin: 0 0 10px;
  color: var(--paper);
  font-size: clamp(48px, 16vw, 72px);
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}

.screen.pick h2 {
  margin: 0 0 18px;
  font-size: clamp(16px, 4.6vw, 22px);
  letter-spacing: 0.18em;
}

h1,
h2 {
  margin: 0 0 14px;
  font-weight: 400;
  font-size: clamp(26px, 7.4vw, 36px);
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.kicker,
.rule,
.fine,
.build {
  color: var(--muted);
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.28em;
}

.rule {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 1.8;
}

.fine {
  margin: 16px 0 0;
  font-size: 12px;
}

.build {
  margin: 0 0 22px;
  min-height: 1.4em;
  font-size: 13px;
  letter-spacing: 0.08em;
  line-height: 1.6;
}

button {
  appearance: none;
  border: 0;
  border-radius: 0;
  min-height: 52px;
  padding: 0 20px;
  background: var(--btn);
  color: var(--btn-text);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
}

button.ghost {
  background: transparent;
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}

.lang-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
}

.lang-toggle button {
  min-height: 40px;
  padding: 0 12px;
  background: transparent;
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.lang-toggle button.on {
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: none;
}

html[lang="en"] h1 {
  letter-spacing: 0.06em;
}

#result-card-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
}

#result-card {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 22vh;
  object-fit: contain;
  image-rendering: pixelated;
  background: #0c0e12;
  box-shadow: 0 0 0 2px rgba(160, 150, 130, 0.38);
  pointer-events: auto;
  touch-action: auto;
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.actions {
  display: grid;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin: 0 0 16px;
}

.stats div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

dt {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
}

dd {
  margin: 0;
  font-size: 15px;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 96px;
  padding: 14px;
  border: 0;
  border-radius: 0;
  background: var(--card);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  letter-spacing: 0.04em;
}

b,
strong {
  font-weight: 400;
}

.card b {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.card em {
  margin-top: auto;
  padding-top: 8px;
  color: var(--paper);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.1em;
}

[hidden] {
  display: none !important;
}
