* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #0c0a12;
  color: #e4dfee;
}

body {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.75;
}

.hidden {
  display: none !important;
}

/* —— Name gate —— */
.nameGate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

.title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tag {
  margin: 0 0 2rem;
  color: #9a92b0;
  font-size: 1rem;
  max-width: 22rem;
}

.gateForm {
  width: 100%;
  max-width: 20rem;
  text-align: left;
}

.gateForm label {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8a849e;
  margin-bottom: 0.4rem;
}

.gateForm input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: 1px solid #3a3550;
  background: #16131f;
  color: #f5f2ff;
  font-size: 1rem;
}

.gateForm button {
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 6px;
  background: #e8e4f4;
  color: #120c18;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.gateForm button:hover {
  background: #fff;
}

.gateError {
  margin: 1rem 0 0;
  min-height: 1.25em;
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
  color: #ff9a8a;
}

/* —— Story —— */
.taleRoot {
  min-height: 100vh;
  max-width: 34rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 10rem;
  cursor: pointer;
  outline: none;
}

.taleRoot:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.15);
  outline-offset: 4px;
}

.taleRoot--done {
  cursor: default;
}

.taleText p {
  margin: 0 0 1.25rem;
}

.taleText p:last-child {
  margin-bottom: 0;
}

.taleHint {
  margin: 2.5rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6a6578;
}

.taleRoot--done .taleHint {
  display: none;
}

/* —— Level dialog —— */
dialog.miniGameDialog {
  margin: auto;
  padding: 1rem 1rem 1.25rem;
  max-width: min(96vw, 780px);
  width: 100%;
  border: 1px solid #2a2438;
  border-radius: 8px;
  background: #12101a;
  color: #e8e4f4;
}

dialog.miniGameDialog::backdrop {
  background: rgba(4, 2, 8, 0.92);
}

.miniGameDialog h3 {
  margin: 0 0 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8a0c0;
}

.miniGameInstructions {
  margin: 0 0 0.75rem;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: #7a7490;
  line-height: 1.45;
}

.miniGameRoot {
  display: flex;
  justify-content: center;
}

.miniGameRoot canvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid #2a2438;
  border-radius: 4px;
}

.dialogClose {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #3a3550;
  border-radius: 6px;
  background: transparent;
  color: #9a94b0;
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
}

.dialogClose:hover {
  color: #e4dfee;
  border-color: #5a5470;
}

.miniGameFeedback {
  min-height: 1.1em;
  margin: 0.5rem 0 0;
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  color: #7cf0c8;
}

/* —— Scoreboard strip —— */
.scoreStrip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid #2a2438;
  background: linear-gradient(180deg, rgba(12, 10, 18, 0.92), #0c0a12);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.72rem;
}

.scoreStripTitle {
  margin: 0 0 0.4rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #7a7490;
}

.scoreStripBody {
  max-width: 42rem;
  margin: 0 auto;
}

.scoreRow {
  display: grid;
  grid-template-columns: 1.25rem 1fr 3.5rem 3.5rem 3.25rem;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  padding: 0.2rem 0;
  color: #b8b0d0;
  border-bottom: 1px solid rgba(42, 36, 56, 0.5);
}

.scoreRow:last-child {
  border-bottom: none;
}

.scoreHead {
  color: #6a6578;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.62rem;
  border-bottom-color: #3a3550;
}

.scoreYou {
  color: #e8e4f4;
}

.scoreYou .scoreName {
  color: #c8f0e0;
}

.scoreN,
.scoreTot {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.scoreTot {
  color: #9cf0c8;
}

.scoreEmpty {
  margin: 0;
  color: #6a6578;
  font-size: 0.72rem;
}
