/* static/style.css - polished pastel theme with subtle motion */
:root{
  --bg0:#f7ebd6;
  --bg1:#f3d2ad;
  --paper:rgba(255,246,232,.84);
  --ink:#5a3013;
  --ink-rgb:90,48,19;
  --muted:#8f5831;
  --accent:#ef8a3a;
  --accent-rgb:239,138,58;
  --accent2:#c85b18;
  --accent2-rgb:200,91,24;
  --sand:#f3d7b6;
  --card:rgba(255,244,229,.88);
  --stroke:rgba(103,57,25,.12);
  --shadow:0 18px 50px rgba(100,49,18,.12);
  --shadow2:0 10px 24px rgba(100,49,18,.16);
  --radius:18px;
  --bg-img-opacity:0;
  --bg-img-blur:.35px;
  --bg-parallax: 0px;
  --action-height:46px;
  --header-action-height:38px;
  --header-bg:rgba(249,236,211,.84);
  --header-bg-2:rgba(243,203,155,.66);
  --srm-blue:#b65a1b;
  --surface:var(--card);
  --surface-2:#f8dfbf;
  --btn:var(--accent);
  --btn-hover:#dc7426;
  --btn-text:#fff;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}

body{
  margin:0;
  font-family:"Noto Sans Tamil","Segoe UI Variable","Segoe UI",system-ui,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(120% 92% at 24% 10%, rgba(255,249,210,.98) 0%, rgba(255,247,196,.90) 24%, rgba(255,247,196,0) 54%),
    radial-gradient(70% 58% at 84% 18%, rgba(255,205,127,.42) 0%, rgba(255,205,127,.18) 28%, rgba(255,205,127,0) 58%),
    radial-gradient(76% 52% at 22% 76%, rgba(255,184,137,.20) 0%, rgba(255,184,137,0) 56%),
    radial-gradient(72% 42% at 56% 100%, rgba(255,102,28,.34) 0%, rgba(255,102,28,.12) 40%, rgba(255,102,28,0) 68%),
    linear-gradient(180deg, #f2e6d9 0%, #fff0c7 24%, #fbe7c0 46%, #f7b36d 70%, #f26f28 88%, #cb3c0c 100%);
  background-attachment:fixed;
  min-height:100vh;
  position:relative;
  z-index:0;
}

body.theme-dark{
  --bg0:#271107;
  --bg1:#4c1f0a;
  --paper:rgba(58,28,14,.88);
  --ink:#fff2e6;
  --ink-rgb:255,242,230;
  --muted:#e7bf98;
  --accent:#f1a150;
  --accent-rgb:241,161,80;
  --accent2:#c65c1a;
  --accent2-rgb:198,92,26;
  --sand:#4a2111;
  --card:rgba(68,32,16,.88);
  --stroke:rgba(255,255,255,.08);
  --shadow:0 18px 50px rgba(0,0,0,.36);
  --shadow2:0 10px 24px rgba(0,0,0,.30);
  --bg-img-opacity:0;
  --header-bg:rgba(39,18,9,.90);
  --header-bg-2:rgba(88,40,16,.72);
  --srm-blue:#ffca91;
  background:
    radial-gradient(circle at 20% 12%, rgba(255,205,139,.14), rgba(255,205,139,0) 32%),
    radial-gradient(circle at 84% 18%, rgba(230,113,35,.18), rgba(230,113,35,0) 26%),
    linear-gradient(180deg, #261006 0%, #3a1707 34%, #622408 62%, #8b320c 100%);
}

/* Layered background wash */
body::before{
  content:"";
  position:fixed;
  inset:0;
  background:
    radial-gradient(circle at 8% 12%, rgba(255,255,255,.34), transparent 22%),
    radial-gradient(circle at 84% 12%, rgba(255,221,170,.24), transparent 24%),
    radial-gradient(circle at 22% 68%, rgba(255,215,177,.16), transparent 20%),
    radial-gradient(circle at 86% 78%, rgba(255,194,104,.18) 0 2.8%, transparent 4.2%),
    radial-gradient(circle at 93% 73%, rgba(255,188,94,.12) 0 4.2%, transparent 6.1%),
    radial-gradient(circle at 74% 86%, rgba(255,168,76,.14) 0 3.4%, transparent 5%),
    linear-gradient(128deg, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 34%, rgba(255,255,255,.12) 52%, rgba(255,255,255,0) 72%);
  opacity:1;
  transform:translateY(calc(var(--bg-parallax) * -.35));
  transition:transform .2s ease;
  pointer-events:none;
  z-index:-1;
}
body.theme-dark::before{
  background:
    radial-gradient(circle at 12% 10%, rgba(255,223,179,.12), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(255,157,76,.12), transparent 24%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0) 44%);
  opacity:1;
}

/* Reveal-on-scroll (only when JS is active) */
.reveal-on-scroll{
  opacity:1;
  transform:none;
}
.js .reveal-on-scroll{
  opacity:0;
  transform:translateY(14px) scale(.99);
  transition:opacity .6s ease, transform .6s ease;
  transition-delay:var(--reveal-delay, 0ms);
  will-change:transform, opacity;
}
.js .reveal-on-scroll.reveal-in{
  opacity:1;
  transform:translateY(0) scale(1);
}
.js .chapter-card.reveal-on-scroll{
  transition-delay:calc(var(--i, 0) * 90ms);
}

/* Floating back-to-top button */
.to-top{
  position:fixed;
  right:18px;
  bottom:18px;
  width:46px;
  height:46px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.5);
  background:var(--btn);
  color:var(--btn-text);
  font-weight:900;
  cursor:pointer;
  box-shadow:0 16px 36px rgba(0,0,0,.18);
  opacity:0;
  transform:translateY(10px);
  pointer-events:none;
  transition:opacity .2s ease, transform .2s ease, filter .2s ease;
  z-index:60;
}
.to-top.show{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}
.to-top:hover{filter:saturate(1.08)}

/* ================= HEADER ================= */
.site-header{
  position:sticky;
  top:0;
  z-index:50;
  display:flex;
  flex-direction:column;
  gap:0;
  background:var(--header-bg);
  border-bottom:1px solid var(--stroke);
  backdrop-filter:blur(10px);
}

.header-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 16px;
}

