/* ==========================================================================
   BOGAA Gurukulam – mobile app styles  v1.0.0
   Palette taken from the Bogaa Gurukulam logo: banyan green, temple brown,
   lamp gold and palm-leaf cream.
   ========================================================================== */

:root {
  --bg: #F7F1E3;            /* palm-leaf cream */
  --bg-2: #EFE5CF;
  --surface: #FFFDF8;
  --surface-2: #FBF6EA;
  --ink: #2E1C10;           /* manuscript ink */
  --ink-2: #6B5743;
  --ink-3: #9A8670;
  --line: #E4D7BC;
  --brown: #5A3417;
  --brown-deep: #3B2414;
  --green: #3E5A2A;         /* banyan */
  --green-soft: #E3EAD6;
  --gold: #C8952E;          /* deepam */
  --gold-soft: #F4E4BE;
  --red: #A33B26;           /* kumkum */
  --red-soft: #F6DDD5;
  --ok: #2F7A3E;
  --shadow: 0 1px 2px rgba(59,36,20,.06), 0 6px 18px rgba(59,36,20,.08);
  --shadow-lg: 0 10px 40px rgba(59,36,20,.22);
  --r-s: 10px; --r-m: 16px; --r-l: 24px;
  --font-body: "Mukta Malar", "Noto Sans Tamil", "Latha", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Marcellus", "Mukta Malar", "Noto Serif Tamil", Georgia, serif;
  --font-brand: "Cinzel", "Marcellus", Georgia, serif;
  --top-h: 56px; --tab-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #17110B; --bg-2: #211810; --surface: #231A12; --surface-2: #2B2017;
  --ink: #F3E9D6; --ink-2: #CDBB9E; --ink-3: #8F7D66; --line: #3A2D20;
  --brown: #D9A877; --brown-deep: #0F0A06; --green: #9CC07E; --green-soft: #26321C;
  --gold: #E2B354; --gold-soft: #3A2D14; --red: #E08A73; --red-soft: #3A1D16; --ok: #7CC48A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-2); color: var(--ink); font-family: var(--font-body);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
:lang(ta) body, html[lang="ta"] body { font-size: 15px; line-height: 1.6; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 400; margin: 0; line-height: 1.25; letter-spacing: .01em; }
html[lang="ta"] h1, html[lang="ta"] h2, html[lang="ta"] h3, html[lang="ta"] h4 { font-family: var(--font-body); font-weight: 700; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell (phone width, centred on large screens) ---------- */
.app {
  position: relative; max-width: 480px; min-height: 100%; margin: 0 auto;
  background: var(--bg); display: flex; flex-direction: column;
}
@media (min-width: 560px) {
  body { padding: 0; }
  .app { box-shadow: 0 0 0 1px var(--line), var(--shadow-lg); }
}
.view { flex: 1; padding: calc(var(--top-h) + var(--safe-t)) 0 calc(var(--tab-h) + var(--safe-b) + 16px); outline: none; }
.app.no-tabs .view { padding-bottom: calc(var(--safe-b) + 24px); }
.app.no-top .view { padding-top: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 20; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 6px 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar.on-hero { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; color: #fff; }
.topbar.on-hero.scrolled { background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--ink); backdrop-filter: blur(12px); }
.topbar .title { flex: 1; min-width: 0; font-family: var(--font-head); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
html[lang="ta"] .topbar .title { font-family: var(--font-body); font-weight: 700; font-size: 16px; }
.topbar.on-hero:not(.scrolled) .title { opacity: 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:active { background: color-mix(in srgb, currentColor 12%, transparent); }
.topbar.on-hero:not(.scrolled) .icon-btn { background: rgba(0,0,0,.22); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding-left: 8px; flex: 1; min-width: 0; }
.brand img { width: 36px; height: 36px; border-radius: 50%; }
.brand .w { font-family: var(--font-brand); font-weight: 700; font-size: 17px; letter-spacing: .12em; color: var(--brown); line-height: 1; }
.brand .s { font-family: var(--font-brand); font-size: 9.5px; letter-spacing: .32em; color: var(--green); margin-top: 3px; }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
}
.app.no-tabs .tabbar { display: none; }
.tab span { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--ink-3); position: relative; }
.tab svg.i { width: 23px; height: 23px; }
.tab.active { color: var(--brown); font-weight: 700; }
.tab.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
html[lang="ta"] .tab { font-size: 10px; }

/* ---------- layout helpers ---------- */
.pad { padding: 0 16px; }
.stack > * + * { margin-top: 12px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 16px; margin-bottom: 12px; }
.section-head h2 { font-size: 20px; color: var(--brown); }
html[lang="ta"] .section-head h2 { font-size: 17px; }
.section-head a { font-size: 14px; color: var(--green); font-weight: 600; white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ornamental divider like the logo */
.orn { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--gold); margin: 18px 16px; }
.orn::before, .orn::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.orn::after { background: linear-gradient(90deg, var(--gold), transparent); }
.orn svg { width: 22px; height: 22px; }

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.card.pad-in { padding: 16px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

/* ---------- home hero ---------- */
.hero {
  margin: 4px 16px 0; border-radius: var(--r-l); padding: 20px 18px 18px; color: #FBF3E2; position: relative; overflow: hidden;
  background: radial-gradient(120% 90% at 100% 0%, #6E4423 0%, transparent 60%), linear-gradient(160deg, #4A2C15 0%, #2F1C0E 100%);
}
.hero::after { content: ""; position: absolute; inset: 0; background-image: var(--kolam); background-size: 22px 22px; opacity: .14; pointer-events: none; }
.hero .greet { font-size: 14px; color: var(--gold-soft); opacity: .95; }
:root[data-theme="dark"] .hero .greet { color: #F4E4BE; }
.hero h1 { font-size: 25px; margin-top: 4px; color: #FFF8EA; }
html[lang="ta"] .hero h1 { font-size: 21px; }
.hero .quote { margin-top: 10px; font-size: 14px; color: #E9D9B8; max-width: 30ch; }
.hero .deepam { position: absolute; right: 14px; top: 14px; width: 54px; height: 54px; color: var(--gold); opacity: .95; }
.search {
  position: relative; z-index: 1; margin-top: 16px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  border-radius: 999px; background: #FFF9EE; color: #6B5743; border: 0; width: 100%; text-align: left; cursor: text;
}
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; color: #2E1C10; font-size: 15px; }
.search input::placeholder { color: #9A8670; }

/* ---------- category grid ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 16px; }
.cat-tile {
  background: var(--surface); border-radius: var(--r-m); padding: 14px 6px 12px; text-align: center; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 108px; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.cat-tile:active { transform: scale(.97); }
.cat-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; position: relative; }
.cat-ico svg.i { width: 26px; height: 26px; stroke-width: 1.6; }
.cat-tile .n { font-size: 12.5px; line-height: 1.25; font-weight: 600; color: var(--ink); }
html[lang="ta"] .cat-tile .n { font-size: 11.5px; }

/* ---------- course cards ---------- */
.course-card { width: 236px; overflow: hidden; display: block; }
.cover { position: relative; height: 120px; overflow: hidden; color: #fff; }
.cover svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover .badge-top { position: absolute; left: 10px; top: 10px; }
.course-card .body { padding: 12px 14px 14px; }
.course-card h3 { font-size: 16.5px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 41px; }
html[lang="ta"] .course-card h3 { font-size: 14.5px; }
.course-row { display: flex; gap: 12px; padding: 10px; align-items: center; }
.course-row .thumb { width: 76px; height: 76px; border-radius: 12px; overflow: hidden; position: relative; flex: none; color: #fff; }
.course-row .thumb svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.course-row h3 { font-size: 16px; }
html[lang="ta"] .course-row h3 { font-size: 14.5px; }
.list > * + * { margin-top: 10px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-2);
}
.chip.on { background: var(--brown); border-color: var(--brown); color: #FFF8EA; }
:root[data-theme="dark"] .chip.on { color: #1A120B; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.b-gold { background: var(--gold-soft); color: #7A5410; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-ink { background: rgba(0,0,0,.45); color: #fff; backdrop-filter: blur(4px); }
:root[data-theme="dark"] .b-gold { color: var(--gold); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- banners ---------- */
.banner { margin: 0 16px; border-radius: var(--r-m); padding: 16px; display: flex; gap: 14px; align-items: center; color: #fff; position: relative; overflow: hidden; }
.banner::after { content: ""; position: absolute; inset: 0; background-image: var(--kolam); background-size: 20px 20px; opacity: .12; }
.banner > * { position: relative; z-index: 1; }
.banner .bi { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); flex: none; }
.banner .bi svg.i { width: 28px; height: 28px; }
.banner h3 { font-size: 18px; }
html[lang="ta"] .banner h3 { font-size: 15.5px; }
.banner p { font-size: 13.5px; opacity: .9; margin-top: 2px; }
.banner + .banner { margin-top: 10px; }

/* ---------- live ---------- */
.live-card { width: 268px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.when { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--red); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 var(--red); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 60%, transparent);} 100% { box-shadow: 0 0 0 10px transparent; } }
.live-row { padding: 14px; display: flex; gap: 14px; align-items: center; }
.datebox { width: 54px; text-align: center; border-radius: 12px; background: var(--gold-soft); padding: 6px 0; flex: none; color: #6E4A0E; }
:root[data-theme="dark"] .datebox { color: var(--gold); }
.datebox .d { font-family: var(--font-head); font-size: 22px; line-height: 1.1; }
.datebox .m { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.day-label { padding: 0 16px; margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- buttons ---------- */
.btn {
  height: 50px; border-radius: 14px; border: 0; padding: 0 20px; font-weight: 600; font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #10170B; }
.btn-gold { background: var(--gold); color: #2E1C10; }
.btn-brown { background: var(--brown); color: #FFF8EA; }
:root[data-theme="dark"] .btn-brown { color: #1A120B; }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-sm { height: 38px; font-size: 14px; border-radius: 10px; padding: 0 14px; width: auto; }
.btn:active:not(:disabled) { transform: translateY(1px); filter: brightness(.96); }

/* ---------- course detail ---------- */
.c-hero { position: relative; height: 250px; color: #fff; overflow: hidden; }
.c-hero svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.c-hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, transparent 35%, rgba(20,12,6,.75) 100%); }
.c-hero .txt { position: absolute; left: 16px; right: 16px; bottom: 34px; }
.c-hero h1 { font-size: 27px; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.3); }
html[lang="ta"] .c-hero h1 { font-size: 22px; }
.c-hero .sub { font-size: 14px; opacity: .92; margin-top: 2px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: -22px 16px 0; position: relative; z-index: 2; }
.fact { padding: 12px 6px; text-align: center; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact .v { font-weight: 700; font-size: 15px; color: var(--brown); }
.fact .k { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
html[lang="ta"] .fact .k { text-transform: none; letter-spacing: 0; }

.path { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 12px; position: relative; }
.path::before { content: ""; position: absolute; left: 34px; right: 34px; top: 17px; height: 2px; background: repeating-linear-gradient(90deg, var(--gold) 0 6px, transparent 6px 11px); }
.step { position: relative; z-index: 1; width: 20%; text-align: center; font-size: 11.5px; color: var(--ink-2); line-height: 1.25; }
.step .c { width: 36px; height: 36px; margin: 0 auto 6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--gold); display: grid; place-items: center; color: var(--brown); }
.step .c svg.i { width: 18px; height: 18px; }
.step.done .c { background: var(--green); border-color: var(--green); color: #fff; }
html[lang="ta"] .step { font-size: 10px; }

.tabs { display: flex; gap: 4px; margin: 0 16px; padding: 4px; background: var(--bg-2); border-radius: 12px; }
.tabs a, .tabs button { flex: 1; height: 38px; border: 0; background: transparent; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tabs a.on, .tabs button.on { background: var(--surface); color: var(--brown); box-shadow: var(--shadow); }
html[lang="ta"] .tabs a, .tabs button { font-size: 12.5px; }

.lesson { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.lesson + .lesson { border-top: 1px solid var(--line); }
.lesson .num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); font-size: 13px; font-weight: 700; color: var(--ink-2); flex: none; }
.lesson.done .num { background: var(--green); color: #fff; }
.lesson .num svg.i { width: 16px; height: 16px; }
.lesson .lt { font-weight: 600; font-size: 15px; }
.lesson .ls { font-size: 12.5px; color: var(--ink-3); }
.lock { color: var(--ink-3); }

.guru-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; font-family: var(--font-brand); font-weight: 700; font-size: 18px; color: #FFF8EA; background: var(--brown); overflow: hidden; }
.avatar.lg { width: 96px; height: 96px; font-size: 32px; border: 3px solid var(--gold); }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 13.5px; line-height: 1.45; }
.notice svg.i { width: 20px; height: 20px; margin-top: 1px; }
.notice.info { background: var(--gold-soft); color: #6E4A0E; }
:root[data-theme="dark"] .notice.info { color: var(--gold); }

.progress { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), color-mix(in srgb, var(--green) 70%, var(--gold))); border-radius: 99px; transition: width .4s; }

.sticky-cta { position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.app.has-cta .view { padding-bottom: calc(96px + var(--safe-b)); }
.app:not(.no-tabs) .sticky-cta { bottom: calc(var(--tab-h) + var(--safe-b)); padding-bottom: 10px; }
.app.has-cta:not(.no-tabs) .view { padding-bottom: calc(var(--tab-h) + 96px + var(--safe-b)); }

/* ---------- player ---------- */
.player { position: relative; aspect-ratio: 16 / 9; background: #120B06; color: #E9D9B8; display: grid; place-items: center; overflow: hidden; }
.player iframe, .player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .ph { text-align: center; padding: 20px; position: relative; z-index: 1; }
.player .ph svg.i { width: 44px; height: 44px; color: var(--gold); margin: 0 auto 8px; display: block; }
.player::before { content: ""; position: absolute; inset: 0; background-image: var(--kolam); background-size: 24px 24px; opacity: .08; }

/* ---------- exam ---------- */
.q-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; font-size: 14px; color: var(--ink-2); }
.timer { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--brown); font-variant-numeric: tabular-nums; }
.question { font-family: var(--font-head); font-size: 22px; padding: 0 16px; margin-top: 16px; color: var(--ink); }
html[lang="ta"] .question { font-family: var(--font-body); font-size: 18px; font-weight: 700; }
.opts { padding: 0 16px; margin-top: 18px; }
.opt { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; }
.opt + .opt { margin-top: 10px; }
.opt .k { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; color: var(--ink-2); }
.opt.on { border-color: var(--green); background: var(--green-soft); }
.opt.on .k { background: var(--green); border-color: var(--green); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--green-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.qdots { display: flex; gap: 6px; padding: 0 16px; margin-top: 10px; }
.qdots i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.qdots i.on { background: var(--gold); }
.qdots i.cur { background: var(--brown); }

.result-ring { width: 150px; height: 150px; margin: 10px auto 0; position: relative; }
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result-ring .v { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-size: 38px; color: var(--brown); }

/* ---------- certificate ---------- */
.cert {
  margin: 0 16px; aspect-ratio: 1.414 / 1; border-radius: 6px; position: relative; overflow: hidden; color: #2E1C10;
  background: #FFF9EC; box-shadow: var(--shadow-lg); padding: 7%; text-align: center; display: flex; flex-direction: column; justify-content: center;
}
.cert::before { content: ""; position: absolute; inset: 8px; border: 2px solid #5A3417; border-radius: 3px; pointer-events: none; }
.cert::after { content: ""; position: absolute; inset: 13px; border: 1px solid #C8952E; border-radius: 2px; pointer-events: none; }
.cert .ce-em { width: 13%; margin: 0 auto 2%; border-radius: 50%; }
.cert .ce-brand { font-family: var(--font-brand); font-weight: 700; letter-spacing: .14em; font-size: clamp(11px, 3.4vw, 16px); color: #5A3417; }
.cert .ce-t { font-family: var(--font-head); font-size: clamp(9px, 2.6vw, 13px); letter-spacing: .3em; color: #3E5A2A; margin-top: 2%; text-transform: uppercase; }
.cert .ce-name { font-family: var(--font-head); font-size: clamp(15px, 5.2vw, 25px); color: #3B2414; margin-top: 3%; border-bottom: 1px solid #C8952E; display: inline-block; padding: 0 6% 1%; align-self: center; }
.cert .ce-c { font-size: clamp(8px, 2.4vw, 12px); color: #6B5743; margin-top: 2.5%; }
.cert .ce-course { font-family: var(--font-head); font-size: clamp(11px, 3.6vw, 17px); color: #3E5A2A; margin-top: 1%; }
.cert .ce-foot { display: flex; justify-content: space-between; margin-top: 5%; font-size: clamp(7px, 2vw, 10px); color: #6B5743; text-align: left; }

/* ---------- acupoints ---------- */
.mer-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.mer-row + .mer-row { border-top: 1px solid var(--line); }
.mer-code { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--red-soft); color: var(--red); flex: none; letter-spacing: .02em; }
.pt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 16px; }
.pt { background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.pt .im { aspect-ratio: 1; background: #fff center/cover no-repeat; }
.pt .lb { padding: 6px 8px; font-size: 13px; font-weight: 700; color: var(--brown); text-align: center; }
.pt-detail img { width: 100%; background: #fff; }
.kv h4 { font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-body); font-weight: 700; }
.kv p { margin-top: 2px; }
.kv + .kv { margin-top: 14px; }

/* ---------- forms / sheets ---------- */
.field { display: block; }
.field + .field { margin-top: 12px; }
.field span { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select { width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 16px; outline: none; }
.field input:focus { border-color: var(--green); }
.err { color: var(--red); font-size: 14px; margin-top: 10px; min-height: 1em; }
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(20,12,6,.45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: fixed; z-index: 51; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translate(-50%, 100%);
  background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  max-height: 92vh; overflow-y: auto;
}
.sheet.open { transform: translate(-50%, 0); }
.sheet-bg.open { opacity: 1; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.seg { display: flex; padding: 4px; background: var(--bg-2); border-radius: 12px; margin-bottom: 16px; }
.seg button { flex: 1; height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--brown); box-shadow: var(--shadow); }

.set-row { display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 56px; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .ic { width: 36px; height: 36px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; color: var(--brown); flex: none; }
.set-row .ic svg.i { width: 20px; height: 20px; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

.empty { text-align: center; padding: 40px 24px; color: var(--ink-2); }
.empty svg.i { width: 48px; height: 48px; color: var(--gold); margin: 0 auto 10px; display: block; }
.empty h3 { color: var(--ink); font-size: 19px; margin-bottom: 6px; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--brown-deep); color: #FBF3E2; padding: 12px 18px; border-radius: 12px; font-size: 14.5px; max-width: calc(100% - 32px);
  box-shadow: var(--shadow-lg); transition: all .25s; pointer-events: none;
}
:root[data-theme="dark"] .toast { background: #F3E9D6; color: #1A120B; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { background: linear-gradient(90deg, var(--bg-2) 0%, var(--surface-2) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- splash / onboarding ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .4s, visibility .4s; color: var(--brown);
}
.splash img { border-radius: 50%; animation: rise .8s ease-out both; }
.splash-word { font-family: var(--font-brand); font-weight: 700; font-size: 38px; letter-spacing: .16em; margin-top: 18px; animation: rise .8s .1s ease-out both; }
.splash-sub { font-family: var(--font-brand); font-size: 17px; letter-spacing: .42em; color: var(--green); margin-top: 2px; padding-left: .42em; animation: rise .8s .18s ease-out both; }
.splash-rule { display: flex; gap: 6px; align-items: center; margin-top: 12px; animation: rise .8s .24s ease-out both; }
.splash-rule i { width: 56px; height: 1px; background: var(--gold); }
.splash-rule b { width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }
.splash-tag { font-family: var(--font-head); font-size: 13px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); margin-top: 10px; animation: rise .8s .3s ease-out both; }
.splash.hide { opacity: 0; visibility: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(30px + var(--safe-t)) 24px calc(30px + var(--safe-b)); text-align: center; }
.welcome .logo-full { width: 240px; margin: 0 auto; mix-blend-mode: multiply; }
:root[data-theme="dark"] .welcome .logo-full { mix-blend-mode: normal; border-radius: 16px; }
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.lang-pick a, .lang-pick button { height: 84px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.lang-pick a.on, .lang-pick button.on { border-color: var(--green); background: var(--green-soft); }
.lang-pick .big { font-size: 22px; font-weight: 700; color: var(--brown); }
.lang-pick .sm { font-size: 12.5px; color: var(--ink-3); }

.mode-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--gold-soft); color: #6E4A0E; }
:root[data-theme="dark"] .mode-pill { color: var(--gold); }
.mode-pill.online { background: var(--green-soft); color: var(--green); }

/* kolam dot pattern used as texture */
:root { --kolam: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Ccircle cx='11' cy='11' r='1.4' fill='%23fff'/%3E%3Cpath d='M11 3a8 8 0 0 1 8 8M11 19a8 8 0 0 1-8-8' stroke='%23fff' stroke-width='.7' fill='none'/%3E%3C/svg%3E"); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  body * { visibility: hidden; }
  .cert, .cert * { visibility: visible; }
  .cert { position: fixed; inset: 0; margin: 0; box-shadow: none; }
}

.sticky-cta .row .btn { flex: 1; white-space: nowrap; font-size: 15px; padding: 0 12px; min-width: 0; }
.remind-btn { border: 1.5px solid var(--line); background: var(--surface-2); color: var(--brown); flex: none; }
.remind-btn.on { background: var(--green-soft); color: var(--green); border-color: transparent; }
.app.has-cta ~ .toast { bottom: calc(var(--tab-h) + var(--safe-b) + 84px); }
.app.has-cta.no-tabs ~ .toast { bottom: calc(var(--safe-b) + 84px); }

/* core PHP version: anchors used as tabs, chips and choices */
.tabs a { display: flex; align-items: center; justify-content: center; }
.chip { text-decoration: none; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.qblock + .qblock { margin-top: 26px; }
.qblock .question { padding: 0; margin-top: 0; font-size: 19px; }
.qblock .opts { padding: 0; margin-top: 12px; }
form.inline { display: contents; }
.logo-img { mix-blend-mode: multiply; }
:root[data-theme="dark"] .logo-img { mix-blend-mode: normal; }

/* ---------- point details: previous / next (v1.1.10) ---------- */
.pt-head { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pt-head h1 { flex: 1; min-width: 0; }
.pt-pos { font-size: 12.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-mini { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--brown); border: 1px solid var(--line); flex: none; }
.pt-mini svg.i { width: 18px; height: 18px; }
.pt-mini.off { opacity: .35; pointer-events: none; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin-top: 12px; align-items: stretch; }
.pager .pg { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); color: var(--ink); min-width: 0; }
.pager .pg.next { justify-content: flex-end; text-align: right; }
.pager .pg span { display: flex; flex-direction: column; min-width: 0; }
.pager .pg small { font-size: 11px; line-height: 1.25; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pager .pg b { font-size: 16px; color: var(--brown); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager .pg i { font-style: normal; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager .pg svg.i { width: 20px; height: 20px; flex: none; color: var(--brown); }
.pager .pg.off { visibility: hidden; }
.pager .home { justify-content: center; padding: 8px; width: 56px; }
.pager a.pg:active { transform: translateY(1px); }
.swipe-hint { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 8px; }
@media (hover: hover) { .swipe-hint { display: none; } .pager a.pg:hover { border-color: var(--gold); } }
.pt-detail.slide-l { animation: slideL .22s ease-out; }
.pt-detail.slide-r { animation: slideR .22s ease-out; }
@keyframes slideL { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(-24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pt-detail.slide-l, .pt-detail.slide-r { animation: none; } }

/* ==========================================================================
   Acupoint reference (v1.1.13): diseases, five element cycle, therapeutics,
   five element points. Element colours as in the Summary View reference.
   ========================================================================== */
:root {
  --el-wood-bg: #B4E1D3; --el-wood-ink: #1D5143;
  --el-fire-bg: #F7C0AB; --el-fire-ink: #7A2B15;
  --el-earth-bg: #FAEFA6; --el-earth-ink: #5F500A;
  --el-metal-bg: #E3E6EA; --el-metal-ink: #3B4249;
  --el-water-bg: #A8D2E9; --el-water-ink: #11475F;
  --el-none-bg: #EFE5CF; --el-none-ink: #6B5743;
}
:root[data-theme="dark"] {
  --el-wood-bg: #1F4037; --el-wood-ink: #A7E3D1;
  --el-fire-bg: #4D261B; --el-fire-ink: #F7B9A3;
  --el-earth-bg: #47401A; --el-earth-ink: #F0E28F;
  --el-metal-bg: #30353A; --el-metal-ink: #D7DCE2;
  --el-water-bg: #183B4D; --el-water-ink: #A3D3EE;
  --el-none-bg: #2B2017; --el-none-ink: #CDBB9E;
}
.el-wood { background: var(--el-wood-bg); color: var(--el-wood-ink); }
.el-fire { background: var(--el-fire-bg); color: var(--el-fire-ink); }
.el-earth { background: var(--el-earth-bg); color: var(--el-earth-ink); }
.el-metal { background: var(--el-metal-bg); color: var(--el-metal-ink); }
.el-water { background: var(--el-water-bg); color: var(--el-water-ink); }
.el-none { background: var(--el-none-bg); color: var(--el-none-ink); }
[hidden] { display: none !important; }

/* point chip: code + meridian */
.ac { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; min-height: 44px; padding: 5px 8px;
  border-radius: 10px; text-align: center; line-height: 1.15; }
.ac b { font-size: 14px; font-weight: 700; white-space: nowrap; letter-spacing: .01em; }
.ac small { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin-top: 1px; }
a.ac:active { transform: scale(.97); }
.ac.off { opacity: .55; box-shadow: inset 0 0 0 1px currentColor; cursor: default; }
.ac.hit { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
.el-pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.el-pill i { font-style: normal; font-weight: 600; opacity: .75; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--bg-2); color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.el-legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.el-legend .el-pill { height: 22px; font-size: 11.5px; padding: 0 8px; }
.el-legend .lbl { font-size: 12px; color: var(--ink-3); margin-right: 2px; }

/* search bar that stays under the top bar */
.acu-bar { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 6; background: var(--bg); padding: 6px 0 8px; }
.acu-search { display: flex; align-items: center; gap: 10px; height: 46px; margin: 0 16px; padding: 0 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-3); }
.acu-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--ink); }
.acu-search input::-webkit-search-cancel-button { display: none; }
.acu-search .clr { border: 0; background: transparent; color: var(--ink-3); width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; }
.acu-search .clr svg.i { width: 18px; height: 18px; }
.acu-bar .chips { margin-top: 8px; }
.chip.l { min-width: 40px; justify-content: center; padding: 0 11px; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.acu-count { padding: 0 16px; margin: 4px 0 8px; font-size: 12.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* acupoints hub tiles */
.acu-hub { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.acu-tile { background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 128px; }
.acu-tile:active { transform: scale(.98); }
.acu-tile .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.acu-tile .ic svg.i { width: 22px; height: 22px; }
.acu-tile b { font-size: 15px; line-height: 1.25; color: var(--ink); }
html[lang="ta"] .acu-tile b { font-size: 13.5px; }
.acu-tile small { font-size: 12px; line-height: 1.35; color: var(--ink-3); }
.ic-five { background: conic-gradient(from 18deg, #7CC4AE 0 20%, #F09A7B 0 40%, #E8D35A 0 60%, #C9CED4 0 80%, #6FB0D3 0); }
.ic-five svg.i { color: #2E1C10; }

/* disease summary table */
.dsum { overflow: hidden; }
.dsum-head, .dsum-row { display: grid; grid-template-columns: 36% 1fr; }
.dsum-head { background: var(--brown); color: #FFF8EA; font-size: 12.5px; font-weight: 700; }
:root[data-theme="dark"] .dsum-head { color: #1A120B; }
.dsum-head > * { padding: 10px 12px; }
.dsum-head > * + * { border-left: 1px solid rgba(255,255,255,.18); }
.dsum-row { border-top: 1px solid var(--line); }
.dsum-name { padding: 10px 12px; background: var(--surface-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dsum-name b { font-size: 14.5px; font-weight: 700; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.dsum-name small { font-size: 12px; color: var(--ink-3); line-height: 1.3; }
.dsum-name .cnt { margin-top: 4px; font-size: 11.5px; font-weight: 700; color: var(--green); display: inline-flex; align-items: center; gap: 2px; }

.dsum-pts { padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; align-content: start; }
.dsum-pts .ac.x { display: none; }
.dsum-row.open .dsum-pts .ac.x { display: inline-flex; }
.dsum-more { border: 1px dashed var(--ink-3); background: transparent; color: var(--ink-2); border-radius: 10px; font-size: 12.5px; font-weight: 700; min-height: 44px; cursor: pointer; }
.dsum-empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }

/* disease page: points one by one */
.dpt { display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; }
.dpt + .dpt { border-top: 1px solid var(--line); }
.dpt .ac { min-width: 72px; min-height: 54px; flex: none; }
.dpt h3 { font-size: 15px; font-family: var(--font-body); font-weight: 700; color: var(--ink); }
.dpt .im { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #fff; flex: none; }
.dpt .sp { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }

/* therapeutics */
.th-card { padding: 14px; }
.th-card + .th-card { margin-top: 10px; }
.th-head { display: flex; gap: 12px; align-items: flex-start; }
.th-head .ac { min-width: 70px; min-height: 52px; flex: none; }
.th-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.th-special { margin-top: 10px; font-size: 13px; color: #6E4A0E; background: var(--gold-soft); border-radius: 10px; padding: 8px 10px; line-height: 1.45; }
:root[data-theme="dark"] .th-special { color: var(--gold); }
.th-dis { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.th-dis li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 13px; line-height: 1.35; }
.th-dis li small { color: var(--ink-3); margin-left: 4px; }
.th-dis li.hit { border-color: var(--gold); background: var(--gold-soft); }

/* five element cycle */
.cyc-diagram { display: block; width: 100%; max-width: 300px; margin: 0 auto; }
.cyc-diagram text { font-family: var(--font-body); font-weight: 700; }
.cyc-intro p { white-space: pre-line; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.cyc-group { padding: 12px 14px; }
.cyc-group + .cyc-group { margin-top: 10px; }
.cyc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px dashed var(--line); }
.op { font-weight: 700; color: var(--ink-3); font-size: 16px; padding: 0 1px; }
.cyc-cols { display: grid; gap: 6px; font-size: 11px; font-weight: 700; color: var(--ink-3); text-align: center; margin: 6px 0 2px; line-height: 1.25; }
.cyc-cols .el-pill { height: auto; min-height: 22px; white-space: normal; padding: 2px 8px; font-size: 11px; justify-content: center; margin-bottom: 2px; }
.cyc-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.cyc-row.gap { margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.cyc-pt { display: inline-flex; border-radius: 10px; overflow: hidden; flex: none; min-height: 44px; }
.cyc-pt span { display: grid; place-items: center; padding: 0 4px; font-weight: 700; font-size: 14px; min-width: 0; }
.cyc-res { flex: 1; display: grid; gap: 6px; min-width: 0; }
.cyc-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.cyc-cell .ac { min-width: 0; flex: 1; padding: 5px 4px; }
.cyc-cell .ac b { font-size: 13.5px; }
.cyc-cell .sl { color: var(--ink-3); font-weight: 700; }

/* five element points (summary view) */
.fp-wrap { margin: 0 16px; overflow-x: auto; border-radius: var(--r-m); box-shadow: var(--shadow); background: var(--surface); -webkit-overflow-scrolling: touch; }
.fp { border-collapse: separate; border-spacing: 0; min-width: 560px; width: 100%; font-size: 13px; }
.fp th, .fp td { padding: 8px 6px; text-align: center; border-right: 2px solid var(--surface); border-bottom: 2px solid var(--surface); vertical-align: middle; }
.fp tr.hd th { background: var(--surface); color: var(--ink); font-weight: 700; line-height: 1.3; }
.fp tr.hd th small { display: block; font-weight: 600; color: var(--ink-3); font-size: 11.5px; }
.fp .stick { position: sticky; left: 0; z-index: 1; min-width: 108px; }
.fp tr.hd .stick { background: var(--surface); }
.fp td.stick b { display: block; font-size: 13.5px; }
.fp td.stick small { display: block; font-size: 11.5px; opacity: .85; white-space: nowrap; }
.fp td a, .fp td span.x { display: block; color: inherit; }
.fp td b { display: block; font-size: 14px; }
.fp td small { display: block; font-size: 11.5px; opacity: .85; }
.fp tr.sec th { background: var(--bg-2); text-align: left; padding-left: 12px; }

/* ---------- E-books (v1.1.14) ---------- */
.notice.ok { background: var(--green-soft); color: var(--ok); }
.eb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; margin-top: 12px; }
@media (min-width: 420px) { .eb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.eb-card { display: block; position: relative; color: var(--ink); }
.eb-shelf .eb-card { width: 124px; }
.eb-cover { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(59,36,20,.12), 0 8px 18px rgba(59,36,20,.16); }
.eb-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.eb-cover.gen { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 12px; color: #FFF8EA; }
.eb-cover.gen::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: rgba(255,248,234,.22); }
.eb-cover.gen svg.i { width: 28px; height: 28px; opacity: .85; position: absolute; top: 14px; right: 12px; }
.eb-cover.gen span { position: relative; font-family: var(--font-head); font-size: 15px; line-height: 1.25; display: -webkit-box;
  -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
html[lang="ta"] .eb-cover.gen span { font-family: var(--font-body); font-weight: 700; font-size: 14px; }
.eb-badge { position: absolute; top: 8px; left: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px;
  border-radius: 999px; background: rgba(46,28,16,.82); color: #FFF8EA; font-size: 12px; font-weight: 700; }
.eb-badge.free { background: var(--green); color: #fff; }
.eb-badge.own { background: var(--gold); color: #2E1C10; }
.eb-badge svg.i { width: 13px; height: 13px; }
.eb-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 8px; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.eb-a { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-head { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; }
.eb-head .eb-cover.big { width: 132px; flex: none; }
.eb-head h1 { font-size: 22px; color: var(--brown); }
.eb-author { color: var(--ink-2); margin-top: 4px; font-size: 14px; }
.tag.eb-price { background: var(--brown); color: #FFF8EA; border-color: transparent; font-weight: 700; }
.tag.eb-price.free { background: var(--green); color: #fff; }
:root[data-theme="dark"] .tag.eb-price, :root[data-theme="dark"] .eb-badge.free { color: #14100B; }
.eb-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.eb-actions .btn { width: 100%; }
.eb-actions form { margin: 0; }
.eb-buy { height: auto; min-height: 56px; flex-direction: column; gap: 1px; padding: 8px 16px; }
.eb-buy-main { font-size: 16.5px; font-weight: 700; }
.eb-buy-sub { font-size: 12px; font-weight: 500; opacity: .85; }
.eb-buy.pp { background: #FFC439; color: #111; border: 0; }
.eb-secure { display: flex; align-items: center; justify-content: center; gap: 4px; }
.eb-secure svg.i, .eb-actions > p svg.i { width: 14px; height: 14px; vertical-align: -2px; }
.eb-desc { line-height: 1.65; white-space: normal; }

/* reader */
.eb-reader { background: #4A4038; margin: -2px 0 0; min-height: calc(100vh - var(--top-h)); padding: 12px 0 76px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
:root[data-theme="dark"] .eb-reader { background: #0E0A07; }
.eb-reader.zoomed { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.eb-pages { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; box-sizing: content-box; }
.eb-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); min-height: 40px; }
.eb-page canvas { display: block; }
.eb-page.img img { display: block; width: 100%; height: auto; pointer-events: none; }
.eb-status { text-align: center; color: #EDE3D1; font-size: 14px; padding: 24px 16px; }
.eb-status:empty { display: none; }
.eb-status.err { color: #FFD2C6; }
.eb-end { margin: 18px 12px 0; text-align: center; }
.eb-end svg.i { width: 34px; height: 34px; color: var(--gold); margin: 0 auto 6px; display: block; }
.eb-end h3 { font-size: 19px; color: var(--brown); }
.eb-end .btn { margin-top: 14px; }
.eb-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 999px;
  background: rgba(30,20,12,.88); color: #FFF8EA; box-shadow: 0 6px 24px rgba(0,0,0,.35); backdrop-filter: blur(6px); }
.eb-bar .icon-btn { color: #FFF8EA; font-size: 24px; font-weight: 600; width: 42px; height: 42px; line-height: 1; }
.eb-bar span { min-width: 74px; text-align: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
