/* ============================================================================
   TALAIYA STUDY — DESIGN SYSTEM (Deep Midnight Navy + Electric Aqua + Gold)
   Distinct Pond/Water-Inspired UI with full Light & Dark Modes + Devanagari
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Sora:wght@600;700;800&display=swap');

:root {
  /* Light Mode — Misty Pond */
  --bg: #F3F8FD;
  --surface: #FFFFFF;
  --surface-2: #E8F3FC;
  --surface-glass: rgba(255, 255, 255, 0.86);
  --navy: #020B1C;
  --navy-2: #071630;
  --navy-3: #0D2245;

  --primary: #0091EA;
  --primary-hover: #0077C2;
  --aqua: #00B4FF;
  --aqua-bright: #00E5FF;
  --primary-soft: rgba(0, 180, 255, 0.11);
  --primary-ring: rgba(0, 180, 255, 0.25);

  --gold: #FACC15;
  --gold-deep: #D97706;
  --gold-soft: rgba(250, 204, 21, 0.16);

  --green: #16A34A;
  --green-soft: rgba(22, 163, 74, 0.12);
  --red: #EF4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --purple: #7C3AED;
  --purple-soft: rgba(124, 58, 237, 0.12);

  --text: #09172E;
  --text-2: #4A607D;
  --text-3: #7A91AD;
  --border: #D4E4F4;
  --border-strong: rgba(0, 145, 234, 0.28);

  --shadow-sm: 0 2px 10px rgba(2, 11, 28, 0.05);
  --shadow-md: 0 10px 28px rgba(2, 11, 28, 0.08);
  --shadow-aqua: 0 10px 28px rgba(0, 180, 255, 0.26);

  --rail-w: 248px;
  --topbar-h: 64px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans Devanagari', system-ui, -apple-system, sans-serif;
  --font-head: 'Sora', 'Noto Sans Devanagari', system-ui, sans-serif;
}

html.dark-mode,
body.dark-mode {
  /* Dark Mode — Deep Midnight Talaiya */
  --bg: #020B1C;
  --surface: #071630;
  --surface-2: #0D2245;
  --surface-glass: rgba(7, 22, 48, 0.88);
  --text: #F0F8FF;
  --text-2: #9AB6D6;
  --text-3: #6482A6;
  --border: rgba(0, 180, 255, 0.16);
  --border-strong: rgba(0, 229, 255, 0.35);
  --primary: #00B4FF;
  --primary-hover: #00E5FF;
  --primary-soft: rgba(0, 180, 255, 0.15);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.5);
  --shadow-aqua: 0 10px 30px rgba(0, 180, 255, 0.32);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color 0.22s ease, color 0.22s ease;
}

a { color: inherit; }

/* ============================================================================
   APP SHELL: DESKTOP LEFT RAIL + TOP BAR + MOBILE FLOATING DOCK
   ============================================================================ */
.ts-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ts-rail {
  display: none;
}

@media (min-width: 960px) {
  .ts-rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--rail-w);
    background: var(--navy);
    color: #EAF6FF;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    border-right: 1px solid rgba(0, 180, 255, 0.16);
    z-index: 900;
  }
  .ts-main-wrap {
    margin-left: var(--rail-w);
    min-height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .ts-topbar {
    margin-left: var(--rail-w);
    width: calc(100% - var(--rail-w));
  }
  .ts-main-wrap .ts-topbar {
    margin-left: 0;
    width: 100%;
  }
}

.ts-rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.ts-rail-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 16px rgba(0, 180, 255, 0.35);
}
.ts-rail-brand .b-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  line-height: 1.15;
}
.ts-rail-brand .b-sub {
  font-size: 10.5px;
  color: #7DD3FC;
  font-weight: 600;
  margin-top: 2px;
}

.ts-rail-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
  overflow-y: auto;
}
.ts-rail-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: #A8C7E5;
  text-decoration: none;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.ts-rail-link i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}
.ts-rail-link:hover {
  background: rgba(0, 180, 255, 0.10);
  color: #FFFFFF;
}
.ts-rail-link.active {
  background: linear-gradient(135deg, rgba(0, 180, 255, 0.24), rgba(0, 229, 255, 0.10));
  color: #FFFFFF;
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 180, 255, 0.16);
}
.ts-rail-link.active i { color: var(--aqua-bright); }
.ts-rail-link.is-gold { color: #FDE047; }
.ts-rail-link.is-gold.active {
  background: rgba(250, 204, 21, 0.15);
  border-color: rgba(250, 204, 21, 0.4);
}

.ts-rail-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* TOP BAR */
.ts-topbar {
  position: sticky;
  top: 0;
  z-index: 800;
  height: var(--topbar-h);
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 10px;
}
@media (min-width: 960px) {
  .ts-topbar { padding: 0 28px; }
}

.ts-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ts-burger {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}
@media (min-width: 960px) {
  .ts-burger.mobile-only { display: none; }
}

.ts-mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.ts-mobile-brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
.ts-mobile-brand span {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}
@media (min-width: 960px) {
  .ts-mobile-brand { display: none; }
}

.ts-top-search {
  display: none;
}
@media (min-width: 720px) {
  .ts-top-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    width: 280px;
    max-width: 100%;
    cursor: pointer;
    color: var(--text-2);
    font-size: 13px;
    transition: border-color 0.2s;
  }
  .ts-top-search:hover { border-color: var(--primary); }
}