.header-left{display:flex;align-items:center;gap:12px}
.logo{height:34px;filter:drop-shadow(0 6px 10px rgba(0,0,0,.08))}
.srm-text{display:flex;flex-direction:column;justify-content:center;line-height:1.15}

.srm-title{
  font-weight:800;
  letter-spacing:.3px;
  color:var(--srm-blue);
  font-size:1.15rem;
}
.srm-sub{font-size:.88rem;color:var(--muted)}

body.theme-dark .srm-title{color:var(--srm-blue)}
body.theme-dark .srm-sub{color:rgba(236,242,242,.6)}

.app-title{
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:2px;
  padding-left:12px;
  border-left:1px solid var(--stroke);
  text-align:left;
  white-space:nowrap;
}
.app-title .thirukkural-title{
  font-size:25px;
  line-height:1.1;
}
.app-title .subtitle{
  font-size:.86rem;
}

.header-nav{
  display:flex;
  align-items:center;
  gap:12px;
  flex:0 1 auto;
}
.header-nav a{
  text-decoration:none;
  color:var(--ink);
  font-weight:700;
  padding:6px 10px;
  border-radius:999px;
  transition:background .18s ease, color .18s ease;
}
.header-nav a:hover{
  background:rgba(255,255,255,.55);
  color:var(--ink);
}

body.theme-dark .header-nav a:hover{
  background:rgba(255,255,255,.08);
}

.header-right{
  display:flex;
  align-items:center;
  gap:12px;
  flex:0 1 auto;
  justify-content:flex-end;
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
}

