/* Cricket Performance Lab - mobile-first, no inline styles, strict-CSP friendly */
:root {
  --blue: #1a5fb4; --blue-d: #123f7a; --saffron: #ff9933; --green: #138808;
  --cream: #F4EDE0; --gold: #C99A4A; --ink: #14213d; --muted: #4a5568;
  --card: #ffffff; --line: #e3d9c6; --red: #b42318;
  --r: 22px; --shadow: 0 6px 20px rgba(26, 95, 180, .14);
  font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Malayalam", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-size: 16px; line-height: 1.45; min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h2 { font-size: 1.2rem; color: var(--blue-d); }
p { margin: 0 0 .6em; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tricolor { height: 6px; background: linear-gradient(90deg, var(--saffron) 33.3%, #fff 33.3% 66.6%, var(--green) 66.6%); }

/* header + nav */
.top { position: sticky; top: 0; z-index: 20; background: var(--blue); color: #fff; }
.top-in { display: flex; align-items: center; gap: 10px; padding: 8px 16px; max-width: 760px; margin: 0 auto; }
.brand { white-space: nowrap; font-weight: 800; letter-spacing: .06em; font-size: 1.15rem; flex: 1; }
.brand span { color: var(--saffron); }
.who { font-size: .8rem; opacity: .95; text-align: right; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 3px solid var(--gold); display: flex; justify-content: center; }
.nav a { flex: 1; max-width: 200px; min-height: 56px; display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700; color: var(--muted); }
.nav a[aria-current="page"] { color: var(--blue); background: #eaf1fb; box-shadow: inset 0 -4px 0 var(--saffron); }
main { max-width: 760px; margin: 0 auto; padding: 14px 16px 90px; }

/* controls */
.btn { white-space: nowrap; min-height: 48px; min-width: 48px; padding: 10px 20px; border: 0; border-radius: 999px; font: inherit; font-weight: 800; cursor: pointer; background: var(--saffron); color: #1b1b1b; box-shadow: 0 3px 0 #c76f0b; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c76f0b; }
.btn.blue { background: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-d); }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 3px 0 #0b5a04; }
.btn.ghost { background: transparent; color: #fff; box-shadow: none; border: 2px solid rgba(255, 255, 255, .7); min-height: 44px; padding: 6px 14px; }
.btn.small { min-height: 44px; padding: 6px 14px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
label { display: block; font-weight: 700; margin: 12px 0 4px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 14px; }
textarea { min-height: 96px; resize: vertical; }
.err { color: var(--red); font-weight: 700; min-height: 1.4em; }
.ok { color: var(--green); font-weight: 700; }
.muted { color: var(--muted); font-size: .92rem; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.blue { background: linear-gradient(135deg, var(--blue), var(--blue-d)); color: #fff; border: 0; }
.card.blue h2 { color: #fff; }
.card.gold { border-top: 6px solid var(--gold); }
.card.saffron { border-top: 6px solid var(--saffron); }
.card.green { border-top: 6px solid var(--green); }
.hero { position: relative; padding: 0; overflow: hidden; min-height: 260px; background: var(--blue-d); }
.hero img { display: block; width: 100%; height: 320px; object-fit: cover; object-position: top center; }
.hero-cap { position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; color: #fff; background: linear-gradient(transparent, rgba(8, 25, 60, .9)); }
.hero-cap h1 { font-size: 2.2rem; letter-spacing: .1em; margin: 0; }
.hero-cap p { margin: 0; font-weight: 600; }
.quote-en { font-size: 1.15rem; font-weight: 700; }
.quote-ml { font-size: 1.05rem; margin-top: 6px; }
.quote-by { font-size: .85rem; opacity: .85; }
.count { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.count b { font-size: 2.4rem; color: var(--saffron); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.tile { background: #fff; border-radius: 18px; padding: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile b { display: block; font-size: 1.9rem; color: var(--blue); }
.tile.s b { color: #b45f06; } .tile.g b { color: var(--green); }
.tile small { color: var(--muted); font-weight: 600; }
.bar { width: 100%; height: 12px; margin-top: 6px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: #e6dcc8; overflow: hidden; }
.bar::-webkit-progress-bar { background: #e6dcc8; }
.bar::-webkit-progress-value { background: linear-gradient(90deg, var(--saffron), var(--green)); border-radius: 99px; }
.bar::-moz-progress-bar { background: linear-gradient(90deg, var(--saffron), var(--green)); border-radius: 99px; }

/* road to India */
.road { list-style: none; margin: 0; padding: 0; }
.road li { position: relative; padding: 8px 0 8px 44px; min-height: 48px; }
.road li::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 4px; background: var(--line); }
.road li:first-child::before { top: 50%; } .road li:last-child::before { bottom: 50%; }
.road .dot { position: absolute; left: 0; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 4px solid var(--line); z-index: 1; }
.road .done .dot { background: var(--green); border-color: var(--green); }
.road .current .dot { background: var(--saffron); border-color: var(--blue); }
.road .current strong { color: var(--blue); }
.road small { display: block; color: var(--muted); }

/* pills + lists */
.pill { display: inline-block; padding: 2px 12px; border-radius: 99px; font-size: .8rem; font-weight: 800; color: #fff; background: var(--muted); }
.pill.open { background: #b45f06; } .pill.improving { background: var(--blue); } .pill.fixed { background: var(--green); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.grow { flex: 1; min-width: 160px; }
.tick { min-width: 48px; min-height: 48px; border-radius: 14px; border: 3px solid var(--green); background: #fff; font-size: 1.5rem; font-weight: 800; color: var(--green); cursor: pointer; }
.tick[aria-pressed="true"] { background: var(--green); color: #fff; }
.note audio { width: 100%; margin-top: 6px; }
.note-en { font-weight: 600; }
.review { white-space: normal; }
.md h3, .md h4, .md h5 { color: var(--blue-d); margin-top: .8em; }
.md ul { padding-left: 20px; }
.badge { font-size: .78rem; background: #fff3e0; color: #8a4b00; border: 1px solid var(--saffron); padding: 2px 10px; border-radius: 99px; font-weight: 800; }

/* mic */
.mic { text-align: center; }
.mic-btn { width: 124px; height: 124px; border-radius: 50%; border: 0; cursor: pointer; background: radial-gradient(circle at 35% 30%, #ffb866, var(--saffron) 60%, #e07b00); color: #1b1b1b; font-size: 3rem; box-shadow: 0 0 0 8px rgba(255, 153, 51, .25), 0 8px 20px rgba(0, 0, 0, .25); }
.mic.compact .mic-btn { width: 56px; height: 56px; font-size: 1.5rem; box-shadow: 0 3px 8px rgba(0, 0, 0, .25); }
.mic.rec .mic-btn { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
.mic-timer { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mic-msg { min-height: 1.5em; font-weight: 600; margin: 6px 0; }
.mic textarea { margin-top: 8px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(180, 35, 24, .6); } 100% { box-shadow: 0 0 0 26px rgba(180, 35, 24, 0); } }

/* chat */
.thread-link { display: block; text-decoration: none; color: inherit; }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 14px; }
.bub { max-width: 86%; padding: 10px 14px; border-radius: 18px; background: #fff; border: 1px solid var(--line); align-self: flex-start; overflow-wrap: anywhere; }
.bub.me { align-self: flex-end; background: #dcebff; border-color: #b8d3f5; }
.bub small { display: block; color: var(--muted); font-size: .75rem; }
.bub audio { width: 100%; max-width: 260px; margin-top: 4px; }
.composer { position: sticky; bottom: 62px; display: flex; gap: 8px; align-items: flex-end; background: var(--cream); padding: 8px 0; }
.composer textarea { min-height: 52px; height: 52px; flex: 1; width: auto; min-width: 0; }
.composer .mic, .composer .btn { flex: none; }
.mic.compact .mic-msg { position: absolute; left: 0; right: 0; bottom: 100%; margin: 0; padding: 4px 0; text-align: left; background: var(--cream); font-size: .9rem; }
.mic.compact .bar { position: absolute; left: 0; right: 0; bottom: 100%; }

/* login + welcome */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 20px 16px; max-width: 440px; margin: 0 auto; }
.login-wrap h1 { text-align: center; font-size: 2rem; letter-spacing: .08em; color: var(--blue-d); }
.login-wrap h1 span { color: var(--saffron); }
.lion { display: block; width: 110px; height: 110px; margin: 0 auto 10px; border-radius: 50%; object-fit: cover; border: 5px solid var(--gold); }
.welcome { position: fixed; inset: 0; z-index: 50; width: 100%; border: 0; padding: 24px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center; cursor: pointer; color: #fff; font: inherit;
  background: linear-gradient(rgba(10, 30, 70, .25), rgba(10, 30, 70, .88) 75%), url("/img/hero.png") top center / cover no-repeat, var(--blue-d); overflow: hidden; }
.welcome h1 { font-size: 2.6rem; letter-spacing: .12em; margin: 0 0 12px; color: var(--saffron); text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.welcome .msg { font-family: Georgia, "Noto Serif", serif; font-size: 1.5rem; line-height: 1.5; max-width: 520px; margin-bottom: 18px; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.welcome .tap { font-weight: 800; padding: 10px 22px; border-radius: 99px; background: rgba(255, 255, 255, .2); border: 2px solid #fff; margin-bottom: 24px; }
.welcome .tricolor { position: absolute; left: 0; right: 0; top: 0; height: 10px; }
.confetti { position: absolute; inset: 0; pointer-events: none; opacity: .85;
  background:
    radial-gradient(circle, var(--saffron) 3px, transparent 4px) 0 0 / 70px 90px,
    radial-gradient(circle, #fff 2.5px, transparent 3.5px) 30px 40px / 90px 70px,
    radial-gradient(circle, var(--green) 3px, transparent 4px) 50px 10px / 110px 100px,
    radial-gradient(circle, var(--gold) 2.5px, transparent 3.5px) 10px 60px / 80px 120px;
  animation: drift 14s linear infinite; }
@keyframes drift { to { background-position: 0 300px, 30px 340px, 50px 360px, 10px 420px; } }
.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, #eadfca, #f7f1e4, #eadfca); background-size: 200% 100%; animation: shimmer 1.4s infinite; margin: 14px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; z-index: 60; font-weight: 700; max-width: 90%; }
.devbar { background: #fff3e0; padding: 6px 16px; text-align: center; font-size: .85rem; }

@media (min-width: 620px) { .tiles { grid-template-columns: repeat(4, 1fr); } .hero img { height: 380px; } }
@media (prefers-reduced-motion: reduce) {
  .confetti, .skeleton, .mic.rec .mic-btn { animation: none; }
  .btn:active { transform: none; }
  * { scroll-behavior: auto !important; }
}
