/* ===== My School Day – bright, chunky, child-friendly ===== */

:root {
  --ink: #2b2d42;
  --cream: #fff4d6;
  --sun: #ffc619;
  --coral: #ff5d5d;
  --teal: #12b5a5;
  --sky: #2fb4f0;
  --grape: #7b5cff;
  --lime: #6cc417;
  --pink: #ff5fa2;
  --gap: clamp(10px, 2.2vmin, 22px);
  --radius: clamp(24px, 5vmin, 48px);
  --ease: cubic-bezier(.65, 0, .35, 1);
  --font: "Fredoka", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 93, 93, .18) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 60%, rgba(47, 180, 240, .20) 0 3px, transparent 4px),
    radial-gradient(circle at 40% 85%, rgba(123, 92, 255, .18) 0 3px, transparent 4px);
  background-size: 64px 64px, 80px 80px, 96px 96px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Layout: tall hero on top, short "up next" below ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--gap);
  padding: calc(var(--gap) + env(safe-area-inset-top)) calc(var(--gap) + env(safe-area-inset-right))
           calc(var(--gap) + env(safe-area-inset-bottom)) calc(var(--gap) + env(safe-area-inset-left));
}

/* ---------- Shared panel look ---------- */
.hero, .next {
  --accent: var(--sky);
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: clamp(5px, 1vmin, 9px) solid #fff;
  box-shadow: 0 clamp(6px, 1.2vmin, 12px) 0 rgba(43, 45, 66, .22);
  background: #fff;
  isolation: isolate;
}

.hero {
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
  transition: transform .12s ease;
}
.hero:active { transform: scale(.985); }
.hero:focus-visible { outline: 6px solid var(--grape); outline-offset: 4px; }
.hero.shake { animation: shake .55s ease; }
.hero.done { cursor: default; }

.next {
  height: clamp(130px, 21dvh, 230px);
}

/* ---------- Slides (the bit that slides vertically) ---------- */
.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: var(--accent);
  background-size: cover;
  background-position: center;
  color: #fff;
  will-change: transform;
}
.slide::before {            /* readable text on any picture */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20, 20, 50, .68) 0%, rgba(20, 20, 50, .25) 42%, rgba(20, 20, 50, 0) 70%);
  z-index: 0;
}
.slide > * { position: relative; z-index: 1; }

.slide.solid { background-image: none; }
.slide.solid::before {
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.28) 0 14%, transparent 15%),
    radial-gradient(circle at 12% 85%, rgba(255,255,255,.18) 0 18%, transparent 19%);
}
.slide .big-emoji {
  position: absolute; top: 8%; left: 0; right: 0;
  text-align: center;
  font-size: clamp(5rem, 24vmin, 16rem);
  line-height: 1;
  z-index: 1;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.18));
  animation: float 3s ease-in-out infinite;
}

/* Hero slide text */
.hero .slide { padding: clamp(18px, 4vmin, 48px); gap: clamp(8px, 1.6vmin, 18px); }

.chip {
  align-self: flex-start;
  display: inline-block;
  padding: .25em .9em;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
}
.hero .chip { font-size: clamp(1.2rem, 3.6vmin, 2.4rem); }

.title {
  margin: 0;
  font-weight: 700;
  line-height: 1.02;
  text-shadow: 0 .05em 0 rgba(0,0,0,.28), 0 0 .4em rgba(0,0,0,.25);
  overflow-wrap: anywhere;
}
.hero .title { font-size: clamp(2.8rem, 13vmin, 9rem); }

.time {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: .4em;
  padding: .1em .7em .15em;
  border-radius: 999px;
  background: var(--accent);
  border: .12em solid #fff;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 5px 0 rgba(0,0,0,.2);
}
.hero .time { font-size: clamp(1.8rem, 6.4vmin, 4.2rem); }

.sub {
  margin: 0;
  font-weight: 500;
  font-size: clamp(1.05rem, 2.8vmin, 1.8rem);
  line-height: 1.3;
  max-width: 38rem;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.hero .slide.solid { justify-content: flex-end; }

/* Up-next slide text */
.next .slide {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2vmin, 24px);
  padding: clamp(10px, 2.2vmin, 28px) clamp(16px, 3.4vmin, 40px);
}
.next .slide::before {
  background: linear-gradient(to right, rgba(20, 20, 50, .72) 0%, rgba(20, 20, 50, .35) 55%, rgba(20, 20, 50, .15) 100%);
}
.next .slide.solid::before { background: radial-gradient(circle at 90% 30%, rgba(255,255,255,.25) 0 16%, transparent 17%); }
.next .text { display: flex; flex-direction: column; gap: clamp(4px, 1vmin, 12px); min-width: 0; }
.next .chip { font-size: clamp(.95rem, 2.8vmin, 1.8rem); }
.next .title { font-size: clamp(1.9rem, 7.2vmin, 4.6rem); }
.next .meta { display: flex; flex-direction: column; align-items: flex-end; gap: clamp(4px, 1vmin, 10px); flex-shrink: 0; }
.next .time { align-self: flex-end; font-size: clamp(1.3rem, 4.6vmin, 3rem); }
.countdown {
  font-weight: 600;
  font-size: clamp(1rem, 3vmin, 2rem);
  padding: .1em .75em;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: var(--ink);
  white-space: nowrap;
}

/* Tap hint – only appears when tapping is allowed */
.tap-hint {
  position: absolute;
  top: clamp(14px, 3vmin, 34px);
  right: clamp(14px, 3vmin, 34px);
  z-index: 5;
  display: none;
  align-items: center; gap: .35em;
  padding: .3em .9em;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: clamp(1.3rem, 4.2vmin, 2.6rem);
  box-shadow: 0 6px 0 rgba(0,0,0,.22);
  animation: pulse 1.2s ease-in-out infinite;
}
.hero.ready .tap-hint { display: inline-flex; }
.tap-hand { display: inline-block; animation: poke 1.2s ease-in-out infinite; }

/* Friendly "not yet" message */
.toast {
  position: fixed;
  left: 50%;
  top: 24%;
  z-index: 20;
  max-width: min(90vw, 40rem);
  transform: translate(-50%, -50%) scale(.6);
  opacity: 0;
  pointer-events: none;
  padding: .6em 1.2em;
  border-radius: 28px;
  background: #fff;
  color: var(--ink);
  border: .16em solid var(--coral);
  font-weight: 700;
  font-size: clamp(1.4rem, 4.6vmin, 3rem);
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,.22);
  transition: opacity .2s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- Animations ---------- */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-14px) rotate(-.6deg); }
  35% { transform: translateX(12px) rotate(.5deg); }
  55% { transform: translateX(-8px); }
  75% { transform: translateX(5px); }
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes poke  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.18em); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3%); } }

/* ---------- Tall, narrow phones ---------- */
@media (max-aspect-ratio: 3/5) {
  .next { height: clamp(120px, 18dvh, 190px); }
}

/* ---------- Short landscape screens ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .next { height: clamp(90px, 26dvh, 140px); }
  .hero .title { font-size: clamp(2.2rem, 11vmin, 6rem); }
}

/* ---------- Small phones ---------- */
@media (max-width: 520px) {
  .next .title { font-size: clamp(1.6rem, 8.5vw, 2.6rem); }
  .next .time { font-size: 1.15rem; }
  .countdown { font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tap-hint, .tap-hand, .slide .big-emoji, .hero.shake { animation: none; }
}