.search-box{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:var(--paper);
  height:var(--header-action-height);
  width:clamp(96px, 12vw, 120px);
  font-size:.9rem;
  outline:none;
  transition:box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.search-box:focus{
  border-color:rgba(var(--accent-rgb),.55);
  box-shadow:0 10px 24px rgba(var(--accent-rgb),.15);
  transform:translateY(-1px);
}

.header-actions button{
  border:none;
  height:var(--header-action-height);
  padding:0 12px;
  border-radius:10px;
  cursor:pointer;
  color:var(--btn-text);
  font-weight:700;
  letter-spacing:.2px;
  box-shadow:0 12px 26px rgba(0,0,0,.12);
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
  background:var(--btn);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:84px;
  font-size:.88rem;
  line-height:1;
  white-space:nowrap;
}
.header-actions button:hover{transform:translateY(-1px);filter:saturate(1.05)}
.header-actions button:active{transform:translateY(0);box-shadow:0 8px 18px rgba(0,0,0,.12)}

.profile-menu{
  position:relative;
}

.profile-trigger{
  width:36px;
  height:36px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:var(--paper);
  border:1px solid var(--stroke);
  box-shadow:0 10px 22px rgba(0,0,0,.12);
  color:var(--ink);
  cursor:pointer;
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.profile-trigger:hover{transform:translateY(-1px);filter:saturate(1.05)}
.profile-trigger:active{transform:translateY(0)}
.profile-trigger svg{width:18px;height:18px;fill:currentColor}

.profile-dropdown{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  min-width:210px;
  background:var(--paper);
  border:1px solid var(--stroke);
  border-radius:14px;
  box-shadow:var(--shadow2);
  padding:8px;
  opacity:0;
  transform:translateY(-6px);
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  z-index:60;
}
.profile-menu.open .profile-dropdown{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

.menu-group{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.menu-item{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:8px 12px;
  border-radius:10px;
  border:none;
  background:transparent;
  color:var(--ink);
  font-weight:700;
  font-size:.88rem;
  text-decoration:none;
  cursor:pointer;
  transition:background .16s ease, color .16s ease;
}
.menu-item:hover{
  background:rgba(255,255,255,.65);
}

body.theme-dark .menu-item:hover{
  background:rgba(255,255,255,.08);
}

.theme-toggle .theme-state{
  font-size:.78rem;
  font-weight:800;
  color:var(--muted);
}

.menu-divider{
  height:1px;
  background:var(--stroke);
  margin:8px 2px;
}

body[data-auth="guest"] .auth-user{display:none}
body[data-auth="user"] .auth-guest{display:none}

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

.header-title-section{
  text-align:center;
  margin-top:0;
  padding:2px 16px 6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.thirukkural-title{
  margin:0;
  font-size:30px;
  font-weight:800;
  letter-spacing:.5px;
  line-height:1.1;
}
.subtitle{
  margin:0;
  color:var(--muted);
  font-weight:600;
  font-size:.86rem;
}

.home-link{
  text-decoration:none;
  color:inherit;
  display:inline-block;
  transform:translateY(0);
  transition:transform .25s ease;
}
.home-link:hover{transform:translateY(-1px)}

.header-controls{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  margin:4px auto 0;
}

.play-all-btn{
  border:none;
  height:var(--header-action-height);
  padding:0 14px;
  border-radius:10px;
  cursor:pointer;
  color:#fff;
  font-weight:700;
  letter-spacing:.2px;
  box-shadow:0 12px 26px rgba(0,0,0,.12);
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
  background:linear-gradient(135deg, var(--accent2), var(--accent));
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:84px;
  font-size:.88rem;
  line-height:1;
  white-space:nowrap;
}
.play-all-btn:hover{transform:translateY(-1px);filter:saturate(1.05)}
.play-all-btn:active{transform:translateY(0);box-shadow:0 8px 18px rgba(0,0,0,.12)}

.header-credit{
  font-size:12px;
  font-weight:700;
  letter-spacing:.2px;
  color:rgba(0,0,0,.55);
  text-align:right;
  line-height:1.25;
  max-width:320px;
}
.header-credit span{display:block}
.header-credit strong{font-weight:900;color:rgba(0,0,0,.75)}

/* ================= LANDING ================= */
.landing{
  padding:34px 22px;
  text-align:center;
}
.landing h2{
  margin:0;
  font-size:30px;
  letter-spacing:.2px;
}

.parts{
  display:flex;
  gap:16px;
  justify-content:center;
  margin-top:16px;
  flex-wrap:wrap;
}

.part-btn{
  padding:16px 22px;
  border-radius:999px;
  background:var(--surface);
  color:var(--ink);
  text-decoration:none;
  font-weight:800;
  border:1px solid var(--stroke);
  box-shadow:var(--shadow);
  transition:transform .22s ease, box-shadow .22s ease, background .22s ease;
}
.part-btn:hover{transform:translateY(-3px);box-shadow:var(--shadow2);background:var(--surface-2)}

/* Tailwind handles pagination, tabs, and list layout for the /part page. */

.speaker-panel{
  position:sticky;
  top:116px; /* below sticky header */
  align-self:start;
}

.speaker-card{
  background:linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.54));
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px 14px;
  overflow:visible;
  position:relative;
  backdrop-filter:blur(12px);
  transition:transform .2s ease, box-shadow .2s ease;
}
.speaker-card::before{content:none}
.speaker-card > *{
  position:relative;
  z-index:1;
}
.speaker-card:hover{
  transform:translateY(-2px);
  box-shadow:0 22px 56px rgba(0,0,0,.14);
}

.speaker-visual{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px 0 14px;
}

.speaker-visual::before{
  content:"";
  position:absolute;
  inset:-10px;
  border-radius:32px;
  background:radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb),.28), transparent 65%);
  opacity:0;
  transform:scale(.96);
  z-index:0;
  transition:opacity .2s ease;
}

