:root{
    --ink:#26313f;
    --paper:#ffffff;
    --grid-line:#e2e6ea;
    --math:#c1502e;
    --science:#3d7d5c;
    --english:#4f5fa8;
    --history:#b8862f;
    --focus:#c1476b;
    --shop:#2b8a73;
    --premium:#a8681f;
    --bg: #f5f6f8;
    --accent: var(--english);
    --radius: 14px;
    --font-body: 'Inter', sans-serif;
    --font-head: 'Poppins', sans-serif;
    --chrome-bg: #26313f;
    --chrome-text: #ffffff;
  }
  body.dark{
    --ink:#e8ecf5;
    --paper:#1c2436;
    --grid-line:#2c374f;
    --bg:#131a29;
    --chrome-bg:#0a0e17;
    --chrome-text:#ffffff;
  }
  /* Dark mode: black shadows barely read on a dark background, so cards
     get their sense of depth from a faint light hairline instead. */
  body.dark .page{ box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 10px 30px rgba(0,0,0,0.4); }
  body.dark .topbar{ box-shadow: 0 1px 0 rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.4); }
  body.dark .home-card, body.dark .shop-card, body.dark .benefit{
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 20px rgba(0,0,0,0.35);
  }
  body.dark .home-card:hover{ box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 12px 26px rgba(0,0,0,0.45); }
  body.dark .shop-card:hover{ box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 10px 22px rgba(0,0,0,0.4); }
  body.dark .wp-card{ box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }
  body.dark .wp-card:not(.locked):hover{ box-shadow: 0 0 0 1px rgba(255,255,255,0.16), 0 10px 22px rgba(0,0,0,0.4); }
  html{ font-size:113%; }
  *{ box-sizing:border-box; }
  input[type="checkbox"]{ accent-color: var(--accent); width:16px; height:16px; }
  button{
    font-family:var(--font-body); font-weight:600; cursor:pointer;
    transition: transform 0.15s var(--spring, ease), opacity 0.15s var(--ease, ease), box-shadow 0.15s var(--ease, ease);
  }
  button:active{ transform: scale(0.96); }
  input:not([type="checkbox"]):not([type="color"]):not([type="range"]), select, textarea{
    transition: border-color 0.2s var(--ease, ease), box-shadow 0.2s var(--ease, ease);
  }
  input:not([type="checkbox"]):not([type="color"]):not([type="range"]):focus,
  select:focus, textarea:focus{
    outline:none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  body{
    margin:0;
    font-family:var(--font-body);
    font-weight:400;
    color:var(--ink);
    background:
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
      var(--bg);
    background-size: 26px 26px;
    min-height:100vh;
    transition: background 0.3s ease, color 0.3s ease;
  }
  h1{ font-family:var(--font-head); font-weight:700; letter-spacing:-0.01em; }
  h2,h3,.tab-label{ font-family:var(--font-head); font-weight:600; letter-spacing:-0.01em; }

  .topbar{
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 18px;
    background:color-mix(in srgb, var(--chrome-bg) 85%, transparent); color:var(--chrome-text);
    position:sticky; top:0; z-index:500;
    -webkit-backdrop-filter:saturate(180%) blur(20px);
    backdrop-filter:saturate(180%) blur(20px);
    box-shadow:0 1px 0 rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.18);
  }
  .brand{ font-family:'Pacifico', cursive; font-weight:400; font-size:1.15rem; letter-spacing:0.2px; color:var(--chrome-text); white-space:nowrap; }
  .topbar-profile-btn{
    width:32px; height:32px; border-radius:50%; flex-shrink:0; padding:0; margin-left:2px;
    display:flex; align-items:center; justify-content:center; overflow:hidden;
    border:2px solid rgba(255,255,255,0.3); cursor:pointer; background:var(--chrome-bg);
    transition: transform 0.15s var(--spring), border-color 0.15s var(--ease);
  }
  .topbar-profile-btn:hover{ transform:scale(1.07); border-color:rgba(255,255,255,0.55); }
  .topbar-profile-btn:active{ transform:scale(0.95); }
  .topbar-profile-btn svg{ width:16px; height:16px; }
  .streak-pill{
    display:flex; align-items:center; gap:6px;
    background:rgba(255,255,255,0.12);
    padding:6px 12px; border-radius:20px; font-size:0.85rem; font-weight:600;
    color:var(--chrome-text);
  }

  .hamburger{
    background:none; border:none; color:var(--chrome-text); font-size:1.4rem; cursor:pointer;
    padding:4px 6px; line-height:1; transition: transform 0.2s var(--ease);
  }
  .hamburger:active{ transform: scale(0.9); }

  .drawer-overlay{
    position:fixed; inset:0; background:rgba(10,14,25,0.5); backdrop-filter: blur(3px);
    opacity:0; pointer-events:none; transition: opacity 0.3s var(--ease); z-index:900;
  }
  .drawer-overlay.show{ opacity:1; pointer-events:all; }
  .drawer{
    position:fixed; top:0; left:0; bottom:0; width:250px; max-width:78vw;
    background:var(--chrome-bg); color:var(--chrome-text);
    padding:20px 14px; display:flex; flex-direction:column; gap:4px;
    transform: translateX(-100%); transition: transform 0.35s var(--spring);
    box-shadow: 6px 0 30px rgba(0,0,0,0.25);
  }
  .drawer-overlay.show .drawer{ transform: translateX(0); }
  .drawer-brand{ font-family:'Pacifico', cursive; font-weight:400; font-size:1.3rem; padding:6px 10px 16px; opacity:0.9; color:var(--chrome-text); }
  .brand-font{ font-family:'Pacifico', cursive; font-weight:400; }
  .drawer-btn{
    text-align:left; border:none; background:none; color:rgba(255,255,255,0.75);
    padding:11px 12px; border-radius:10px; font-size:0.92rem; font-weight:600; cursor:pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
  }
  .drawer-btn:hover{ background:rgba(255,255,255,0.08); }
  .drawer-btn.active{ background:rgba(255,255,255,0.14); color:#fff; }
  .drawer-sep{ height:1px; background:rgba(255,255,255,0.12); margin:10px 4px; }

  .tabs{ display:flex; gap:6px; padding:14px 14px 0; flex-wrap:wrap; }
  .tab{
    border:none; cursor:pointer;
    padding:10px 16px 12px;
    border-radius:12px 12px 0 0;
    font-family:var(--font-head); font-weight:600; font-size:0.85rem;
    color:#fff; opacity:0.55;
    transform: translateY(6px);
    transition: all 0.15s ease;
  }
  .tab.active{ opacity:1; transform: translateY(0); box-shadow: 0 -2px 8px rgba(0,0,0,0.08); }
  .tab[data-tab="home"]{ background:var(--ink); }
  .tab[data-tab="tasks"]{ background:var(--math); }
  .tab[data-tab="schedule"]{ background:var(--english); }
  .tab[data-tab="timer"]{ background:var(--focus); }
  .tab[data-tab="goals"]{ background:var(--science); }
  .tab[data-tab="customize"]{ background:var(--history); }
  .tab[data-tab="premium"]{ background:var(--premium); }
  .tab[data-tab="shop"]{ background:var(--shop); }

  .page{
    background:var(--paper);
    margin:0 14px 24px;
    border-radius:0 var(--radius) var(--radius) var(--radius);
    padding:28px 22px 36px;
    box-shadow:0 2px 8px rgba(37,50,74,0.05), 0 12px 34px rgba(37,50,74,0.08);
    min-height:60vh;
  }
  .hidden{ display:none !important; }
  p.muted{ color:#8891a3; }
  .back-home-btn{
    display:flex; align-items:center; justify-content:center;
    width:36px; height:36px; border-radius:50%;
    background:var(--bg); border:1px solid var(--grid-line); color:var(--accent);
    cursor:pointer; margin-bottom:16px;
    transition: transform 0.15s var(--ease), background 0.15s var(--ease);
  }
  .back-home-btn svg{ width:17px; height:17px; }
  .back-home-btn:hover{ background:var(--grid-line); }
  .back-home-btn:active{ transform:scale(0.9); }

  /* HOME */
  .home-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:16px; margin-top:20px; }
  .home-card{
    border-radius:var(--radius); padding:20px 18px; cursor:pointer; color:var(--ink);
    display:flex; flex-direction:column; gap:8px;
    background:var(--paper); border:1px solid var(--grid-line); border-left:3px solid var(--card-accent, var(--accent));
    box-shadow:0 1px 2px rgba(20,30,45,0.04), 0 6px 16px rgba(20,30,45,0.05);
    transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease);
  }
  .home-card:hover{ transform:translateY(-3px); box-shadow:0 2px 6px rgba(20,30,45,0.06), 0 14px 28px rgba(20,30,45,0.12); }
  .home-card:active{ transform:translateY(-1px) scale(0.98); }
  .icn{ display:inline-flex; vertical-align:-3px; }
  .icn svg{ width:15px; height:15px; }
  .drawer-btn .icn svg{ width:17px; height:17px; }
  .streak-pill .icn svg{ width:13px; height:13px; }

  .home-card .icon{
    width:34px; height:34px; border-radius:50%;
    background:var(--card-accent, var(--accent)); color:#fff;
    display:flex; align-items:center; justify-content:center;
  }
  .home-card .icon svg{ width:17px; height:17px; }
  .home-card span.label{ font-family:var(--font-head); font-weight:600; color:var(--ink); }
  .home-badge{ position:absolute; top:10px; right:10px; background:#fff; color:#a12d2d; font-size:0.7rem; font-weight:800; padding:2px 8px; border-radius:10px; border:1px solid #f0c8c8; }

  /* TASKS */
  .subject-row{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
  .subject-chip{
    border:none; padding:8px 14px; border-radius:20px; cursor:pointer;
    font-weight:600; font-size:0.82rem; color:#fff; opacity:0.5;
  }
  .subject-chip.active{ opacity:1; }
  .subject-chip-wrap{ position:relative; }
  .subject-remove-btn{
    position:absolute; top:-6px; right:-6px; width:17px; height:17px; border-radius:50%;
    background:#c94c4c; color:#fff; border:none; font-size:0.72rem; line-height:1; cursor:pointer;
    display:flex; align-items:center; justify-content:center; padding:0; box-shadow:0 1px 4px rgba(0,0,0,0.25);
  }
  .add-subject-btn{ border:1px dashed #b7c0d4; background:none; border-radius:20px; padding:7px 12px; cursor:pointer; font-size:0.82rem; color:var(--ink); }
  .task-toolbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
  .task-add{ display:flex; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
  .task-add input{ flex:1; padding:10px 12px; border-radius:8px; border:1px solid var(--grid-line); font-size:0.9rem; background:var(--paper); color:var(--ink); }
  .task-add input#task-due{ flex:0 0 140px; }
  .task-add select#task-category{ flex:0 0 110px; padding:10px 6px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); font-size:0.85rem; }
  .cat-badge{ font-size:0.65rem; font-weight:700; padding:3px 8px; border-radius:10px; background:var(--bg); color:#6b7688; }
  .task-add button, .mini-btn{ padding:10px 16px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:600; cursor:pointer; }
  .task-item{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--grid-line); flex-wrap:wrap; }
  .task-item.done span.txt{ text-decoration:line-through; opacity:0.45; }
  .task-item span.txt{ flex:1; }
  .task-item button.del{ border:none; background:none; color:#c94c4c; cursor:pointer; font-size:0.9rem; }
  .score-input{ width:56px; padding:6px 8px; border-radius:8px; border:1px solid var(--grid-line); background:var(--bg); color:var(--ink); font-size:0.8rem; text-align:center; }
  .due-badge{ font-size:0.68rem; font-weight:700; padding:3px 9px; border-radius:12px; white-space:nowrap; }
  .due-overdue{ background:#fbdcdc; color:#a12d2d; }
  .due-today{ background:#ffe6c2; color:#a15c12; }
  .due-tomorrow{ background:#fff1c2; color:#8a6d10; }
  .due-later{ background:var(--bg); color:#8891a3; }
  .task-alert-box{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
  .task-alert-pill{ padding:8px 14px; border-radius:12px; font-size:0.82rem; font-weight:700; cursor:pointer; }
  .task-alert-pill.overdue{ background:#fbdcdc; color:#a12d2d; }
  .task-alert-pill.tomorrow{ background:#fff1c2; color:#8a6d10; }

  /* SCHEDULE */
  .sched-toolbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px;}
  .sched-controls{ display:flex; gap:10px; flex-wrap:wrap; align-items:end; margin-bottom:16px; background:var(--bg); padding:12px; border-radius:10px; }
  .sched-controls label{ font-size:0.75rem; color:#8891a3; display:block; margin-bottom:3px; }
  .sched-controls input, .sched-controls select{ padding:7px 9px; border-radius:6px; border:1px solid var(--grid-line); font-size:0.85rem; background:var(--paper); color:var(--ink); }
  .row-btns{ display:flex; gap:4px; }
  .row-btns button{ width:30px; height:34px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:700; cursor:pointer; }
  .print-btn{ padding:9px 16px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:600; cursor:pointer; }
  .sched-scroll{ width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:8px; }
  table.schedule{ border-collapse:collapse; font-size:1rem; min-width:640px; width:100%; margin:0 auto; table-layout:fixed; }
  table.schedule th, table.schedule td{ border:1px solid var(--grid-line); padding:14px 10px; text-align:center; }
  table.schedule th{ background:var(--bg); font-family:var(--font-head); white-space:nowrap; }
  table.schedule td[contenteditable]{ min-width:64px; cursor:text; color:var(--ink); }
  table.schedule td[contenteditable]:focus{ outline:2px solid var(--english); }
  table.schedule td.time-cell{ font-weight:600; background:var(--bg); white-space:nowrap; width:110px; }

  /* GOALS */
  .streak-box{ display:flex; align-items:center; gap:16px; background:var(--science); color:#fff; border-radius:var(--radius); padding:18px 20px; margin-bottom:16px; flex-wrap:wrap; }
  .streak-box .flame{ width:36px; height:36px; }
  .streak-box .flame svg{ width:36px; height:36px; }
  .streak-box .count{ font-family:var(--font-head); font-size:1.6rem; font-weight:700; }
  .badges{ display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; }
  .badge{ padding:8px 12px; border-radius:10px; background:var(--bg); font-size:0.78rem; font-weight:600; opacity:0.4; }
  .badge.unlocked{ opacity:1; background:#fff4e0; color:#a86a12; }

  .heatmap-section{ margin-bottom:22px; border-radius:var(--radius); border:1px solid var(--grid-line); padding:16px 18px; }
  .heatmap-header{ display:flex; align-items:center; justify-content:space-between; }
  .heatmap-title{ margin:0; font-weight:700; }
  .heatmap-pro-badge{ background:linear-gradient(135deg,#f7b733,var(--premium)); color:#fff; }
  .heatmap-locked{
    display:flex; align-items:center; gap:10px; margin-top:12px; padding:14px;
    border-radius:10px; background:var(--bg); color:#8891a3; font-size:0.82rem; cursor:pointer;
    transition: background 0.2s var(--ease);
  }
  .heatmap-locked:hover{ background:color-mix(in srgb, var(--premium) 12%, var(--bg)); }
  .heatmap-locked svg{ width:22px; height:22px; flex-shrink:0; }
  .heatmap-scroll{ overflow-x:auto; margin-top:14px; padding-bottom:4px; }
  .heatmap-grid{ display:grid; grid-template-rows:repeat(7,11px); grid-auto-flow:column; grid-auto-columns:11px; gap:3px; width:max-content; }
  .heatmap-cell{ width:11px; height:11px; border-radius:2px; background:var(--grid-line); }
  .heatmap-cell.level-1{ background:color-mix(in srgb, var(--accent) 30%, var(--grid-line)); }
  .heatmap-cell.level-2{ background:color-mix(in srgb, var(--accent) 55%, var(--grid-line)); }
  .heatmap-cell.level-3{ background:color-mix(in srgb, var(--accent) 78%, var(--grid-line)); }
  .heatmap-cell.level-4{ background:var(--accent); }
  .heatmap-legend{ display:flex; align-items:center; gap:4px; margin-top:10px; font-size:0.68rem; color:#8891a3; }
  .heatmap-legend .heatmap-cell{ margin:0 1px; }

  .goal-add{ display:flex; gap:8px; margin-bottom:14px; }
  .goal-add input{ flex:1; padding:10px 12px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); }
  .goal-add button{ padding:10px 16px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:600; cursor:pointer; }
  .goal-item{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--grid-line); }
  .goal-item.done span{ text-decoration:line-through; opacity:0.45; }
  .action-row{ display:flex; gap:10px; flex-wrap:wrap; }
  .checkin-btn{ padding:10px 18px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:600; cursor:pointer; }
  .freeze-btn{ padding:10px 18px; border:none; border-radius:var(--radius); background:#8ec9e8; color:#0b3a52; font-weight:600; cursor:pointer; }
  .freeze-btn:disabled{ opacity:0.4; cursor:not-allowed; }

  /* CUSTOMIZE */
  .wallpaper-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:14px; margin-top:14px; }
  .cust-tabs{ display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; }
  .cust-tab{
    padding:9px 16px; border-radius:20px; border:1px solid var(--grid-line); background:var(--bg);
    color:var(--ink); font-size:0.82rem; font-weight:600; cursor:pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
  }
  .cust-tab:hover:not(.active){ background:var(--grid-line); }
  .cust-tab.active{ background:var(--accent); border-color:var(--accent); color:#fff; }
  .cust-empty{ padding:24px 10px; text-align:center; font-size:0.85rem; }
  .cust-empty a{ color:var(--accent); font-weight:600; cursor:pointer; }
  .shop-owned-badge{
    padding:9px 14px; border-radius:var(--radius); background:var(--bg); color:#3fa66e;
    font-size:0.78rem; font-weight:700; text-align:center;
  }
  .wp-card{ border-radius:var(--radius); height:80px; cursor:pointer; position:relative; border:3px solid transparent; display:flex; align-items:flex-end; padding:6px; box-shadow:0 1px 3px rgba(20,30,45,0.08); transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease); }
  .wp-card:not(.locked):hover{ box-shadow:0 10px 22px rgba(20,30,45,0.16); }
  .wp-card.selected{ border-color:var(--ink); }
  .wp-card.locked{ opacity:0.55; cursor:not-allowed; }
  .wp-card .lock{ position:absolute; top:6px; right:8px; font-size:0.9rem; }
  .wp-card span.wname{ background:rgba(255,255,255,0.85); font-size:0.7rem; padding:2px 6px; border-radius:6px; font-weight:600; color:#222; }
  .toggle-row{ display:flex; align-items:center; justify-content:space-between; padding:12px 0; border-bottom:1px solid var(--grid-line); }
  .toggle-row.locked{ opacity:0.5; }
  .switch{ width:42px; height:24px; border-radius:20px; background:#c7cede; position:relative; cursor:pointer; }
  .switch.on{ background:var(--accent); }
  .switch .knob{ width:18px; height:18px; border-radius:50%; background:#fff; position:absolute; top:3px; left:3px; transition:left 0.15s ease; }
  .switch.on .knob{ left:21px; }
  .accent-row{ display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
  .lang-btn{
    background:var(--bg); border:1px solid var(--grid-line); border-radius:20px; padding:9px 16px;
    font-size:0.85rem; font-weight:600; color:var(--ink); cursor:pointer;
    transition: background 0.2s var(--ease), transform 0.15s var(--ease), border-color 0.2s var(--ease);
  }
  .lang-btn:hover{ background:var(--grid-line); }
  .lang-btn:active{ transform:scale(0.96); }
  .lang-btn.active{ background:var(--accent); border-color:var(--accent); color:#fff; }

  /* ===== AI FLOATING ACTION BUTTON ===== */
  .ai-fab{
    position:fixed; right:20px; bottom:20px; width:62px; height:62px; border-radius:50%;
    background:linear-gradient(135deg, #6ec8f5, #7a4fc9); background-size:160% 160%;
    color:#fff; border:none; cursor:pointer;
    display:flex; align-items:center; justify-content:center;
    box-shadow: 0 8px 26px rgba(122,79,201,0.45);
    transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease), background-position 0.4s var(--ease);
    z-index:400;
    animation: aiFabPulse 3.2s ease-in-out infinite;
  }
  .ai-fab svg{ width:27px; height:27px; position:relative; z-index:1; }
  .ai-fab:hover{ transform:scale(1.08); background-position:100% 100%; box-shadow: 0 10px 32px rgba(122,79,201,0.55); }
  .ai-fab:active{ transform:scale(0.92); }
  @keyframes aiFabPulse{
    0%,100%{ box-shadow: 0 8px 26px rgba(122,79,201,0.45), 0 0 0 0 rgba(110,200,245,0.35); }
    50%{ box-shadow: 0 8px 26px rgba(122,79,201,0.45), 0 0 0 9px rgba(110,200,245,0); }
  }
  .ai-fab-tooltip{
    position:absolute; right:calc(100% + 12px); top:50%; transform:translateY(-50%) translateX(6px);
    background:var(--paper); color:var(--ink); font-size:0.78rem; font-weight:600;
    padding:8px 13px; border-radius:11px; white-space:nowrap;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    opacity:0; pointer-events:none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  }
  .ai-fab-tooltip::after{
    content:""; position:absolute; right:-5px; top:50%; transform:translateY(-50%) rotate(45deg);
    width:10px; height:10px; background:var(--paper);
  }
  .ai-fab:hover .ai-fab-tooltip{ opacity:1; transform:translateY(-50%) translateX(0); }
  @media print{ .ai-fab{ display:none; } }
  .accent-dot{ width:30px; height:30px; border-radius:50%; cursor:pointer; border:3px solid transparent; }
  .accent-dot.selected{ border-color:var(--ink); }

  /* TIMER */
  .timer-wrap{ display:flex; flex-direction:column; align-items:center; padding:10px 0 6px; }
  .timer-subject-row{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-bottom:22px; }
  .ring-box{ position:relative; width:220px; height:220px; }
  .ring-box svg{ transform:rotate(-90deg); width:100%; height:100%; }
  .ring-bg{ fill:none; stroke:var(--bg); stroke-width:12; }
  .ring-fg{ fill:none; stroke:var(--focus); stroke-width:12; stroke-linecap:round; transition: stroke-dashoffset 1s linear, stroke 0.3s ease; }
  .ring-center{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
  .ring-time{ font-family:var(--font-head); font-size:2.1rem; font-weight:700; }
  .ring-mode{ font-size:0.8rem; color:#8891a3; text-transform:uppercase; letter-spacing:1px; margin-top:2px; }
  .timer-controls{ display:flex; gap:10px; margin-top:22px; }
  .timer-controls button{ padding:12px 22px; border:none; border-radius:10px; font-weight:700; cursor:pointer; font-size:0.9rem; }
  .btn-start{ background:var(--accent); color:#fff; }
  .btn-reset{ background:var(--bg); color:var(--ink); }
  .timer-settings{ display:flex; gap:14px; margin-top:20px; flex-wrap:wrap; justify-content:center; }
  .timer-settings label{ font-size:0.75rem; color:#8891a3; display:block; margin-bottom:3px; }
  .timer-settings input{ width:60px; padding:7px; border-radius:6px; border:1px solid var(--grid-line); text-align:center; background:var(--paper); color:var(--ink); }
  .cycle-dots{ display:flex; gap:6px; margin-top:18px; }
  .cycle-dot{ width:12px; height:12px; border-radius:50%; background:var(--bg); transition: background 0.3s ease, transform 0.3s var(--spring); }
  .cycle-reset-btn{
    background:none; border:none; color:#8891a3; font-size:0.75rem; cursor:pointer;
    margin-top:6px; padding:4px 8px; border-radius:8px; transition: background 0.15s var(--ease), color 0.15s var(--ease);
  }
  .cycle-reset-btn:hover{ background:var(--bg); color:var(--ink); }
  .cycle-dot.filled{ background:var(--focus); transform:scale(1.15); }

  /* ===== FULL THEMES ===== */
  /* VT323 (Pixel Blue's font) renders noticeably smaller than other fonts
     at the same declared size — bump the root size so every rem-based
     label in this theme stays legible instead of turning to tiny text. */
  html:has(body.theme-pixel){ font-size:150%; }
  body.theme-pixel{
    --ink:#0a2a6b; --paper:#eaf1ff; --bg:#d6e6ff; --grid-line:#a9c8ff; --accent:#1e50c8; --radius:0px;
    --font-body:'VT323', monospace; --font-head:'VT323', monospace;
    --chrome-bg:#0a2a6b; --chrome-text:#eaf1ff;
    background-image:
      linear-gradient(45deg, #cfe0ff 25%, transparent 25%), linear-gradient(-45deg, #cfe0ff 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #cfe0ff 75%), linear-gradient(-45deg, transparent 75%, #cfe0ff 75%);
    background-size:16px 16px; background-position:0 0, 0 8px, 8px -8px, -8px 0px;
  }
  body.theme-pixel *{ font-family:'VT323', monospace !important; letter-spacing:0.5px; }
  body.theme-pixel .home-card, body.theme-pixel .wp-card, body.theme-pixel .shop-card{ box-shadow:3px 3px 0 rgba(0,0,0,0.25); }

  body.theme-steam{
    --ink:#c7d5e0; --paper:#1b2838; --bg:#171a21; --grid-line:#2a3f5a; --accent:#66c0f4; --radius:3px;
    --font-body:'Inter',sans-serif; --font-head:'Inter',sans-serif;
    --chrome-bg:#0f141c; --chrome-text:#c7d5e0;
  }
  body.theme-steam .home-card, body.theme-steam .produto{ filter:saturate(0.9); }

  body.theme-notebook{
    --ink:#3b2f2f; --paper:#fffdf7; --bg:#f5efe0; --grid-line:#e2d5b8; --accent:#c0392b; --radius:8px;
    --font-body:'Inter',sans-serif; --font-head:'Caveat',cursive;
    --chrome-bg:#3b2f2f; --chrome-text:#fffdf7;
  }
  body.theme-notebook h1, body.theme-notebook h2, body.theme-notebook h3,
  body.theme-notebook .brand, body.theme-notebook .tab{ font-size:1.25em; }

  body.theme-neon{
    --ink:#e8f9ff; --paper:#140a2e; --bg:#0d0621; --grid-line:#3a1c6b; --accent:#00f6ff; --radius:14px;
    --font-body:'JetBrains Mono',monospace; --font-head:'JetBrains Mono',monospace;
    --chrome-bg:#0d0621; --chrome-text:#00f6ff;
  }
  body.theme-neon .mini-btn, body.theme-neon .checkin-btn, body.theme-neon .print-btn,
  body.theme-neon .sub-btn, body.theme-neon .shop-btn, body.theme-neon .task-add button,
  body.theme-neon .goal-add button, body.theme-neon .btn-start{
    box-shadow: 0 0 14px var(--accent);
  }

  body.theme-mono{
    --ink:#1a1a1a; --paper:#ffffff; --bg:#f2f2f2; --grid-line:#dddddd; --accent:#1a1a1a; --radius:0px;
    --font-body:'JetBrains Mono',monospace; --font-head:'JetBrains Mono',monospace;
    --chrome-bg:#000000; --chrome-text:#ffffff;
  }
  body.theme-mono .home-card, body.theme-mono .wp-card, body.theme-mono .shop-card{ filter:grayscale(1); }

  body.theme-obsidian{
    --ink:#e6edf5; --paper:#171a21; --bg:#0d0f14; --grid-line:#262b36; --accent:#6ec8f5; --radius:10px;
    --chrome-bg:#0a0c10; --chrome-text:#bfe4ff;
    /* San Francisco itself can't be hosted (Apple-licensed), so this is the
       system-font stack — it resolves to actual SF on Mac/iPhone and to the
       closest native equivalent everywhere else. */
    --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg); /* dark charcoal, not flat black — no graph-paper grid lines for this theme */
  }
  /* iPhone/Mac-style pill buttons, to match the Apple identity above */
  body.theme-obsidian .task-add button, body.theme-obsidian .mini-btn,
  body.theme-obsidian .row-btns button, body.theme-obsidian .print-btn,
  body.theme-obsidian .goal-add button, body.theme-obsidian .checkin-btn,
  body.theme-obsidian .freeze-btn, body.theme-obsidian .shop-btn,
  body.theme-obsidian .ai-input-row button, body.theme-obsidian .sub-btn,
  body.theme-obsidian .cat-add-row button, body.theme-obsidian .timer-controls button,
  body.theme-obsidian .modal-actions button, body.theme-obsidian .donate-opt{
    border-radius:999px;
  }
  /* black shadows are invisible on a black theme — same fix as dark mode,
     plus a soft light-blue glow so the accent color really reads as this
     theme's signature, Apple-dark-productivity feel. */
  body.theme-obsidian .page{ box-shadow: 0 0 0 1px rgba(110,200,245,0.08), 0 10px 30px rgba(0,0,0,0.4); }
  body.theme-obsidian .topbar{ box-shadow: 0 1px 0 rgba(110,200,245,0.12), 0 8px 24px rgba(0,0,0,0.4); }
  body.theme-obsidian .home-card{
    border-color:#262b36;
    box-shadow: 0 0 0 1px rgba(110,200,245,0.06), 0 8px 20px rgba(0,0,0,0.35);
  }
  body.theme-obsidian .home-card:hover{ box-shadow: 0 0 0 1px rgba(110,200,245,0.25), 0 0 24px rgba(110,200,245,0.12), 0 12px 26px rgba(0,0,0,0.45); }
  body.theme-obsidian .wp-card, body.theme-obsidian .shop-card{ border-color:#262b36; box-shadow: 0 0 0 1px rgba(110,200,245,0.06); }
  body.theme-obsidian .wp-card:not(.locked):hover, body.theme-obsidian .shop-card:hover{ box-shadow: 0 0 0 1px rgba(110,200,245,0.3), 0 0 18px rgba(110,200,245,0.15); }
  body.theme-obsidian input:not([type="checkbox"]):not([type="color"]):not([type="range"]):focus,
  body.theme-obsidian select:focus, body.theme-obsidian textarea:focus{
    box-shadow: 0 0 0 3px rgba(110,200,245,0.22);
  }
  body.theme-obsidian .drawer-btn.active{ background:rgba(110,200,245,0.14); color:#bfe4ff; box-shadow: inset 2px 0 0 var(--accent); }
  body.theme-obsidian .home-summary-card:not(.ws-advanced){ box-shadow: 0 0 0 1px rgba(110,200,245,0.06); }
  /* Weekly Pro Insights reads amber (--premium) everywhere else, but that
     clashes with Obsidian's light-blue accent identity, so it gets its own
     light-blue wash here instead. */
  body.theme-obsidian .ws-advanced{
    background: color-mix(in srgb, #6ec8f5 10%, var(--paper));
    border-left-color: #6ec8f5;
  }

  /* ACCOUNT */
  .cloud-auth-box{
    max-width:320px; margin:16px auto 0; padding:18px 20px; border-radius:var(--radius);
    border:1px solid var(--grid-line); background:var(--bg); text-align:center;
  }
  .cloud-auth-box .account-field{ margin:0 auto 12px; }
  .cloud-auth-error{ color:#c94c4c; font-size:0.78rem; min-height:1em; margin:0 0 8px; }
  .cloud-auth-btns{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; }
  .mini-btn.secondary{ background:var(--paper); color:var(--ink); border:1px solid var(--grid-line); }
  .account-card{ display:flex; flex-direction:column; align-items:center; gap:12px; padding:20px 0; }
  .account-avatar{ width:74px; height:74px; border-radius:50%; background:var(--bg); display:flex; align-items:center; justify-content:center; }
  .account-avatar svg{ width:32px; height:32px; }
  .avatar-picker{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
  .avatar-opt{ width:38px; height:38px; border-radius:50%; background:var(--bg); border:2px solid transparent; display:flex; align-items:center; justify-content:center; cursor:pointer; }
  .avatar-opt svg{ width:18px; height:18px; }
  .avatar-opt.selected{ border-color:var(--accent); }
  .account-field{ width:100%; max-width:280px; }
  .account-field label{ font-size:0.75rem; color:#8891a3; display:block; margin-bottom:4px; }
  .account-field input{ width:100%; padding:10px 12px; border-radius:var(--radius); border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); text-align:center; }
  .account-stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:10px; }
  .stat-box{ background:var(--bg); border-radius:12px; padding:14px 8px; text-align:center; transition: transform 0.25s var(--spring); }
  .stat-box:hover{ transform:translateY(-2px); }
  .stat-num{ font-family:var(--font-head); font-size:1.3rem; font-weight:700; }
  .stat-label{ font-size:0.7rem; color:#8891a3; margin-top:2px; }

  /* PROFILE — trophy shelf */
  .profile-header{ display:flex; flex-direction:column; align-items:center; gap:6px; padding:6px 0 22px; text-align:center; }
  .profile-avatar-big{ width:92px; height:92px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:4px; box-shadow:0 6px 16px rgba(20,30,45,0.15); }
  .profile-avatar-big svg{ width:42px; height:42px; }
  .profile-name{ font-family:var(--font-head); font-weight:700; font-size:1.3rem; }
  .profile-title-tag{ font-size:0.8rem; color:var(--accent); font-weight:600; }
  .profile-streak-row{ font-size:0.88rem; color:#8891a3; margin-top:4px; }
  .profile-shelf-header{ display:flex; justify-content:space-between; align-items:baseline; margin-top:8px; }
  .profile-shelf-header h3{ margin:0; font-size:1rem; }
  .profile-shelf-header .muted{ font-size:0.78rem; }

  .trophy-tier{ margin-top:22px; }
  .trophy-tier-label{ font-family:var(--font-head); font-weight:700; font-size:0.88rem; margin-bottom:2px; }
  .trophy-tier-label.tier-bronze{ color:#a86a3a; }
  .trophy-tier-label.tier-silver{ color:#7d838a; }
  .trophy-tier-label.tier-gold{ color:#b8860b; }

  .trophy-shelf-row{
    position:relative; display:flex; flex-wrap:wrap; gap:18px; align-items:flex-end;
    padding:20px 12px 22px;
  }
  .shelf-ledge{
    position:absolute; left:4px; right:4px; bottom:14px; height:11px; border-radius:3px;
    box-shadow:0 6px 10px rgba(20,30,45,0.22), inset 0 2px 2px rgba(255,255,255,0.3);
  }
  .shelf-ledge.tier-bronze{ background:linear-gradient(180deg,#c8935a,#8a5a30); }
  .shelf-ledge.tier-silver{ background:linear-gradient(180deg,#d8dde3,#9aa3ad); }
  .shelf-ledge.tier-gold{ background:linear-gradient(180deg,#f0d78c,#c9a227); }

  .trophy-slot{ position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; gap:6px; width:74px; }
  .trophy-icon-3d{ width:50px; height:62px; display:flex; align-items:flex-end; justify-content:center; transition: transform 0.25s var(--spring); }
  .trophy-icon-3d svg{ width:44px; height:55px; filter:drop-shadow(0 3px 3px rgba(20,30,45,0.25)); }
  .trophy-slot:hover .trophy-icon-3d{ transform:translateY(-4px); }
  .trophy-slot.locked .trophy-icon-3d svg{ filter:grayscale(1) opacity(0.4) drop-shadow(0 2px 2px rgba(20,30,45,0.12)); }
  .trophy-slot-label{ font-size:0.7rem; font-weight:600; line-height:1.25; text-align:center; }
  .trophy-slot.locked .trophy-slot-label{ color:#8891a3; opacity:0.7; }

  /* Steam-style achievement unlock toast */
  .achievement-toast{
    position:fixed; left:50%; bottom:24px; z-index:900; cursor:pointer;
    display:flex; align-items:center; gap:12px; padding:10px 18px 10px 10px;
    background:var(--paper); color:var(--ink); border-radius:14px;
    border:1px solid var(--grid-line); box-shadow:0 10px 30px rgba(20,30,45,0.25);
    transform:translate(-50%, 20px); opacity:0; pointer-events:none;
    transition: transform 0.35s var(--spring), opacity 0.3s var(--ease);
  }
  .achievement-toast.show{ transform:translate(-50%, 0); opacity:1; pointer-events:auto; }
  .achievement-toast .toast-icon{ width:38px; height:48px; flex-shrink:0; display:flex; align-items:flex-end; }
  .achievement-toast .toast-icon svg{ width:34px; height:42px; filter:drop-shadow(0 2px 2px rgba(20,30,45,0.25)); }
  .achievement-toast .toast-tier-label{ font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:0.03em; color:var(--accent); }
  .achievement-toast .toast-title{ font-family:var(--font-head); font-weight:700; font-size:0.92rem; margin-top:1px; }
  .achievement-toast.tier-bronze .toast-tier-label{ color:#a86a3a; }
  .achievement-toast.tier-silver .toast-tier-label{ color:#7d838a; }
  .achievement-toast.tier-gold .toast-tier-label{ color:#b8860b; }

  /* HOME — AI-written weekly summary fills the leftover space below the
     grid with something genuinely useful instead of empty background. */
  .home-summary-card{
    display:flex; gap:16px; align-items:flex-start;
    margin-top:32px; padding:22px 20px;
    border-radius:var(--radius); border:1px solid var(--grid-line);
    background:linear-gradient(135deg, color-mix(in srgb, #7a4fc9 8%, var(--bg)), color-mix(in srgb, #6ec8f5 8%, var(--bg)));
  }
  .home-summary-icon{
    flex-shrink:0; width:40px; height:40px; border-radius:50%;
    background:linear-gradient(135deg, #6ec8f5, #7a4fc9); color:#fff;
    display:flex; align-items:center; justify-content:center;
  }
  .home-summary-icon svg{ width:20px; height:20px; }
  .home-summary-title{ font-family:var(--font-head); font-weight:700; font-size:0.95rem; }
  .home-summary-refresh{
    background:none; border:none; color:#8891a3; font-size:1.05rem; cursor:pointer;
    padding:4px 6px; border-radius:6px; line-height:1; flex-shrink:0;
    transition: background 0.15s var(--ease), transform 0.3s var(--ease);
  }
  .home-summary-refresh:hover{ background:var(--grid-line); color:var(--ink); }
  .home-summary-card.loading .home-summary-refresh{ animation: home-summary-spin 0.9s linear infinite; }
  @keyframes home-summary-spin{ from{ transform:rotate(0deg); } to{ transform:rotate(360deg); } }
  .home-summary-text{ margin:16px 0 0; font-size:0.88rem; line-height:1.55; color:var(--ink); }

  .ws-card{ flex-direction:column; align-items:stretch; }
  .ws-header{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .ws-title-row{ display:flex; align-items:center; gap:12px; }
  .ws-range{ font-size:0.75rem; color:#8891a3; margin-top:2px; }
  .ws-stats{ display:flex; gap:10px; margin-top:20px; }
  .ws-stats .ws-stat{ flex:1; min-width:0; }
  .ws-stat{ text-align:center; }
  .ws-stat-num{ font-family:var(--font-head); font-weight:700; font-size:1.25rem; white-space:nowrap; }
  .ws-stat-label{ font-size:0.66rem; color:#8891a3; margin-top:3px; }
  .ws-focus-select{
    display:block; margin:6px auto 0; max-width:100%; font-size:0.68rem; font-weight:600;
    color:var(--ink); background:var(--bg); border:1px solid var(--grid-line); border-radius:6px;
    padding:2px 4px; cursor:pointer;
  }
  .ws-bars{ display:flex; align-items:flex-end; justify-content:space-between; gap:6px; height:64px; margin-top:24px; }
  .ws-bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; height:100%; justify-content:flex-end; }
  .ws-bar{ width:55%; min-height:4px; border-radius:4px 4px 1px 1px; background:linear-gradient(180deg, #6ec8f5, #7a4fc9); transition: height 0.6s var(--spring); }
  .ws-bar-label{ font-size:0.62rem; color:#8891a3; }
  .ws-tier-badge{
    font-size:0.62rem; font-weight:700; padding:2px 8px; border-radius:10px;
    background:var(--bg); color:#8891a3; vertical-align:middle; white-space:nowrap;
  }

  /* Theme-adaptive: this card just uses the page's own paper/ink tokens
     (so it's light on a light theme, dark in dark mode / Obsidian, etc.)
     with a premium-tinted wash and left stripe as its only "special" cue —
     never a hardcoded dark color that fights the active theme. */
  .ws-advanced{
    margin-top:18px;
    background:color-mix(in srgb, var(--premium) 7%, var(--paper));
    border:1px solid var(--grid-line);
    border-left:3px solid var(--premium);
    color:var(--ink);
  }
  .ws-advanced .ws-divider{ background:var(--grid-line); }
  .ws-advanced .ws-forecast-day.overload{ background:color-mix(in srgb, #c94c4c 18%, var(--bg)); }
  .ws-advanced .ws-forecast-day.overload .ws-forecast-count{ color:#c94c4c; }
  .ws-advanced .up{ color:#3fa66e; }
  .ws-advanced .down{ color:#c94c4c; }
  .ws-diamond-icon{ width:15px; height:15px; vertical-align:-3px; }
  .ws-forecast-caption{ margin:4px 0 0; font-size:0.72rem; color:#8891a3; }
  .ws-heatmap-link{
    display:block; margin-top:16px; font-size:0.78rem; font-weight:600; color:var(--accent); cursor:pointer;
  }
  .ws-flag-overdue{ color:#c94c4c; font-weight:700; }
  .ws-flag-duesoon{ color:#c9922e; font-weight:700; }
  .ws-stat-icon{ width:20px; height:20px; vertical-align:-5px; margin-right:5px; opacity:0.75; }
  .ws-premium-icon{ background:linear-gradient(135deg, #3a3f4b, #000); }
  .ws-divider{ height:1px; background:var(--grid-line); margin:20px 0 0; opacity:0.7; }

  /* small locked tab shown on the free card, pointing at Pro Insights */
  .ws-pro-tab{
    display:flex; align-items:center; gap:7px; margin-top:16px; padding:8px 12px;
    border-radius:9px; border:1px solid var(--grid-line);
    background:color-mix(in srgb, var(--ink) 6%, var(--bg));
    color:#8891a3; font-size:0.76rem; font-weight:700; cursor:pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--spring);
  }
  .ws-pro-tab svg{ width:14px; height:14px; flex-shrink:0; }
  .ws-pro-tab:hover{ background:color-mix(in srgb, var(--premium) 16%, var(--bg)); color:var(--ink); }
  .ws-pro-tab:active{ transform:scale(0.97); }

  .ws-weeknav{ display:flex; align-items:center; gap:6px; font-size:0.72rem; color:#8891a3; white-space:nowrap; }
  .ws-weeknav button{
    background:var(--bg); border:1px solid var(--grid-line); border-radius:50%; width:22px; height:22px;
    color:var(--ink); cursor:pointer; font-size:0.85rem; line-height:1; padding:0;
  }
  .ws-weeknav button:disabled{ opacity:0.35; cursor:not-allowed; }

  .ws-detailed-bars{ display:flex; align-items:flex-end; justify-content:space-between; gap:8px; height:84px; margin-top:22px; }
  .ws-dbar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:5px; height:100%; justify-content:flex-end; position:relative; }
  .ws-dbar-star{ position:absolute; top:-16px; font-size:0.7rem; }
  .ws-dbar-pair{ display:flex; align-items:flex-end; gap:2px; height:100%; }
  .ws-dbar{ width:8px; min-height:3px; border-radius:3px 3px 1px 1px; transition: height 0.6s var(--spring); }
  .ws-dbar-tasks{ background:linear-gradient(180deg, #6ec8f5, #7a4fc9); }
  .ws-dbar-focus{ background:linear-gradient(180deg, #ffd166, #ef6c4d); }
  .ws-dbar-col.best .ws-dbar-tasks{ box-shadow:0 0 0 1px #fff, 0 0 8px rgba(122,79,201,0.6); }
  .ws-bar-label{ font-size:0.6rem; color:#8891a3; }
  .ws-chart-legend{ display:flex; gap:16px; justify-content:center; margin-top:10px; font-size:0.68rem; color:#8891a3; }
  .ws-chart-legend span{ display:inline-flex; align-items:center; gap:5px; }
  .ws-legend-dot{ width:8px; height:8px; border-radius:2px; display:inline-block; }
  .ws-legend-tasks{ background:linear-gradient(180deg, #6ec8f5, #7a4fc9); }
  .ws-legend-focus{ background:linear-gradient(180deg, #ffd166, #ef6c4d); }

  .ws-adv-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:20px; }
  .ws-adv-item{ background:var(--bg); border-radius:var(--radius); padding:16px 14px; text-align:center; }
  .ws-adv-label{ font-size:0.8rem; color:#8891a3; }
  .ws-adv-value{ font-family:var(--font-head); font-weight:700; font-size:1.4rem; margin-top:6px; }
  .ws-adv-value.up{ color:#3fa66e; }
  .ws-adv-value.down{ color:#c94c4c; }
  .ws-adv-subtext{ margin:10px 0 0; font-size:0.85rem; color:#8891a3; text-align:center; }

  .ws-subjects-heading{ margin:20px 0 0; font-size:0.85rem; }
  .ws-subjects{ display:flex; flex-direction:column; gap:14px; margin-top:12px; }
  .ws-subject-row{ display:flex; align-items:flex-start; gap:10px; font-size:0.95rem; }
  .ws-subject-dot{ width:11px; height:11px; border-radius:50%; flex-shrink:0; margin-top:6px; }
  .ws-subject-info{ flex:1; min-width:0; }
  .ws-subject-name{ font-weight:600; }
  .ws-subject-count{ font-weight:400; color:#8891a3; }
  .ws-subject-detail{ font-size:0.82rem; color:#8891a3; margin-top:3px; }
  .ws-subject-detail.has-overdue{ color:#c94c4c; }

  .ws-forecast{ display:flex; justify-content:space-between; gap:6px; margin-top:10px; }
  .ws-forecast-day{ flex:1; text-align:center; border-radius:10px; padding:8px 4px; background:var(--bg); }
  .ws-forecast-day.overload{ background:color-mix(in srgb, #c94c4c 18%, var(--bg)); }
  .ws-forecast-label{ font-size:0.6rem; color:#8891a3; }
  .ws-forecast-count{ font-weight:700; font-size:0.9rem; margin-top:2px; }
  .ws-forecast-day.overload .ws-forecast-count{ color:#c94c4c; }

  .ws-adv-tips{ margin:20px 0 0; padding:14px; border-radius:var(--radius); background:var(--bg); font-size:0.85rem; line-height:1.5; }
  .ws-export-btn{
    display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
    margin-top:16px; padding:11px; border-radius:var(--radius); border:1px solid var(--grid-line);
    background:var(--paper); color:var(--ink); font-size:0.82rem; font-weight:600; cursor:pointer;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  }
  .ws-export-btn svg{ width:16px; height:16px; flex-shrink:0; }
  .ws-export-btn:hover{ background:var(--bg); border-color:var(--accent); }
  @media (max-width:699px){
    .ws-stats{ flex-wrap:wrap; gap:14px 10px; }
    .ws-stats .ws-stat{ flex:1 1 40%; }
    .ws-stat-num{ font-size:1.1rem; }
    .ws-detailed-bars{ height:64px; }
  }
  @media (min-width:1200px){
    .home-summary-card{ padding:26px 26px; }
    .home-summary-text{ font-size:0.92rem; }
    .ws-bars{ height:80px; }
    .ws-stat-num{ font-size:1.5rem; }
  }
  .account-plan{ margin-top:16px; padding:12px 14px; border-radius:12px; background:var(--bg); font-size:0.85rem; text-align:center; font-weight:600; }

  /* FEEDBACK */
  .feedback-type-row{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
  .feedback-textarea{ width:100%; min-height:120px; padding:12px; border-radius:var(--radius); border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); font-family:var(--font-body); font-size:0.9rem; margin-bottom:12px; resize:vertical; }

  /* DONATE */
  .donate-row{ display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }
  .donate-opt{ padding:14px 20px; border-radius:var(--radius); border:2px solid var(--grid-line); background:var(--bg); font-weight:600; font-family:var(--font-body); cursor:pointer; font-size:1rem; }
  .donate-opt.selected{ border-color:var(--focus); background:#fff0f4; color:var(--focus); }

  /* ABOUT */
  .about-block{ margin-top:18px; }
  .about-block h3{ font-size:1rem; margin-bottom:4px; }
  .about-block p{ color:#6b7688; font-size:0.9rem; }

  /* GRADES */
  .gpa-card{ background:var(--chrome-bg); color:var(--chrome-text); border-radius:var(--radius); padding:18px; text-align:center; margin-bottom:16px; }
  .gpa-num{ font-family:var(--font-head); font-size:2rem; font-weight:700; }
  .gpa-sub{ font-size:0.8rem; opacity:0.9; margin-top:2px; color:rgba(255,255,255,0.85); }
  .weights-box{ background:var(--bg); border-radius:14px; padding:16px; margin-bottom:18px; }
  .weights-row{ display:flex; gap:10px; flex-wrap:wrap; }
  .weight-field{ text-align:center; }
  .weight-field label{ font-size:0.72rem; color:#8891a3; display:block; margin-bottom:3px; }
  .weight-field input{ width:56px; padding:7px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); text-align:center; }
  .weight-field{ position:relative; }
  .cat-remove-btn{
    position:absolute; top:-6px; right:-6px; width:18px; height:18px; border-radius:50%;
    background:#c94c4c; color:#fff; border:none; font-size:0.75rem; line-height:1; cursor:pointer;
    display:flex; align-items:center; justify-content:center; padding:0;
  }
  .cat-add-row{ display:flex; gap:8px; margin-top:12px; }
  .cat-add-row input{ flex:1; padding:9px 12px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); font-size:0.85rem; }
  .cat-add-row button{ padding:9px 14px; border-radius:8px; border:none; background:var(--accent); color:#fff; font-size:0.82rem; font-weight:600; cursor:pointer; white-space:nowrap; }
  .grade-summary{ background:var(--chrome-bg); color:var(--chrome-text); border-radius:14px; padding:18px; text-align:center; margin-bottom:16px; }
  .grade-avg{ font-family:var(--font-head); font-size:2.2rem; font-weight:700; color:var(--chrome-text); }
  .grade-letter{ font-size:0.85rem; color:rgba(255,255,255,0.75); margin-top:2px; }
  .grade-add{ display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
  .grade-add input#grade-name{ flex:1; min-width:140px; padding:10px 12px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); }
  .grade-add input#grade-score{ flex:0 0 80px; padding:10px 12px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); }
  .grade-item{ display:flex; align-items:center; gap:10px; padding:10px 4px; border-bottom:1px solid var(--grid-line); }
  .grade-item span.gname{ flex:1; }
  .grade-item span.gscore{ font-weight:700; font-family:var(--font-head); }
  .grade-item button.del{ border:none; background:none; color:#c94c4c; cursor:pointer; font-size:0.9rem; }
  .grade-goal-box{ background:var(--bg); border-radius:14px; padding:16px; margin-top:20px; }
  .report-card-box{ background:var(--bg); border-radius:14px; padding:16px; margin-top:20px; }
  .report-card-summary{ display:flex; flex-direction:column; gap:2px; }
  .report-row{
    display:flex; align-items:center; gap:10px; padding:10px 4px;
    border-bottom:1px solid var(--grid-line); font-size:0.85rem;
  }
  .report-row:last-child{ border-bottom:none; }
  .report-dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; }
  .report-subject{ flex:1; font-weight:600; }
  .report-grade{ font-weight:700; color:#8891a3; font-size:0.8rem; }
  .report-row.report-total{ margin-top:4px; padding-top:12px; border-top:2px solid var(--grid-line); border-bottom:none; }
  .report-row.report-total .report-subject{ font-family:var(--font-head); font-size:0.95rem; }
  .report-row.report-total .report-grade{ color:var(--ink); font-size:0.95rem; }
  .report-export-btn{
    display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
    margin-top:16px; padding:11px; border-radius:var(--radius); border:1px solid var(--grid-line);
    background:var(--paper); color:var(--ink); font-size:0.82rem; font-weight:600; cursor:pointer;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  }
  .report-export-btn svg{ width:16px; height:16px; flex-shrink:0; }
  .report-export-btn:hover{ background:var(--bg); border-color:var(--accent); }
  .grade-goal-row{ display:flex; gap:14px; flex-wrap:wrap; }
  .grade-goal-cats{ display:flex; gap:10px; flex-wrap:wrap; }
  .grade-goal-cat-field{ text-align:center; }
  .grade-goal-cat-field label{ font-size:0.7rem; color:#8891a3; display:block; margin-bottom:3px; }
  .grade-goal-cat-field input{ width:56px; padding:7px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); text-align:center; }
  .grade-goal-row label{ font-size:0.75rem; color:#8891a3; display:block; margin-bottom:3px; }
  .grade-goal-row input{ width:100px; padding:8px; border-radius:8px; border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); text-align:center; }

  /* SHOP */
  .shop-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-top:16px; }
  .shop-card{ background:var(--bg); border-radius:var(--radius); padding:16px 14px; display:flex; flex-direction:column; gap:8px; align-items:center; text-align:center; box-shadow:0 1px 2px rgba(20,30,45,0.04); transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease); }
  .shop-card:hover{ transform:translateY(-2px); box-shadow:0 10px 22px rgba(20,30,45,0.1); }
  .shop-preview{ width:100%; aspect-ratio:1.4/1; border-radius:10px; background:linear-gradient(135deg,#e5e9f2,#f3f6fb); display:flex; align-items:center; justify-content:center; }
  .shop-icon{ font-size:1.8rem; }
  .shop-name{ font-family:var(--font-head); font-weight:600; font-size:0.9rem; }
  .shop-type{ font-size:0.65rem; letter-spacing:1px; color:#8891a3; font-weight:700; margin-top:-4px; }
  .coin-ico{
    display:inline-block; width:15px; height:15px; vertical-align:-2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14.5' fill='%23f4c542' stroke='%23b8860b' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='11' fill='none' stroke='%23b8860b' stroke-width='1.2'/%3E%3Cpath d='M16 8.5l2.1 6.4h6.7l-5.4 3.9 2.1 6.4-5.5-4-5.5 4 2.1-6.4-5.4-3.9h6.7z' fill='%23b8860b'/%3E%3C/svg%3E");
    background-size: contain; background-repeat: no-repeat;
  }
  .coin-ico-lg{ width:30px; height:30px; vertical-align:-8px; }

  .shop-btn{ width:100%; padding:9px; border:none; border-radius:var(--radius); background:var(--shop); color:#fff; font-weight:700; cursor:pointer; font-size:0.82rem; }
  .shop-btn:disabled{ background:#c7cede; cursor:not-allowed; }
  .shop-btn.equipped{ background:var(--ink); }

  /* ===== CELEBRATION EFFECTS (confetti / sparks / galaxy / fire) =====
     Each effect gets its own silhouette + motion, not just a color swap:
     confetti = tumbling ribbons/dots, sparks = 4-point glowing stars,
     galaxy = soft nebula + twinkling dust + drifting planets,
     fire = gradient flame droplets with flicker. */
  .fx-confetti{
    position:fixed; pointer-events:none; z-index:2000;
    animation: fx-confetti-fall 1.7s cubic-bezier(.25,.46,.45,.94) forwards;
  }
  .fx-confetti-rain{ animation-duration:2.2s; animation-timing-function:ease-in; }
  @keyframes fx-confetti-fall{
    0%{ transform: translate(0,0) rotate(0deg); opacity:1; }
    100%{ transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity:0; }
  }

  .fx-spark{
    position:fixed; pointer-events:none; z-index:2000;
    clip-path: polygon(50% 0%, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0% 50%, 35% 35%);
    box-shadow: 0 0 10px 2px currentColor;
    animation: fx-spark-pop 0.75s cubic-bezier(.25,.46,.45,.94) forwards;
  }
  @keyframes fx-spark-pop{
    0%{ transform: translate(0,0) scale(0.2) rotate(0deg); opacity:1; }
    55%{ opacity:1; }
    100%{ transform: translate(var(--dx), var(--dy)) scale(0.2) rotate(90deg); opacity:0; }
  }
  .fx-spark-twinkle{
    box-shadow: 0 0 6px 1px currentColor;
    animation: fx-spark-twinkle 1.2s ease-in-out forwards;
  }
  @keyframes fx-spark-twinkle{
    0%{ transform: scale(0); opacity:0; }
    30%{ transform: scale(1); opacity:1; }
    70%{ transform: scale(1); opacity:1; }
    100%{ transform: scale(0); opacity:0; }
  }

  .fx-nebula{
    position:fixed; width:220px; height:220px; margin-left:-110px; margin-top:-110px;
    border-radius:50%; pointer-events:none; z-index:1999;
    background: radial-gradient(circle, rgba(167,139,250,0.35), rgba(96,165,250,0.18) 45%, transparent 72%);
    filter: blur(6px);
    animation: fx-nebula-fade 2.2s ease-out forwards;
  }
  @keyframes fx-nebula-fade{
    0%{ transform: scale(0.3); opacity:0; }
    30%{ transform: scale(1); opacity:1; }
    100%{ transform: scale(1.6); opacity:0; }
  }
  .fx-galaxy{
    position:fixed; border-radius:50%; pointer-events:none; z-index:2000;
    box-shadow: 0 0 8px 1px currentColor;
    animation: fx-galaxy-twinkle 2.4s ease-in-out forwards;
  }
  @keyframes fx-galaxy-twinkle{
    0%{ transform: translate(0,0) scale(0); opacity:0; }
    15%{ transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3)) scale(1); opacity:1; }
    50%{ opacity:0.5; }
    65%{ opacity:1; }
    100%{ transform: translate(var(--dx), var(--dy)) scale(0.4); opacity:0; }
  }
  .fx-galaxy-planet{
    box-shadow: 0 0 16px 4px currentColor;
    filter: blur(0.5px);
    animation: fx-galaxy-drift 2s ease-out forwards;
  }
  @keyframes fx-galaxy-drift{
    0%{ transform: translate(0,0) rotate(0deg) scale(0.5); opacity:0.9; }
    50%{ opacity:1; }
    100%{ transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(1); opacity:0; }
  }

  .fx-fire{
    position:fixed; border-radius:50% 50% 50% 0; pointer-events:none; z-index:2000;
    filter: blur(0.5px);
    animation-name: fx-fire-rise; animation-timing-function:ease-out; animation-fill-mode:forwards;
  }
  @keyframes fx-fire-rise{
    0%{ transform: translate(0,0) scale(1) rotate(-10deg); opacity:1; }
    35%{ transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * 0.4)) scale(0.9) rotate(15deg); }
    70%{ opacity:0.85; }
    100%{ transform: translate(var(--dx), var(--dy)) scale(0.15) rotate(45deg); opacity:0; }
  }
  .fx-fire-ground{ border-radius:50% 50% 0 50%; }

  /* AI SCHOOL ASSISTANT */
  .ai-locked-box{
    background:linear-gradient(160deg, var(--bg), var(--paper));
    border:1px solid var(--grid-line); border-radius:var(--radius);
    padding:32px 22px; text-align:center;
  }
  .ai-locked-icon{
    width:56px; height:56px; border-radius:50%; margin:0 auto 14px;
    background:#7a4fc9; color:#fff; display:flex; align-items:center; justify-content:center;
  }
  .ai-locked-icon svg{ width:28px; height:28px; }
  .ai-locked-box h3{ margin:0 0 8px; }
  .ai-locked-examples{ display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin:18px 0; }
  .ai-example-chip{ background:var(--bg); border:1px solid var(--grid-line); border-radius:20px; padding:8px 14px; font-size:0.8rem; color:var(--ink); }

  .ai-chat-box{
    display:flex; flex-direction:column; gap:10px;
    max-height:420px; overflow-y:auto; padding:6px 2px 12px;
    margin-bottom:12px; scroll-behavior:smooth;
  }
  .ai-msg{ max-width:85%; padding:10px 14px; border-radius:14px; font-size:0.88rem; line-height:1.5; animation: aiMsgIn 0.32s var(--spring); }
  @keyframes aiMsgIn{
    from{ opacity:0; transform: translateY(8px) scale(0.97); }
    to{ opacity:1; transform: translateY(0) scale(1); }
  }
  .ai-msg.user{ align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
  .ai-msg.bot{ align-self:flex-start; background:var(--bg); color:var(--ink); border-bottom-left-radius:4px; }
  .ai-typing{ align-self:flex-start; background:var(--bg); border-radius:14px; border-bottom-left-radius:4px; padding:12px 16px; display:flex; gap:4px; animation: aiMsgIn 0.25s var(--ease); }
  .ai-typing span{ width:6px; height:6px; border-radius:50%; background:#9aa4b5; animation: aiTypingBounce 1.1s infinite ease-in-out; }
  .ai-typing span:nth-child(2){ animation-delay:0.15s; }
  .ai-typing span:nth-child(3){ animation-delay:0.3s; }
  @keyframes aiTypingBounce{
    0%,60%,100%{ transform:translateY(0); opacity:0.5; }
    30%{ transform:translateY(-4px); opacity:1; }
  }
  .ai-suggestions{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
  .ai-sugg-btn{ background:var(--bg); border:1px solid var(--grid-line); border-radius:20px; padding:8px 14px; font-size:0.78rem; color:var(--ink); cursor:pointer; transition: background 0.2s var(--ease), transform 0.15s var(--ease); }
  .ai-sugg-btn:hover{ background:var(--grid-line); transform:translateY(-1px); }
  .ai-sugg-btn:active{ transform:scale(0.96); }
  .ai-input-row{ display:flex; gap:8px; }
  .ai-input-row input{ flex:1; padding:11px 14px; border-radius:var(--radius); border:1px solid var(--grid-line); background:var(--paper); color:var(--ink); transition: border-color 0.2s var(--ease); }
  .ai-input-row input:focus{ outline:none; border-color:var(--accent); }
  .ai-input-row button{ padding:11px 20px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; cursor:pointer; transition: transform 0.15s var(--ease); }
  .ai-input-row button:active{ transform:scale(0.94); }

  /* PREMIUM PAGE */
  .premium-hero{ background:var(--premium); color:#fff; border-radius:var(--radius); padding:26px 22px; text-align:center; margin-bottom:22px; }
  .premium-hero h2{ margin:0 0 6px; font-size:1.5rem; }
  .premium-hero .price{ font-size:2rem; font-family:var(--font-head); font-weight:700; }
  .benefit-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-bottom:24px; }
  .benefit{ background:var(--bg); border-radius:var(--radius); padding:18px 16px; transition: transform 0.25s var(--spring); }
  .benefit:hover{ transform:translateY(-2px); }
  .benefit .b-icon{ font-size:1.4rem; }
  .benefit h3{ margin:8px 0 4px; font-size:0.95rem; }
  .benefit p{ margin:0; font-size:0.8rem; color:#8891a3; }
  .sub-btn{ padding:12px 26px; border:none; border-radius:var(--radius); background:var(--accent); color:#fff; font-weight:700; cursor:pointer; font-size:0.95rem; }
  .status-box{ background:#eafaf0; border:1px solid #b9e6c9; border-radius:12px; padding:16px; text-align:center; color:#2c7a4a; font-weight:600; }

  /* ===== MOBILE (phones) ===== */
  @media (max-width:699px){
    /* Prevent iOS Safari from zooming the whole page in when a field is
       tapped — every real form control needs to read at 16px+. */
    input, select, textarea{ font-size:16px !important; }

    .task-add{ flex-direction:column; align-items:stretch; }
    .task-add select#task-category{ flex:1 1 auto; }
    .task-add input, .task-add select, .task-add button{ width:100%; }

    .grade-goal-row{ flex-direction:column; }
    .grade-goal-row > div{ width:100%; }

    .sched-controls{ flex-direction:column; align-items:stretch; }
    .sched-controls > div{ width:100%; }

    /* Bigger, easier-to-tap targets for the small remove/close buttons */
    .subject-remove-btn, .cat-remove-btn{ width:22px; height:22px; font-size:0.85rem; }
    .ai-history-row-btn{ padding:8px; }

    /* Give the wallpaper/theme a visible frame — before this, .page nearly
       filled the screen edge-to-edge so customizing the background had
       almost no visible effect on mobile. */
    .page{ margin:10px 10px 20px; border-radius:var(--radius); padding:22px 16px 30px; }
  }

  @media (min-width:700px){
    .page{
      max-width:900px; margin-left:auto; margin-right:auto; margin-top:24px;
      border-radius:var(--radius); padding:34px 42px 42px;
    }
    .home-grid{ grid-template-columns:repeat(3, 1fr); }
    .wallpaper-grid{ grid-template-columns:repeat(5, 1fr); }
    .shop-grid{ grid-template-columns:repeat(4, 1fr); }
    .benefit-grid{ grid-template-columns:repeat(3, 1fr); }
    .ai-chat-box{ max-height:480px; }
  }

  @media (min-width:1200px){
    .page{ max-width:1320px; padding:48px 64px 64px; }
    .home-grid{ grid-template-columns:repeat(4, 1fr); gap:20px; }
    .wallpaper-grid{ grid-template-columns:repeat(6, 1fr); }
    .shop-grid{ grid-template-columns:repeat(5, 1fr); }
    .benefit-grid{ grid-template-columns:repeat(4, 1fr); }
    .ai-chat-box{ max-height:560px; }
  }

  @media (min-width:1600px){
    .page{ max-width:1560px; padding:56px 72px 72px; }
    .home-grid{ grid-template-columns:repeat(4, 1fr); gap:24px; }
    .wallpaper-grid{ grid-template-columns:repeat(8, 1fr); }
    .shop-grid{ grid-template-columns:repeat(6, 1fr); }
    h1{ font-size:2.1rem; }
  }

  @media print{
    .topbar, .tabs, .page > *:not(#view-schedule){ display:none !important; }
    #view-schedule{ display:block !important; box-shadow:none; margin:0; padding:0; }
    #view-schedule .sched-toolbar, #view-schedule .sched-controls{ display:none !important; }
    .sched-scroll{ overflow:visible !important; width:auto !important; }
    table.schedule{ min-width:0 !important; width:100% !important; font-size:11px; }
    body{ background:#fff; }
  }

  /* ===== SMOOTH TRANSITIONS (Apple-ish easing) ===== */
  :root{ --ease: cubic-bezier(.25,.46,.45,.94); --spring: cubic-bezier(.34,1.56,.64,1); }
  .home-card, .subject-chip, .wp-card, .accent-dot, .tab, .mini-btn, .task-add button,
  .checkin-btn, .freeze-btn, .sub-btn, .switch, .switch .knob, .badge{
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), opacity 0.25s var(--ease), background 0.25s var(--ease);
  }
  .home-card:active, .subject-chip:active, .mini-btn:active, .task-add button:active,
  .checkin-btn:active, .freeze-btn:active, .sub-btn:active{ transform: scale(0.96); }
  .wp-card:not(.locked):hover{ transform: translateY(-3px) scale(1.02); }
  .badge.unlocked{ animation: pop 0.4s var(--spring); }
  @keyframes pop{ from{ transform:scale(0.6); opacity:0; } to{ transform:scale(1); opacity:1; } }

  .view{ animation: fadeInUp 0.38s var(--ease); }
  @keyframes fadeInUp{
    from{ opacity:0; transform: translateY(10px); }
    to{ opacity:1; transform: translateY(0); }
  }

  /* ===== MODAL ===== */
  .modal-overlay{
    position:fixed; inset:0; background:rgba(20,25,40,0.45); backdrop-filter: blur(6px);
    display:flex; align-items:center; justify-content:center; padding:20px;
    opacity:0; pointer-events:none; transition: opacity 0.3s var(--ease); z-index:1000;
  }
  .modal-overlay.show{ opacity:1; pointer-events:all; }
  .modal-box{
    background:var(--paper); color:var(--ink); border-radius:var(--radius); padding:26px 22px;
    max-width:320px; width:100%; text-align:center;
    transform: scale(0.88) translateY(14px); opacity:0;
    transition: transform 0.4s var(--spring), opacity 0.3s var(--ease);
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  }
  .modal-overlay.show .modal-box{ transform: scale(1) translateY(0); opacity:1; }
  .modal-icon{ font-size:2.2rem; margin-bottom:6px; }
  .modal-box h3{ margin:4px 0 8px; font-size:1.1rem; }
  .modal-box p{ margin:0 0 18px; font-size:0.87rem; color:#8891a3; }
  .ws-pro-info-list{ text-align:left; margin:0 0 18px; padding-left:20px; font-size:0.85rem; color:var(--ink); line-height:1.7; }
  .modal-box input{ width:100%; padding:11px 12px; border-radius:9px; border:1px solid var(--grid-line); font-size:0.95rem; margin-bottom:14px; background:var(--paper); color:var(--ink); }
  .modal-actions{ display:flex; gap:10px; }
  .modal-actions button{ flex:1; padding:11px; border:none; border-radius:9px; font-weight:600; cursor:pointer; font-size:0.88rem; }
  .modal-btn-primary{ background:var(--ink); color:var(--paper); }
  .modal-btn-secondary{ background:var(--bg); color:var(--ink); }
  .modal-btn-premium{ background: var(--premium); color:#fff; }

  /* ===== AI CONVERSATION BAR + HISTORY PANEL ===== */
  .ai-convo-bar{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
  .ai-convo-title{ font-size:0.82rem; font-weight:700; color:var(--ink); opacity:0.7; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .ai-convo-actions{ display:flex; gap:6px; flex-shrink:0; }
  .ai-convo-btn{
    background:var(--bg); border:1px solid var(--grid-line); border-radius:20px; padding:6px 12px;
    font-size:0.76rem; font-weight:600; color:var(--ink); cursor:pointer; white-space:nowrap;
    transition: background 0.2s var(--ease), transform 0.15s var(--ease);
  }
  .ai-convo-btn:hover{ background:var(--grid-line); }
  .ai-convo-btn:active{ transform:scale(0.94); }

  .ai-history-overlay{
    position:fixed; inset:0; background:rgba(10,14,25,0.5); backdrop-filter: blur(3px);
    opacity:0; pointer-events:none; transition: opacity 0.3s var(--ease); z-index:950;
  }
  .ai-history-overlay.show{ opacity:1; pointer-events:all; }
  .ai-history-panel{
    position:fixed; top:0; right:0; bottom:0; width:300px; max-width:84vw;
    background:var(--paper); color:var(--ink);
    padding:18px 14px; display:flex; flex-direction:column; gap:10px;
    transform: translateX(100%); transition: transform 0.35s var(--spring);
    box-shadow: -6px 0 30px rgba(0,0,0,0.25);
  }
  .ai-history-overlay.show .ai-history-panel{ transform: translateX(0); }
  .ai-history-header{
    display:flex; align-items:center; justify-content:space-between;
    font-weight:700; font-size:1rem; padding:2px 4px 4px;
  }
  .ai-history-close{ background:none; border:none; color:var(--ink); font-size:1rem; cursor:pointer; padding:4px 6px; opacity:0.6; }
  .ai-history-close:hover{ opacity:1; }
  .ai-history-newbtn{
    background:var(--accent); color:#fff; border:none; border-radius:10px; padding:11px;
    font-weight:600; font-size:0.88rem; cursor:pointer; transition: transform 0.15s var(--ease);
  }
  .ai-history-newbtn:active{ transform:scale(0.97); }
  .ai-history-list{ flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:4px; }
  .ai-history-empty{ font-size:0.83rem; color:#8891a3; text-align:center; padding:30px 10px; }
  .ai-history-section-label{ font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#8891a3; margin:10px 6px 0; }
  .ai-history-row{
    display:flex; align-items:center; gap:6px; padding:10px 10px; border-radius:10px;
    background:var(--bg); cursor:pointer; transition: background 0.15s var(--ease);
  }
  .ai-history-row:hover{ background:var(--grid-line); }
  .ai-history-row.active{ outline:2px solid var(--accent); outline-offset:-2px; }
  .ai-history-row-main{ flex:1; min-width:0; }
  .ai-history-row-title{ font-size:0.85rem; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .ai-history-row-meta{ font-size:0.71rem; color:#8891a3; margin-top:2px; }
  .ai-history-row-btn{
    background:none; border:none; cursor:pointer; font-size:0.92rem; padding:5px; border-radius:6px;
    color:#8891a3; flex-shrink:0; line-height:1; transition: background 0.15s var(--ease), color 0.15s var(--ease);
  }
  .ai-history-row-btn:hover{ background:rgba(0,0,0,0.08); color:var(--ink); }
  .ai-history-row-btn.pinned{ color:var(--accent); }
