:root {
  --navy: #1d2b3a;
  --navy-2: #24384b;
  --navy-3: #3d5a73;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .72);
  --pink: #ff3d6e;
  --pink-soft: #ff9fb3;
  --lime: #9be37a;
  --sky: #a8d8ff;
  --font: -apple-system, "Sukhumvit Set", "Thonburi", "Noto Sans Thai", "Leelawadee UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--navy); color: var(--text); font-family: var(--font); -webkit-user-select: none; user-select: none; }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.label { font-size: clamp(14px, 2.2vh, 22px); letter-spacing: .04em; color: var(--muted); }
.note { color: var(--pink-soft); font-size: clamp(14px, 2.4vh, 22px); }

/* buttons */
.btn { display: inline-block; border: 0; border-radius: 999px; padding: 14px 28px; font: inherit; font-size: clamp(16px, 2.6vh, 24px);
  background: var(--navy-3); color: var(--text); cursor: pointer; text-align: center; }
.btn.primary { background: var(--lime); color: #17311a; font-weight: 700; }
.btn.ghost { background: transparent; border: 2px solid var(--navy-3); }
.buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 3vh; }

/* home */
.home { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3.5vh; padding: 4vh 5vw; text-align: center; }
.home-day { font-size: clamp(48px, 12vh, 120px); margin: 0; line-height: 1; }
.home-sub { font-size: clamp(16px, 3vh, 28px); color: var(--muted); margin-top: 1vh; }
.home-sub.small { font-size: clamp(13px, 2.2vh, 20px); }
.start { width: clamp(160px, 26vh, 260px); height: clamp(160px, 26vh, 260px); border-radius: 50%; border: 0; background: var(--lime); color: #17311a;
  font: inherit; font-size: clamp(36px, 7vh, 64px); font-weight: 800; cursor: pointer; box-shadow: 0 0 0 12px rgba(155, 227, 122, .18); }
.home-links { display: flex; gap: 16px; }
.link-card { background: var(--navy-2); border-radius: 18px; padding: 16px 26px; font-size: clamp(16px, 2.6vh, 24px); min-width: 150px; }
.link-card .icon { font-size: 1.6em; }
.home-last, .home-note { color: var(--muted); font-size: clamp(13px, 2.2vh, 20px); }

/* session stage: designed for iPad landscape (~1.43:1) mirrored to TV */
body.playing { overflow: hidden; }
.stage { position: fixed; inset: 0; overflow: hidden; }
.stage .media { position: absolute; left: 21vw; right: 21vw; top: 50%; transform: translateY(-50%); aspect-ratio: 16 / 9;
  border-radius: 2vh; overflow: hidden; background: #eef0f2; display: flex; align-items: center; justify-content: center; }
.stage .media video, .stage .media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.poster.idle { animation: idle 4s ease-in-out infinite; }
@keyframes idle { 50% { transform: scale(1.03); } }
.stage .info { position: absolute; left: 2.5vw; top: 4vh; width: 18vw; }
.stage .name { font-size: clamp(20px, 4.6vh, 44px); margin: .3vh 0 0; line-height: 1.1; }
.stage .th { font-size: clamp(15px, 3vh, 28px); color: var(--muted); margin-top: .6vh; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1.6vh; }
.chip { border-radius: 999px; padding: 4px 10px; font-size: clamp(12px, 2.1vh, 19px); font-weight: 600; }
.chip.primary { background: var(--pink); color: #fff; box-shadow: 0 0 10px rgba(255, 61, 110, .6); }
.chip.secondary { background: var(--pink-soft); color: #4a1324; }
.cue { margin-top: 3vh; font-size: clamp(15px, 2.8vh, 26px); color: var(--sky); line-height: 1.35; }
.cues { margin: 2.5vh 0 0; padding-left: 1.2em; font-size: clamp(14px, 2.6vh, 24px); color: var(--sky); line-height: 1.4; }
.side { margin-top: 2vh; font-size: clamp(22px, 5vh, 48px); font-weight: 700; color: var(--lime); }
.stage .counter { position: absolute; right: 2.5vw; top: 4vh; width: 17vw; text-align: right; }
.count { font-size: clamp(64px, 22vh, 220px); font-weight: 800; line-height: .95; font-variant-numeric: tabular-nums; }
.count.long { font-size: clamp(40px, 12vh, 120px); }
.pause .btn { font-size: clamp(18px, 3.4vh, 30px); padding: 16px 34px; }
.count-sm { font-size: clamp(48px, 14vh, 140px); font-weight: 800; line-height: 1; }
.unit { font-size: clamp(14px, 2.6vh, 24px); color: var(--muted); }
.setno { margin-top: 1.4vh; font-size: clamp(18px, 3.6vh, 34px); font-weight: 700; }
.upnext { position: absolute; left: 2.5vw; bottom: 4vh; font-size: clamp(14px, 2.6vh, 24px); color: var(--muted); }
.bar { position: absolute; left: 0; bottom: 0; height: 1.2vh; width: 0; background: var(--lime); transition: width .1s linear; }

/* breathing circle (rest + slow walk) */
.breath-media { background: transparent !important; }
.breath-circle { width: 28vh; height: 28vh; border-radius: 50%; background: radial-gradient(circle, var(--lime), rgba(155, 227, 122, .25));
  animation: breathe 10s ease-in-out infinite; margin: 0 auto; }
@keyframes breathe { 0% { transform: scale(.55); } 40% { transform: scale(1); } 100% { transform: scale(.55); } }

/* rest */
.stage.rest .rest-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 12vw; }
.rest-time { font-size: clamp(56px, 16vh, 160px); font-weight: 800; font-variant-numeric: tabular-nums; }
.card { margin-top: 2vh; max-width: 70vw; }
.quote { font-size: clamp(20px, 4.2vh, 40px); line-height: 1.4; margin: 1vh 0; }
.sub { color: var(--muted); font-size: clamp(14px, 2.6vh, 24px); }
.breath-word { margin-top: 2vh; font-size: clamp(20px, 4vh, 38px); color: var(--lime); }
.preview { position: absolute; right: 2.5vw; bottom: 4vh; width: 26vw; font-size: clamp(14px, 2.6vh, 24px); text-align: right; }
.preview .media.small { position: relative; left: auto; right: auto; top: auto; transform: none; width: 100%; margin-bottom: 1vh; }

/* precheck / finish / generic centre */
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4vh 8vw; gap: 1vh; }
.center h1 { font-size: clamp(32px, 7vh, 72px); margin: 0 0 2vh; }
.big-line { font-size: clamp(18px, 3.6vh, 34px); margin: .6vh 0; }

/* pause */
.pause { position: fixed; inset: 0; background: rgba(10, 18, 28, .82); display: flex; align-items: center; justify-content: center; z-index: 10; }
.pause-box { text-align: center; }
.pause-box h1 { font-size: clamp(36px, 8vh, 80px); margin: 0 0 1vh; }

/* phone-friendly pages (travel, walk, food) */
.page { max-width: 760px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 40px; }
.page h1 { font-size: 30px; margin: 8px 0 4px; }
.page .back { display: inline-block; color: var(--muted); padding: 6px 0; font-size: 17px; }
.tiles { display: grid; gap: 14px; margin-top: 18px; }
.tile { display: block; background: var(--navy-2); border-radius: 18px; padding: 18px 20px; }
.tile h2 { margin: 0 0 4px; font-size: 22px; }
.tile p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.45; }

/* walk */
.walk-time { font-size: clamp(72px, 22vw, 180px); font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; margin: 4vh 0 1vh; }
.walk-cue { text-align: center; font-size: 22px; color: var(--sky); min-height: 2.6em; }
.seg { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }

/* food */
.now-card { background: var(--navy-2); border-radius: 18px; padding: 16px 18px; margin-top: 14px; }
.now-card h2 { margin: 0 0 8px; font-size: 20px; }
.protein { display: flex; align-items: center; gap: 18px; margin-top: 16px; }
.ring { width: 120px; height: 120px; flex: none; }
.ring text { fill: #fff; font-family: var(--font); }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick .btn { padding: 10px 18px; font-size: 17px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 18px 0 10px; padding-bottom: 4px; }
.tab { flex: none; border: 0; border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 16px; background: var(--navy-2); color: var(--muted); }
.tab.on { background: var(--sky); color: #10263a; font-weight: 700; }
.food-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 14px;
  background: var(--navy-2); color: var(--text); font: inherit; font-size: 17px; padding: 14px 16px; margin-bottom: 8px; cursor: pointer; }
.food-item .g { flex: none; color: var(--lime); font-weight: 700; }
.food-item .tip { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.week b { display: block; font-size: 17px; color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--lime); color: #17311a; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 20; }
.now-card .food-item { background: var(--navy-3); }
.page .sub { font-size: 15px; line-height: 1.45; }
.stage .media svg.figure { width: 100%; height: 100%; display: block; }