.speaker-portrait{
  width:220px;
  height:220px;
  object-fit:cover;
  border-radius:26px;
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 22px 56px rgba(0,0,0,.14);
  transform:translateZ(0);
  position:relative;
  z-index:1;
}

.speaker-bubble{
  position:absolute;
  right:-8px;
  top:16px;
  transform:translateX(8%);
  min-width:140px;
  max-width:200px;
  padding:10px 12px;
  border-radius:16px;
  background:linear-gradient(135deg, rgba(255,255,255,.95), rgba(255,236,205,.92));
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 16px 36px rgba(0,0,0,.16);
  display:flex;
  flex-direction:column;
  gap:4px;
  opacity:.85;
  transition:opacity .2s ease, transform .2s ease, box-shadow .2s ease;
  z-index:2;
}

.speaker-wave{
  position:absolute;
  bottom:14px;
  left:50%;
  transform:translateX(-50%);
  display:flex;
  gap:6px;
  opacity:0;
  transition:opacity .2s ease;
  z-index:2;
}
.speaker-wave span{
  width:6px;
  height:12px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(var(--accent-rgb),.95), rgba(var(--accent2-rgb),.75));
  box-shadow:0 6px 12px rgba(0,0,0,.18);
  transform-origin:center bottom;
}

.speaker-bubble::after{
  content:"";
  position:absolute;
  left:-8px;
  top:18px;
  width:14px;
  height:14px;
  background:inherit;
  border-left:1px solid rgba(0,0,0,.08);
  border-bottom:1px solid rgba(0,0,0,.08);
  transform:rotate(45deg);
}

.bubble-label{
  font-size:11px;
  font-weight:800;
  letter-spacing:.2px;
  /* Bubble background is always light, so keep this text dark in both themes. */
  color:rgba(90,48,19,.65);
  text-transform:uppercase;
}

.bubble-word{
  font-size:16px;
  font-weight:900;
  /* Bubble background is always light, so keep this text dark in both themes. */
  color:#1a0f06;
}

