* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Comic Sans MS", "Chalkboard SE", "Arial Rounded MT Bold",
    "Comic Neue", system-ui, sans-serif;
  background: #fff9f0;
  color: #3d3d3d;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
  width: 100%;
  padding: 0 5vw 4vh;
}

/* ---------- shared focus (TV remotes don't always hit :focus-visible) --- */

.tv-focus {
  position: relative;
}

.tv-focus:focus,
.tv-focus:focus-visible {
  outline: 0.4em solid #ffffff;
  outline-offset: 2px;
  box-shadow:
    0 0 0 0.55em rgba(91, 75, 138, 0.65),
    0 0 2em 0.5em rgba(255, 200, 40, 0.85);
  transform: scale(1.08);
  z-index: 10;
  transition: transform 0.12s ease;
}

/* ---------- header ---------- */

.kid-header {
  text-align: center;
  padding: 2vh 5vw 0;
}

.panda {
  font-size: clamp(2.5rem, 8vh, 5rem);
  line-height: 1;
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.18em);
  }
}

.kid-header h1 {
  margin: 0.2em 0 0;
  font-size: clamp(1.6rem, 4.5vw, 3.4rem);
  color: #5b4b8a;
}

.hint {
  margin: 0.4em 0 0;
  color: #8a7fb8;
  font-size: clamp(0.85rem, 2vw, 1.4rem);
}

.status {
  text-align: center;
  color: #8a7fb8;
  padding: 4vh 0;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
}

/* ---------- sound tiles ---------- */

.tiles {
  display: grid;
  gap: clamp(10px, 1.5vw, 24px);
  margin-top: 2vh;
  grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 22vw, 220px), 1fr));
}

/* Landscape TV / desktop: about six per row */
@media (min-aspect-ratio: 4/3) and (min-width: 700px) {
  .tiles {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Narrow portrait phones */
@media (max-width: 540px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
  .tiles .tile {
    min-height: 0;
    aspect-ratio: 4 / 5;
  }
}

.tile {
  position: relative;
  border: none;
  border-radius: clamp(14px, 2vw, 26px);
  min-height: clamp(150px, 30vh, 320px);
  padding: clamp(8px, 1.2vh, 18px) 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  color: #3d2f5b;
  font-family: inherit;
  box-shadow: 0 0.4vh 0 rgba(0, 0, 0, 0.14);
}

.tile-emoji {
  font-size: clamp(1.7rem, 5vw, 4rem);
  line-height: 1.1;
}

.tile-letter {
  font-size: clamp(2.4rem, 7vw, 6rem);
  font-weight: 800;
  line-height: 1.35;
}

.tile-word--long {
  font-size: clamp(0.6rem, 1.25vw, 1rem) !important;
  white-space: nowrap;
}

.tile-word {
  font-size: clamp(0.75rem, 1.7vw, 1.3rem);
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
  opacity: 0.8;
}

/* ---------- detail panel ---------- */

.detail {
  margin-top: 2.5vh;
  padding: clamp(12px, 2vw, 28px);
  background: #ffffff;
  border-radius: clamp(14px, 2vw, 26px);
  box-shadow: 0 2px 12px rgba(91, 75, 138, 0.18);
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}

.detail-title {
  margin: 0 0 0.6em;
  color: #5b4b8a;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
}

.detail-close {
  border: none;
  border-radius: 12px;
  background: #ece7fb;
  color: #5b4b8a;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(0.9rem, 1.8vw, 1.3rem);
  padding: 0.5em 0.9em;
  cursor: pointer;
  flex-shrink: 0;
}

.video-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7em;
  width: 100%;
  min-height: clamp(64px, 12vh, 130px);
  margin-bottom: 1.4vh;
  padding: 0.6em 1em;
  border: none;
  border-radius: clamp(12px, 1.6vw, 20px);
  background: #ece7fb;
  color: #3d2f5b;
  font-family: inherit;
  font-size: clamp(1.05rem, 2.6vw, 1.9rem);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0.3vh 0 rgba(0, 0, 0, 0.08);
}

.video-label {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  min-width: 0;
}

.video-date {
  font-size: 0.72em;
  font-weight: 500;
  color: #7a6fa0;
}

/* ---------- extras row ---------- */

.extras {
  margin-top: 3vh;
}

.extras h2 {
  color: #5b4b8a;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  margin: 0 0 1vh;
}

.extras-list {
  display: flex;
  gap: clamp(12px, 1.6vw, 26px);
  flex-wrap: wrap;
}

.extra-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7em;
  flex: 1 1 clamp(220px, 26vw, 460px);
  max-width: 100%;
  min-height: clamp(90px, 16vh, 180px);
  padding: 0.6em 1.1em;
  border: none;
  border-radius: clamp(14px, 2vw, 26px);
  background: linear-gradient(135deg, #ffe29a, #ffa99f);
  color: #3d2f5b;
  font-family: inherit;
  font-size: clamp(1.05rem, 2.6vw, 1.9rem);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 0.4vh 0 rgba(0, 0, 0, 0.14);
}

.extra-emoji {
  font-size: 2.2em;
  flex-shrink: 0;
}

/* ---------- footer ---------- */

.kid-footer {
  display: flex;
  justify-content: flex-end;
  padding: 1vh 5vw 2.5vh;
}

.grown-ups {
  color: #cfc6e8;
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  text-decoration: none;
  padding: 0.6em;
  border-radius: 10px;
}

/* ---------- celebration ---------- */

@keyframes pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18) rotate(-3deg);
  }
  100% {
    transform: scale(1);
  }
}

.celebrate {
  animation: pop 0.45s ease;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .panda,
  .celebrate {
    animation: none;
  }

  .tv-focus:focus,
  .tv-focus:focus-visible {
    transition: none;
  }

  .tv-focus:focus,
  .tv-focus:focus-visible {
    transform: none;
  }
}

/* ---------- admin view ---------- */

.admin main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.admin h1 {
  color: #5b4b8a;
}

.admin {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.back-link {
  color: #8a7fb8;
}

.panel {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(91, 75, 138, 0.15);
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.field input {
  font-size: 1rem;
  padding: 10px 12px;
  border: 2px solid #d8d0ee;
  border-radius: 10px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: #5b4b8a;
}

.btn {
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: #5b4b8a;
  color: #fff;
  cursor: pointer;
}

.btn.secondary {
  background: #d8d0ee;
  color: #3d2f5b;
}

.btn.danger {
  background: #e57373;
}

.btn.small {
  font-size: 0.85rem;
  padding: 6px 12px;
}

.message {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.message.error {
  background: #fdecea;
  color: #b3261e;
}

.message.ok {
  background: #e6f4ea;
  color: #1e7d32;
}

.video-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #eee7fa;
  flex-wrap: wrap;
}

.video-row .info {
  flex: 1;
  min-width: 180px;
}

.video-row .info .t {
  font-weight: 700;
}

.video-row .info .s {
  font-size: 0.85rem;
  color: #7a6fa0;
}

.row-buttons {
  display: flex;
  gap: 8px;
}
