/* Tamizh Thedal · Glass Design System (iravu dark default, pagal light) */
:root {
  --m-half: 120ms;
  --m-one: 240ms;
  --m-two: 480ms;
  --m-three: 720ms;
  --nool: #E5484D;
  --nool-text: #E5484D;
  --manjal: #F2B544;
  --ezhuthu: #19A7A0;
  --sol: #8FD16A;
  --porul: #9A8CFF;
  --kaavi: #FF9F5A;
}

:root, :root[data-theme="iravu"] {
  --bg: #0B1026;
  --text: #F4F1EA;
  --muted: #C9CEE6;
  --glass: rgba(255, 255, 255, .07);
  --glass-border: rgba(255, 255, 255, .16);
  --glass-shadow: 0 18px 50px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .2);
  --dot: rgba(255, 255, 255, .13);
  --surface-flat: #151C3B;
  --pill-active-bg: #F2B544;
  --pill-active-fg: #1B1E3C;
  --blob-a: #19A7A0;
  --blob-b: #6D5DF0;
  --blob-c: #E0572F;
  --blob-op-a: .5;
  --blob-op-b: .5;
  --blob-op-c: .42;
  --nool-text: #FF7B7F;
}

:root[data-theme="pagal"] {
  --bg: #EEF0F8;
  --text: #1B1E3C;
  --muted: #4A4F73;
  --glass: rgba(255, 255, 255, .55);
  --glass-border: rgba(255, 255, 255, .9);
  --glass-shadow: 0 18px 44px rgba(40, 44, 90, .14), inset 0 1px 0 rgba(255, 255, 255, .9);
  --dot: rgba(27, 30, 60, .13);
  --surface-flat: #FFFFFF;
  --pill-active-bg: #F2B544;
  --pill-active-fg: #1B1E3C;
  --blob-a: #7FD6CF;
  --blob-b: #B9B0FF;
  --blob-c: #FFC38A;
  --blob-op-a: .7;
  --blob-op-b: .7;
  --blob-op-c: .7;
  --nool-text: #A8322E;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Anek Tamil", "Anek Latin", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  transition: background var(--m-one) ease-out, color var(--m-one) ease-out;
}
@media (max-width: 640px) {
  body { font-size: 17px; padding-bottom: 84px; }
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.serif { font-family: "Noto Serif Tamil", serif; font-weight: 600; line-height: 1.8; white-space: pre-line; }

/* Background layer: 3 drifting colour fields + 30px kolam dot grid */
.tt-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.tt-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: tt-drift 14s ease-in-out infinite;
  will-change: transform;
}
.tt-blob.a { width: 520px; height: 520px; left: -140px; top: -160px; background: var(--blob-a); opacity: var(--blob-op-a); }
.tt-blob.b { width: 560px; height: 560px; right: -160px; top: 80px; background: var(--blob-b); opacity: var(--blob-op-b); animation-delay: -5s; }
.tt-blob.c { width: 480px; height: 480px; left: 36%; bottom: -260px; background: var(--blob-c); opacity: var(--blob-op-c); animation-delay: -9s; }
.tt-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.7px);
  background-size: 30px 30px;
}

/* Glass Panel */
.g {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
}
@supports not (backdrop-filter: blur(22px)) {
  .g { background: var(--surface-flat); }
}
:root[data-lite="1"] .g {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--surface-flat);
}

/* Motion */
@keyframes tt-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.12); }
}
@keyframes tt-draw { from { stroke-dashoffset: 1600; } to { stroke-dashoffset: 0; } }
@keyframes tt-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 181, 68, .55); }
  50% { box-shadow: 0 0 0 14px rgba(242, 181, 68, 0); }
}
@keyframes tt-floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes tt-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.draw { stroke-dasharray: 1600; animation: tt-draw 3.2s ease-out both; }
.pulse { animation: tt-glow 1.9s ease-out infinite; }
.float { animation: tt-floaty 5s ease-in-out infinite; }
.screen-enter { animation: tt-rise var(--m-one) ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .tt-blob, .draw, .pulse, .float, .screen-enter { animation: none !important; }
  * { transition-duration: 0.01ms !important; }
}

/* App Shell */
.tt-shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (max-width: 760px) {
  .tt-shell { padding: 16px 16px 32px; gap: 16px; }
}

.tt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.tt-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 21px;
  min-height: 44px;
}
.tt-brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--nool);
  box-shadow: 0 0 16px var(--nool);
}
.tt-brand-sub { font-size: 12px; font-weight: 600; color: var(--muted); }

.tt-nav {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
}
.tt-nav button, .tt-nav a {
  text-decoration: none;
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--m-half), background var(--m-one), color var(--m-one);
}
.tt-nav button span.sub, .tt-nav a span.sub { font-size: 12px; opacity: .75; }
.tt-nav button.active, .tt-nav a.active {
  background: var(--pill-active-bg);
  color: var(--pill-active-fg);
}
.tt-nav button:active, .tt-nav a:active, .tt-pill:active, .btn-nool:active {
  transform: scale(0.97);
}

.tt-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tt-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform var(--m-half), border-color var(--m-half);
}
.tt-pill:hover { border-color: var(--manjal); }

.tt-depth { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; min-height: 44px; }
.tt-depth-bars { display: inline-flex; gap: 4px; }
.tt-depth-bars button {
  width: 18px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(128, 128, 150, .38);
  transition: background var(--m-half), transform var(--m-half);
}
.tt-depth-bars button.on { background: var(--nool); }

.btn-nool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--nool);
  color: #fff;
  border: none;
  padding: 13px 28px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  min-height: 46px;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(229, 72, 77, .35);
  transition: transform var(--m-half);
}
.btn-manjal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--manjal);
  color: #1B1E3C;
  border: none;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  min-height: 46px;
  text-decoration: none;
  transition: transform var(--m-half);
}

/* Sutra Palm-Leaf Card */
.olai-leaf {
  position: relative;
  border-radius: 60px 24px 24px 60px;
  padding: 22px 22px 22px 46px;
}
.olai-leaf::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 40px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
}

/* Phone Bottom Tab Bar */
.tt-tabbar {
  display: none;
}
@media (max-width: 720px) {
  .tt-nav.desktop-only { display: none; }
  .tt-tabbar {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 14px;
    z-index: 50;
    display: flex;
    border-radius: 26px;
    padding: 4px 8px;
  }
  .tt-tabbar button, .tt-tabbar a {
    flex: 1;
    border: none;
    background: transparent;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 0;
    min-height: 48px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
  }
  .tt-tabbar button.active, .tt-tabbar a.active { color: var(--manjal); }
}

.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