.speaker-panel.speaking .speaker-bubble{
  opacity:1;
  transform:translateX(8%) translateY(-2px);
  box-shadow:0 18px 42px rgba(0,0,0,.20);
}

.speaker-panel.speaking .speaker-visual::before{
  opacity:1;
}
.speaker-panel.speaking .speaker-wave{
  opacity:1;
}

.speaker-info{
  margin-top:10px;
  text-align:center;
}
.speaker-title{
  font-weight:900;
  letter-spacing:.2px;
}
.speaker-status{
  margin-top:6px;
  font-weight:800;
  /* Speaker card background is always light, so keep this text dark in both themes. */
  color:rgba(90,48,19,.78);
}
.speaker-now{
  margin-top:8px;
  font-size:14px;
  /* Own background below is always light, so keep this text dark in both themes. */
  color:rgba(90,48,19,.85);
  line-height:1.35;
  padding:6px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.55);
  border:1px solid rgba(0,0,0,.08);
  display:inline-block;
}
.speaker-stop{
  margin-top:12px;
  border:none;
  padding:10px 14px;
  border-radius:12px;
  cursor:pointer;
  color:#fff;
  font-weight:800;
  letter-spacing:.2px;
  box-shadow:0 12px 26px rgba(0,0,0,.12);
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease;
  background:linear-gradient(135deg, var(--accent2), var(--accent));
  width:100%;
  position:relative;
  overflow:hidden;
}
.speaker-stop:hover{transform:translateY(-1px);filter:saturate(1.05)}
.speaker-stop:active{transform:translateY(0);box-shadow:0 8px 18px rgba(0,0,0,.12)}
.speaker-stop:disabled{
  opacity:.55;
  cursor:default;
  pointer-events:none;
  filter:grayscale(.1);
}
.speaker-stop::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  opacity:.5;
  transform:translateX(-120%);
  pointer-events:none;
}

/* Avatar */
.avatar{
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:8px 0 12px;
  position:relative;
}
.avatar::before{
  content:"";
  position:absolute;
  top:6px;
  left:50%;
  width:240px;
  height:240px;
  transform:translateX(-50%);
  border-radius:999px;
  background:
    radial-gradient(circle at 50% 45%, rgba(var(--accent2-rgb),.18), transparent 62%),
    radial-gradient(circle at 55% 30%, rgba(var(--accent-rgb),.14), transparent 60%);
  pointer-events:none;
}
.avatar > *{
  position:relative;
  z-index:1;
}

.avatar-head{
  width:132px;
  height:132px;
  border-radius:999px;
  background:
    radial-gradient(100px 90px at 35% 28%, rgba(255,255,255,.92), rgba(255,240,222,.88) 55%, rgba(239,210,171,.80) 100%);
  border:1px solid rgba(0,0,0,.07);
  box-shadow:0 22px 56px rgba(0,0,0,.12);
  position:relative;
}
.avatar-head::before{
  content:"";
  position:absolute;
  left:-2px;
  right:-2px;
  top:-2px;
  height:56px;
  border-radius:999px 999px 70px 70px;
  background:linear-gradient(180deg, rgba(21,53,52,.22), rgba(21,53,52,0));
  opacity:.85;
  pointer-events:none;
}
.avatar-head::after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:999px;
  background:radial-gradient(90px 70px at 30% 25%, rgba(255,255,255,.55), transparent 62%);
  pointer-events:none;
}

.avatar-face{
  position:absolute;
  inset:0;
}
.avatar-face::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:999px;
  background:
    radial-gradient(30px 24px at 34% 64%, rgba(255,130,150,.13), transparent 70%),
    radial-gradient(30px 24px at 66% 64%, rgba(255,130,150,.13), transparent 70%);
  pointer-events:none;
}
.avatar-face::after{
  content:"";
  position:absolute;
  top:64px;
  left:50%;
  width:14px;
  height:10px;
  transform:translateX(-50%);
  border-radius:0 0 10px 10px;
  background:rgba(var(--ink-rgb),.08);
  box-shadow:0 1px 0 rgba(255,255,255,.35) inset;
  opacity:.7;
}