.ts-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ts-lang-pill {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.ts-lang-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s;
}
.ts-lang-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 180, 255, 0.3);
}

.ts-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.16s, transform 0.15s;
}
.ts-icon-btn:hover { border-color: var(--primary); }
.ts-notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--surface);
  display: none;
}
.ts-notif-dot.show { display: block; }

.ts-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
}
.ts-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-2), var(--primary));
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  overflow: hidden;
}
.ts-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.ts-mob-search-btn { display: inline-flex; }
@media (min-width: 720px) {
  .ts-mob-search-btn { display: none; }
}

@media (max-width: 520px) {
  .ts-topbar { padding: 0 10px; gap: 6px; height: 58px; }
  .ts-burger { width: 34px; height: 34px; font-size: 14px; border-radius: 9px; }
  .ts-mobile-brand { gap: 6px; min-width: 0; }
  .ts-mobile-brand img { width: 28px; height: 28px; flex-shrink: 0; }
  .ts-mobile-brand span { font-size: 13px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ts-top-actions { gap: 5px; }
  .ts-lang-btn { padding: 4px 6.5px; font-size: 10.5px; }
  .ts-icon-btn { width: 32px; height: 32px; font-size: 13px; border-radius: 9px; }
  .ts-avatar-btn { padding: 2px; }
  .ts-avatar-circle { width: 28px; height: 28px; font-size: 11px; }
  #tsTopUserName { display: none; }
}

/* MAIN CONTENT CONTAINER */
.ts-page {
  width: 100%;
  min-width: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 12px 108px;
}
@media (min-width: 640px) {
  .ts-page { padding: 20px 18px 105px; }
}
@media (min-width: 960px) {
  .ts-page { padding: 26px 28px 48px; }
}

/* MOBILE FLOATING BOTTOM DOCK (Distinct from Borderland's flat bar) */
.ts-bottom-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 64px;
  background: var(--navy);
  border: 1px solid rgba(0, 180, 255, 0.25);
  border-radius: 22px;
  box-shadow: 0 14px 36px rgba(2, 11, 28, 0.42);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 6px;
  z-index: 850;
}
@media (min-width: 960px) {
  .ts-bottom-dock { display: none; }
}
.ts-dock-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #8FB2D8;
  font-size: 10px;
  font-weight: 700;
  height: 100%;
}
.ts-dock-item i { font-size: 17px; }
.ts-dock-item.active { color: var(--aqua-bright); }

/* Center Glowing RankUp Orb in Mobile Dock */
.ts-dock-orb-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: -22px;
}
.ts-dock-orb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--aqua-bright));
  color: #020B1C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 8px 22px rgba(0, 229, 255, 0.45);
  border: 3px solid var(--bg);
}
.ts-dock-orb-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--aqua-bright);
  margin-top: 2px;
}

/* SLIDE-IN ACCOUNT / SETTINGS DRAWER */
.ts-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 11, 28, 0.62);
  backdrop-filter: blur(4px);
  z-index: 1200;
  display: none;
}
.ts-drawer-overlay.open { display: block; }
.ts-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(320px, 86vw);
  background: var(--surface);
  color: var(--text);
  z-index: 1201;
  transform: translateX(-105%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  box-shadow: 20px 0 50px rgba(2, 11, 28, 0.3);
}
.ts-drawer.open { transform: translateX(0); }

.ts-drawer-head {
  background: linear-gradient(145deg, var(--navy) 0%, var(--navy-3) 100%);
  color: #FFFFFF;
  padding: 20px 18px 18px;
  position: relative;
}
.ts-drawer-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #FFFFFF;
  cursor: pointer;
}
.ts-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ts-drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.ts-drawer-item:hover { background: var(--surface-2); }
.ts-drawer-item i { width: 18px; text-align: center; color: var(--primary); }

/* CARDS & BUTTONS */
.ts-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.ts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.ts-btn:active { transform: scale(0.98); }
.ts-btn-aqua {
  background: linear-gradient(135deg, var(--primary), var(--aqua-bright));
  color: #020B1C;
  box-shadow: var(--shadow-aqua);
}
.ts-btn-gold {
  background: linear-gradient(135deg, #FACC15, #F59E0B);
  color: #020B1C;
  box-shadow: 0 8px 22px rgba(250, 204, 21, 0.28);
}
.ts-btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

/* MODALS & OVERLAYS */
.ts-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 11, 28, 0.78);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ts-modal-backdrop.open { display: flex; }
.ts-modal-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px 22px;
  box-shadow: 0 24px 60px rgba(2, 11, 28, 0.55);
  position: relative;
}

.ts-toast {
  position: fixed;
  left: 50%;
  bottom: 108px;
  max-width: calc(100vw - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: #FFFFFF;
  border: 1px solid var(--aqua);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(2, 11, 28, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 4000;
}
@media (min-width: 960px) {
  .ts-toast { bottom: 28px; }
}
.ts-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* TOGGLE SWITCH */
.ts-switch {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.ts-switch.on { background: var(--primary); }
.ts-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s;
}
.ts-switch.on::after { transform: translateX(20px); }

/* LANGUAGE PICKER CARDS */
.lang-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.lang-pick-card {
  border: 2px solid var(--border);
  background: var(--surface-2);
  border-radius: 18px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.lang-pick-card:hover,
.lang-pick-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-aqua);
}
.lang-pick-card .lp-glyph {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.lang-pick-card .lp-title {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
}
.lang-pick-card .lp-sub {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 3px;
}

.hidden { display: none !important; }
