/* Base: colours, the page, the main menu, glyphs and their tooltips */

/* Colour palette: dark forest and stone ruins */
:root {
  --forest-darkest: #0c130e;
  --forest-dark: #16211a;
  --forest: #24342a;
  --moss: #56663f;
  --stone-dark: #5f5a4c;
  --stone: #8f8771;
  --stone-light: #cfc6ab;
  --sunlight: #d9b65c;

  /* Notebook tab stickers */
  --sticker-1: #8a9a5b;
  --sticker-2: #c99a4e;
  --sticker-3: #a8604a;
  --sticker-4: #6f8a96;
  --sticker-5: #8e7391;

  /* Speech bubbles */
  --bubble-spirit: #1f2b23;
  --bubble-spirit-border: #3d4a3f;
  --bubble-player: #2a2c20;
  --bubble-player-border: #6b5d36;

  /* Glyph categories (reply vocabulary) */
  --cat-actions: #8a9a5b;
  --cat-people: #c99a4e;
  --cat-time: #7f9aa3;
  --cat-feelings: #b8735c;
  --cat-nature: #6e9478;
  --cat-quantities: #9a87ad;
  --cat-grammar: #a3998a;

  --font-main: "Cormorant Garamond", Georgia, serif;
  --font-handwriting: "Caveat", "Segoe Print", cursive;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--forest-darkest);
  color: var(--stone-light);
}

/* Main menu */
.main-menu {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 16px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 35%, var(--forest) 0%, var(--forest-dark) 45%, var(--forest-darkest) 100%);
}

.game-title {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--stone-light);
  text-shadow: 0 0 24px rgba(217, 182, 92, 0.25);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(260px, 100%);
}

.menu-buttons button {
  font: inherit;
  font-size: 1.4rem;
  padding: 10px 20px;
  color: var(--stone-light);
  background: rgba(95, 90, 76, 0.25);
  border: 1px solid var(--stone-dark);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.menu-buttons button:hover,
.menu-buttons button:focus-visible {
  background: rgba(86, 102, 63, 0.45);
  border-color: var(--sunlight);
  color: #f1e8cf;
  outline: none;
}

.menu-buttons button:disabled {
  opacity: 0.4;
  cursor: default;
  background: transparent;
  border-color: var(--stone-dark);
  color: var(--stone);
}

[hidden] {
  display: none !important;
}

/* Placeholder for a missing asset: a plain box with its name */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  color: var(--stone-light);
  background: var(--forest-dark);
  border: 1px dashed var(--stone);
}

/* A glyph: its drawing (see .glyph-image), or until it's drawn, its word in small capitals.
   No circle around either: their states (hover, gold, category, notebook ink) show on the glyph itself. */
.glyph {
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  padding: 0;
  font-family: inherit;
  font-variant-caps: all-small-caps;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--stone-light);
  background: none;
}

/* The placeholder word shrinks with its length so it always fits its box,
   whatever the box's size (cqi = % of the box's width) */
.glyph {
  container-type: inline-size;
}

/* Names (cartouches) keep their own size; word glyphs are a little bigger */
.glyph.name-cartouche {
  width: 72px;
  height: 72px;
}

.glyph-word {
  font-size: min(1em, calc(190cqi / var(--length)));
  white-space: nowrap;
}

.glyph-with-meaning .glyph {
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

/* Hover: grows slightly (and glows, see the drawn glyphs and placeholder words below) */
.glyph-with-meaning .glyph:hover,
.glyph-with-meaning .glyph:focus-visible {
  transform: scale(1.08);
  outline: none;
}

/* Click: pressed in */
.glyph-with-meaning .glyph:active {
  transform: scale(0.94);
  transition-duration: 0.08s;
}

.notebook .glyph {
  cursor: default;
}

/* Glyph meaning: handwriting while it's the player's guess, print once confirmed */
.glyph-meaning {
  width: 8em;
  padding: 0 4px;
  text-align: center;
  font-family: var(--font-handwriting);
  font-size: 1.4rem;
  color: inherit;
  background: transparent;
  border: none;
}

.glyph-meaning:focus {
  outline: none;
}

.glyph-meaning.is-confirmed {
  font-family: var(--font-main);
  font-size: 1.2rem;
}