.avatar-eye{
  position:absolute;
  top:52px;
  width:22px;
  height:22px;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(0,0,0,.10);
  box-shadow:0 10px 22px rgba(0,0,0,.10);
  overflow:hidden;
}
.avatar-eye::after{
  content:"";
  position:absolute;
  top:6px;
  left:7px;
  width:10px;
  height:10px;
  border-radius:999px;
  background:radial-gradient(circle at 35% 35%, rgba(255,255,255,.55), rgba(var(--ink-rgb),.72) 45%, rgba(var(--ink-rgb),.92) 100%);
  box-shadow:0 6px 10px rgba(0,0,0,.10);
}
.avatar-eye::before{
  content:"";
  position:absolute;
  top:4px;
  left:5px;
  width:6px;
  height:6px;
  border-radius:999px;
  background:rgba(255,255,255,.65);
}
.avatar-eye.left{left:38px}
.avatar-eye.right{right:38px}
.avatar-mouth{
  position:absolute;
  top:84px;
  left:50%;
  width:54px;
  height:18px;
  transform:translateX(-50%);
  border-radius:999px;
  background:rgba(var(--ink-rgb),.10);
  border:1px solid rgba(var(--ink-rgb),.18);
  box-shadow:inset 0 8px 18px rgba(0,0,0,.08);
  overflow:hidden;
}
.avatar-mouth::after{
  content:"";
  position:absolute;
  bottom:-7px;
  left:50%;
  width:30px;
  height:18px;
  transform:translateX(-50%);
  border-radius:999px;
  background:rgba(255,120,140,.22);
}
.avatar-neck{
  width:26px;
  height:14px;
  background:linear-gradient(180deg, rgba(255,240,222,.85), rgba(239,210,171,.55));
  border:1px solid rgba(0,0,0,.07);
  border-top:none;
  border-radius:0 0 12px 12px;
  margin-top:-2px;
}
.avatar-body{
  width:204px;
  height:124px;
  border-radius:26px;
  background:
    radial-gradient(120px 90px at 18% 45%, rgba(var(--accent2-rgb),.18), transparent 70%),
    radial-gradient(120px 90px at 82% 48%, rgba(var(--accent-rgb),.16), transparent 70%),
    linear-gradient(135deg, rgba(var(--accent2-rgb),.22), rgba(var(--accent-rgb),.16));
  border:1px solid rgba(0,0,0,.07);
  box-shadow:0 22px 56px rgba(0,0,0,.10);
  position:relative;
  overflow:hidden;
}
.avatar-body::before{
  content:"";
  position:absolute;
  top:-18px;
  left:50%;
  width:120px;
  height:70px;
  transform:translateX(-50%);
  border-radius:999px;
  background:radial-gradient(circle at 50% 60%, rgba(255,255,255,.55), transparent 68%);
  opacity:.85;
}
.avatar-body::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(100deg, transparent, rgba(255,255,255,.34), transparent);
  opacity:.45;
  transform:translateX(-38%);
  pointer-events:none;
}

/* Microphone */
.avatar-mic{
  position:absolute;
  left:50%;
  top:162px;
  transform:translateX(-50%);
  width:50px;
  height:50px;
  border-radius:999px;
  background:rgba(255,255,255,.66);
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 16px 34px rgba(0,0,0,.14);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:3;
}
.avatar-mic::before{
  content:"";
  width:14px;
  height:22px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(var(--ink-rgb),.36), rgba(var(--ink-rgb),.22));
  box-shadow:inset 0 2px 0 rgba(255,255,255,.35);
}
.avatar-mic::after{
  content:"";
  position:absolute;
  inset:6px;
  border-radius:999px;
  border:2px solid rgba(var(--accent-rgb),.22);
  opacity:0;
  transform:scale(.82);
}

