:root {
  --paper: #FAF6EC;
  --paper-2: #F1EADA;
  --ink: #26314A;
  --teal: #2F6F76;
  --teal-dark: #204E53;
  --gold: #DDA33D;
  --brick: #C1533D;
  --slate: #C9C1AE;
  --correct: #4CAF6D;
  --present: #E8C13D;
  --absent-bg: #FFFFFF;
  --absent-border: #C9C1AE;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Atkinson Hyperlegible', sans-serif;
}

#app { min-height: 100vh; }

.display { font-family: 'Fredoka', sans-serif; }

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  position: relative;
}

.card {
  background: white;
  border-radius: 1.25rem;
  box-shadow: 0 8px 24px rgba(38, 49, 74, 0.10);
  padding: 2rem;
  width: 100%;
  max-width: 26rem;
  text-align: center;
}

.btn {
  border: none;
  border-radius: 0.75rem;
  padding: 0.9rem 1.25rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  color: white;
  background: var(--teal);
  cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.gold { background: var(--gold); }
.btn.ghost { background: transparent; color: var(--ink); opacity: 0.6; }
.btn.pill { border-radius: 999px; padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

input, select, textarea {
  font-family: 'Atkinson Hyperlegible', sans-serif;
  border: 1px solid var(--slate);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 1px;
}

.back-link {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  opacity: 0.5;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink);
}
.back-link:hover { opacity: 0.9; }

.profile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  max-width: 40rem;
}
.profile-card {
  background: white;
  border-radius: 1.25rem;
  box-shadow: 0 8px 24px rgba(38, 49, 74, 0.10);
  padding: 2rem;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.avatar {
  width: 4rem; height: 4rem;
  border-radius: 999px;
  background: var(--gold);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-row { display: flex; justify-content: center; gap: 2rem; margin: 1.5rem 0; }
.stat-num { font-size: 1.75rem; }
.stat-label { font-size: 0.75rem; opacity: 0.5; }

.level-toggle { display: flex; gap: 0.5rem; justify-content: center; margin: 1rem 0; }
.level-toggle button {
  border: none; border-radius: 999px; padding: 0.5rem 1rem;
  font-family: 'Fredoka', sans-serif; cursor: pointer;
  background: var(--paper-2); color: var(--ink);
}
.level-toggle button.active { background: var(--teal); color: white; }

.speak-btn {
  margin: 0 auto 1.5rem;
  width: 3.5rem; height: 3.5rem;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

.tile-row {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin-bottom: 0.5rem;
}
.tile {
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif;
  text-transform: uppercase;
  color: white;
  flex: none;
  animation: flipIn 0.35s ease forwards;
}
.tile.absent { background: var(--absent-bg); color: var(--ink); border: 2px solid var(--absent-border); }
.tile.present { background: var(--present); }
.tile.correct { background: var(--correct); }

@keyframes flipIn {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { animation: none; }
}

.word-input {
  width: 100%;
  text-align: center;
  font-size: 1.4rem;
  font-family: 'Fredoka', sans-serif;
  padding: 0.7rem;
  border-width: 2px;
  letter-spacing: 0.04em;
}

.admin-tabs { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; }
.admin-tabs button {
  border: none; border-radius: 999px; padding: 0.5rem 1rem;
  font-family: 'Fredoka', sans-serif; cursor: pointer;
  background: var(--paper-2); color: var(--ink);
}
.admin-tabs button.active { background: var(--teal); color: white; }

.panel {
  background: white; border-radius: 1rem; padding: 1rem 1.25rem;
  box-shadow: 0 4px 16px rgba(38, 49, 74, 0.08);
  margin-bottom: 1.5rem;
}

.word-row {
  background: white; border-radius: 0.6rem; padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.word-row .word-name { font-family: 'Fredoka', sans-serif; font-weight: 600; flex: 1 1 100px; }
.word-row .word-clue { opacity: 0.6; font-size: 0.9rem; flex: 2 1 200px; }
.word-row .word-pronounce { font-size: 0.75rem; opacity: 0.4; font-style: italic; }

.icon-btn {
  border: none; background: none; opacity: 0.4; cursor: pointer; padding: 0.25rem;
}
.icon-btn:hover { opacity: 1; }

.admin-header {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 48rem; width: 100%; margin: 0 auto 1.5rem;
}

.admin-body { max-width: 48rem; width: 100%; margin: 0 auto; }

.field-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.field-row input, .field-row select { flex: 1 1 140px; }

.section-heading {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}

textarea.bulk-paste { width: 100%; min-height: 8rem; font-size: 0.85rem; }

.error-text { color: var(--brick); font-size: 0.9rem; margin-bottom: 0.75rem; }
.muted { opacity: 0.6; font-size: 0.85rem; }
.small-muted { opacity: 0.5; font-size: 0.75rem; }
