:root {
  --bg: #1a1a1e;
  --fg: #e6e6ea;
  --muted: #9a9aa2;
  --panel: rgba(20, 20, 24, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent: #d3b58a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #0b0b0d;
  color: var(--fg);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, #14141a 0%, #060608 100%);
}

canvas#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0b0b0d;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  max-width: 100vw;
  max-height: 100vh;
}

.hidden { display: none !important; }

/* HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

#clock {
  grid-column: 2;
  grid-row: 1;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 12px;
  color: var(--fg);
  font-size: 14px;
  backdrop-filter: blur(6px);
}
#clock #weekday { color: var(--muted); }

#tasks {
  grid-column: 1;
  grid-row: 1;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 220px;
  max-width: 260px;
  backdrop-filter: blur(6px);
}
#tasks-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
  margin-bottom: 6px;
}
#tasks-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#tasks-list li {
  color: var(--fg);
  opacity: 0.85;
  line-height: 1.4;
}
#tasks-list li.done {
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.55;
}

#hint {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-self: center;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--fg);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}
#hint.hidden { display: none !important; }

/* Dialogue */
#dialogue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, 90%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 18px 22px 14px;
  color: var(--fg);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
#dialogue-name {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
#dialogue-text {
  font-size: 16px;
  line-height: 1.6;
  min-height: 52px;
  white-space: pre-wrap;
}
#dialogue-hint {
  margin-top: 8px;
  text-align: right;
  color: var(--muted);
  font-size: 11px;
}

/* Choices */
#choices {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 90%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 16px;
  backdrop-filter: blur(8px);
}
#choices-title {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
#choices-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#choices-list li {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.12s;
}
#choices-list li:hover,
#choices-list li.selected {
  background: rgba(255, 255, 255, 0.06);
}
#choices-list li .hotkey {
  color: var(--muted);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

/* Title / Pause / About */
#title-screen,
#pause-screen,
#about-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background: radial-gradient(ellipse at center, rgba(20, 20, 26, 0.92) 0%, rgba(6, 6, 10, 0.98) 100%);
  color: var(--fg);
  text-align: center;
  padding: 40px;
}
#title-screen h1 {
  font-size: 56px;
  font-weight: 300;
  letter-spacing: 6px;
  color: var(--accent);
}
#title-screen .subtitle {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
#title-screen .hint,
#about-screen .small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 24px;
}
#about-screen h2,
#pause-screen h2 { font-weight: 400; letter-spacing: 3px; color: var(--accent); }
#about-screen p { max-width: 500px; margin: 6px 0; line-height: 1.6; color: var(--fg); }
#about-screen .small { font-size: 12px; }
#about-screen a { color: var(--accent); }

.menu {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu button {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--fg);
  padding: 12px 32px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.15s, border-color 0.15s;
  min-width: 220px;
}
.menu button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}
.menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.4;
}

/* Memory overlay */
#memory-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(30, 25, 20, 0.6) 0%, rgba(6, 6, 10, 0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 20;
  animation: fadeIn 0.9s ease;
}
#memory-text {
  color: #f4e2c9;
  font-size: 22px;
  font-style: italic;
  text-align: center;
  max-width: 640px;
  line-height: 1.6;
  letter-spacing: 0.4px;
  opacity: 0.9;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.9);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Fade */
#fade {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: 15;
}
#fade.visible { opacity: 1; }