/* Tailwind handles the kural cards, text highlights, and explanation toggles. */
/* ================= AUTH ================= */
.auth-page{
  max-width:720px;
  margin:24px auto 48px;
  padding:0 18px;
}
.auth-card{
  background:linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.68));
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:22px 24px;
}
.auth-card h2{
  margin:0 0 14px;
  font-size:24px;
  font-weight:900;
}
.auth-grid{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.auth-form{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.auth-label{
  font-weight:700;
  font-size:.88rem;
  color:var(--muted);
}
.auth-form input{
  height:40px;
  border-radius:10px;
  border:1px solid var(--stroke);
  padding:8px 12px;
  background:var(--paper);
  font-size:.95rem;
  outline:none;
}
.auth-form input:focus{
  border-color:rgba(var(--accent-rgb),.55);
  box-shadow:0 8px 18px rgba(var(--accent-rgb),.15);
}
.auth-primary,
.auth-secondary,
.google-btn{
  height:40px;
  border-radius:10px;
  border:none;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-decoration:none;
}
.auth-primary{
  background:linear-gradient(135deg, var(--accent2), var(--accent));
  color:#fff;
}
.auth-secondary{
  background:linear-gradient(135deg, rgba(var(--accent2-rgb),.16), rgba(var(--accent-rgb),.16));
  color:var(--ink);
  border:1px solid var(--stroke);
}
.google-btn{
  background:#fff;
  border:1px solid var(--stroke);
  color:#202124;
  box-shadow:0 8px 18px rgba(0,0,0,.08);
}
.auth-divider{
  text-align:center;
  font-weight:800;
  color:var(--muted);
}
.auth-foot{
  margin:14px 0 0;
  font-weight:700;
}
.auth-foot a{
  color:var(--accent2);
  text-decoration:none;
  font-weight:900;
}
.flash-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:12px;
}
.flash{
  padding:8px 12px;
  border-radius:10px;
  font-weight:700;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.8);
}
.flash.error{color:#b23b3b}
.flash.success{color:#1d7d63}
.flash.info{color:#295b8c}
.profile-info{
  display:flex;
  flex-direction:column;
  gap:8px;
  font-weight:700;
}
.settings-note{
  margin:0;
  color:var(--muted);
  font-weight:700;
}

/* Tailwind handles highlight rings for search results. */

/* ================= MOBILE ================= */
@media (max-width:980px){
  .header-top{padding:8px 16px;flex-wrap:wrap;row-gap:8px}
  .header-title-section{padding:4px 16px 8px}
  .header-left{min-width:0}
  .header-right{flex:1 1 100%;justify-content:space-between}
  .header-actions{justify-content:flex-end;flex-wrap:wrap}
  .thirukkural-title{font-size:28px}
  .search-box{width:clamp(96px, 18vw, 120px)}
  .logo{height:36px}
  .app-title{padding-left:10px}
  .app-title .thirukkural-title{font-size:20px}
  .app-title .subtitle{font-size:.78rem}

  .speaker-panel{
    position:static;
  }

  .speaker-portrait{
    width:200px;
    height:200px;
  }
  .speaker-bubble{
    position:static;
    transform:none;
    margin-top:10px;
  }
  .speaker-bubble::after{
    display:none;
  }
}

@media (max-width:760px){
  .header-nav{display:none}
  .header-top{flex-wrap:wrap;justify-content:space-between;row-gap:10px}
  .header-left{order:1}
  .header-right{order:2;flex-wrap:wrap;justify-content:space-between;gap:10px}
  .header-actions{flex:1;justify-content:flex-start}
  .search-box{width:min(100%, 160px)}
  .app-title{white-space:normal;padding-left:8px}
  .header-credit{text-align:center}
  .parts{flex-direction:column}
}

@media (prefers-reduced-motion: reduce){
  *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
}
