/* ── Design tokens ── */
:root {
  --bg:          #f5f2ed;
  --tile-bg:     #faf8f5;
  --border:      #e8e0d5;
  --text-muted:  #b8a898;
  --text-sec:    #8a7a6a;
  --text-body:   #4a3f35;
  --text-head:   #2a2420;
  --success:     #7a9e7e;
  --shadow-sm:   0 2px 12px rgba(80,60,40,0.10), 0 1px 3px rgba(80,60,40,0.06);
  --shadow-md:   0 8px 24px rgba(80,60,40,0.13);
  --radius:      14px;
  --transition:  0.15s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* ── Site header ── */
.site-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.site-name {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--text-head);
}

.site-tagline {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ── Puzzle tile ── */
.tile {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: var(--radius);
  background: var(--tile-bg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  user-select: none;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.tile:active { transform: scale(0.95); }

.tile.shake {
  animation: shake 0.45s ease;
}

.tile.correct {
  background: #f0f7f0;
  box-shadow: 0 0 0 3px var(--success), var(--shadow-md);
  cursor: default;
}

/* ── Puzzle section ── */
.puzzle-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Stage ── */
.stage {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Clue card ── */
.clue-card {
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile-bg);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  user-select: none;
  pointer-events: none;
}

.clue-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

/* ── Ambient clue (number/text among tiles) ── */
.ambient-clue {
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
  padding: 0 0.3rem;
  user-select: none;
  pointer-events: none;
  align-self: center;
}

/* ── Feedback ── */
.feedback {
  margin-top: 1.8rem;
  font-size: 0.92rem;
  color: var(--text-sec);
  font-style: italic;
  min-height: 1.4em;
  text-align: center;
  max-width: 360px;
}

/* ── Reveal ── */
.reveal {
  margin-top: 2.5rem;
  max-width: 420px;
  text-align: center;
  animation: rise 0.5s ease;
}

.reveal-heading {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-head);
  margin-bottom: 0.75rem;
}

.reveal-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-body);
}

/* ── Buttons ── */
.btn {
  padding: 0.65rem 2rem;
  background: var(--text-head);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--transition);
}

.btn:hover { background: var(--text-body); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.25rem 0.9rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-family: inherit;
  font-style: normal;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn-ghost:hover { border-color: var(--text-sec); color: var(--text-body); }

/* ── Form elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 360px;
}

.form-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sec);
}

.form-input {
  padding: 0.65rem 0.9rem;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-body);
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus { border-color: var(--text-sec); }

.form-error {
  font-size: 0.82rem;
  color: #a05050;
  margin-top: 0.25rem;
}

.form-link {
  font-size: 0.82rem;
  color: var(--text-sec);
  text-decoration: none;
  transition: color var(--transition);
}

.form-link:hover { color: var(--text-body); }

/* ── Auth card ── */
.auth-card {
  background: var(--tile-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.auth-card h2 {
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text-head);
  margin-bottom: 1rem;
}

/* ── Landing page ── */
.landing-message {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-body);
  text-align: center;
  max-width: 400px;
  margin-bottom: 2rem;
}

.landing-proceed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ── Rewind icon ── */
.rewind-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

.rewind-btn:hover { opacity: 1; box-shadow: var(--shadow-md); }

/* ── Scene transition ── */
.scene-enter {
  animation: rise 0.4s ease;
}

/* ── Animations ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utilities ── */
.hidden { display: none; }

/* Feedback space is always reserved so tiles don't shift when it appears */
.feedback.hidden { display: block; visibility: hidden; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
