/* ------------------------------------------------------------------
   Themes: set via <html data-theme="default|dark|handwritten|tranquil">
------------------------------------------------------------------- */

/* ---------- Dark ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101119; --paper: #1b1d28; --ink: #e8e2d8; --brown: #ebc79f; --hand: #f3d3ac; --gold: #d8b45f; --gold-soft: rgba(216,180,95,.26);
  --line: #2f3241; --muted: #9a96a4; --accent: #dc8f64; --accent-hover: #eaa37b; --sage: #272b38; --blush: #3a2d33;
  --card: #262937; --card-a: rgba(38,41,55,.72); --card-b: rgba(38,41,55,.82); --hover-card: #2d3142;
  --on-accent: #1d1209; --on-brown: #1d1209; --ctl-border: #4a4f63; --rule: #2b2e3c; --rule-dot: #4a4f63;
  --pill-bg: #2a2d3b; --pill-bd: #6a6246; --done-bg: #243029; --done-bd: #4d6c59; --na: #151620;
  --dot-on: #b87a98; --dot-on-bd: #d092b0; --star-off: #3c3f4e; --drop-bd: #4f6f85; --drop-on: #4a8fb0; --drop-on-bd: #78b8d6;
  --ok: #92c68c; --danger: #ff8a80; --glow: rgba(120,90,170,.18);
  --shadow: 0 18px 50px rgba(0,0,0,.55); --shadow-sm: 0 2px 8px rgba(0,0,0,.45);
  --body-bg:
    radial-gradient(ellipse at 8% 4%, rgba(110, 80, 160, .22), transparent 42%),
    radial-gradient(ellipse at 96% 12%, rgba(201, 162, 75, .10), transparent 38%),
    radial-gradient(ellipse at 80% 100%, rgba(60, 110, 120, .18), transparent 45%), var(--bg);
}
:root[data-theme="dark"] .pcell.l1 { background: #8a4a4a; }
:root[data-theme="dark"] .pcell.l2 { background: #b8605d; }
:root[data-theme="dark"] .pcell.l3 { background: #e0706c; }
:root[data-theme="dark"] .vimg img { opacity: .92; }

/* ---------- Handwritten (black / white / grey) ---------- */
:root[data-theme="handwritten"] {
  --bg: #e6e6e6; --paper: #ffffff; --ink: #1c1c1c; --brown: #111; --hand: #222; --gold: #6f6f6f; --gold-soft: #dedede;
  --line: #c9c9c9; --muted: #6f6f6f; --accent: #222; --accent-hover: #000; --sage: #ebebeb; --blush: #e4e4e4;
  --card: #fff; --card-a: rgba(255,255,255,.7); --card-b: rgba(255,255,255,.8); --hover-card: #f3f3f3;
  --on-accent: #fff; --on-brown: #fff; --ctl-border: #8a8a8a; --rule: #d6d6d6; --rule-dot: #a8a8a8;
  --pill-bg: #f4f4f4; --pill-bd: #555; --done-bg: #efefef; --done-bd: #777; --na: #efefef;
  --dot-on: #555; --dot-on-bd: #222; --star-off: #d4d4d4; --drop-bd: #777; --drop-on: #aaa; --drop-on-bd: #444;
  --ok: #333; --danger: #111; --glow: rgba(0,0,0,.04);
  --shadow: 5px 6px 0 #bdbdbd; --shadow-sm: 3px 3px 0 #c8c8c8;
  --body-bg: repeating-linear-gradient(0deg, transparent 0 31px, rgba(0,0,0,.05) 31px 32px), var(--bg);
  --font-title: 'Caveat', 'Segoe Script', 'Bradley Hand', cursive;
  --font-hand: 'Caveat', 'Segoe Script', 'Bradley Hand', cursive;
  --font-ui: 'Patrick Hand', 'Caveat', 'Segoe Script', 'Bradley Hand', cursive;
  --base-size: 17px;
}
:root[data-theme="handwritten"] .sheet,
:root[data-theme="handwritten"] .auth-card { border: 2px solid #222; border-radius: 18px 14px 20px 12px / 12px 20px 14px 18px; }
:root[data-theme="handwritten"] .sheet::before { display: none; }
:root[data-theme="handwritten"] .ptitle h1 { font-weight: 700; font-size: 2.9rem; }
:root[data-theme="handwritten"] .auth-title { font-weight: 700; font-size: 2.8rem; }
:root[data-theme="handwritten"] .subhead,
:root[data-theme="handwritten"] .isec h2,
:root[data-theme="handwritten"] .scale-total,
:root[data-theme="handwritten"] .prose .lede,
:root[data-theme="handwritten"] .orb-label,
:root[data-theme="handwritten"] .stat b { font-weight: 700; }
:root[data-theme="handwritten"] .links a,
:root[data-theme="handwritten"] .page > div > .links a { font-family: var(--font-hand); font-weight: 700; font-size: 1.4rem; }
:root[data-theme="handwritten"] .flabel,
:root[data-theme="handwritten"] .band,
:root[data-theme="handwritten"] .grid-table th,
:root[data-theme="handwritten"] .period-table th,
:root[data-theme="handwritten"] .pill,
:root[data-theme="handwritten"] .dow,
:root[data-theme="handwritten"] .hour,
:root[data-theme="handwritten"] .pm,
:root[data-theme="handwritten"] .auth-brand,
:root[data-theme="handwritten"] .topnav { text-transform: none; letter-spacing: 0; }
:root[data-theme="handwritten"] .flabel { border: 1.5px solid #222; border-radius: 255px 14px 225px 14px / 14px 225px 14px 255px; font-size: 1.15rem; font-weight: 700; background: var(--sage); }
:root[data-theme="handwritten"] .band { border: 1.5px solid #222; font-size: 1.2rem; font-weight: 700; }
:root[data-theme="handwritten"] .pill { border: 1.5px solid #222; border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px; font-size: 1.05rem; }
:root[data-theme="handwritten"] .btn { border: 2px solid #222; border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px; font-size: 1.15rem; }
:root[data-theme="handwritten"] .btn.ghost { color: #222; border-color: #222; }
:root[data-theme="handwritten"] .cell,
:root[data-theme="handwritten"] .cd,
:root[data-theme="handwritten"] .notecard,
:root[data-theme="handwritten"] .stat,
:root[data-theme="handwritten"] textarea,
:root[data-theme="handwritten"] .vimg { border-color: #444; }
:root[data-theme="handwritten"] .months a.now,
:root[data-theme="handwritten"] .days a.now { background: #e0e0e0; text-decoration: underline wavy #555; }
:root[data-theme="handwritten"] .topnav { font-size: .95rem; }
:root[data-theme="handwritten"] .mood .emoji,
:root[data-theme="handwritten"] .mdot,
:root[data-theme="handwritten"] .px,
:root[data-theme="handwritten"] .pcell,
:root[data-theme="handwritten"] .wheel-svg,
:root[data-theme="handwritten"] .vimg img,
:root[data-theme="handwritten"] .orb,
:root[data-theme="handwritten"] .acct-logo,
:root[data-theme="handwritten"] .brand img,
:root[data-theme="handwritten"] .auth-logo,
:root[data-theme="handwritten"] .tcard.tc-logo { filter: grayscale(1); }
:root[data-theme="handwritten"] .mood.on { background: #e6e6e6; border-color: #222; }
:root[data-theme="handwritten"] .fmenu a { filter: grayscale(1); }
:root[data-theme="handwritten"] .check input:checked + .box { background: #222; border-color: #222; }

/* ---------- Tranquil (colours from the logo: dusk navy, teal, violet, rose, amber) ---------- */
:root[data-theme="tranquil"] {
  color-scheme: dark;
  --bg: #141a38; --paper: rgba(22,27,64,.9); --ink: #f5e7cc; --brown: #ffd9a3; --hand: #ffcb8e; --gold: #f5b66b; --gold-soft: rgba(245,182,107,.26);
  --line: #323b6e; --muted: #aaa3c9; --accent: #f08a5d; --accent-hover: #ff9e75; --sage: #1f4659; --blush: #3a2a5e;
  --card: #262d5e; --card-a: rgba(38,45,94,.72); --card-b: rgba(38,45,94,.82); --hover-card: #2f3772;
  --on-accent: #2a1232; --on-brown: #1b2147; --ctl-border: #5058a0; --rule: #2d3568; --rule-dot: #5058a0;
  --pill-bg: #2a3268; --pill-bd: #8e6fae; --done-bg: #1f4a52; --done-bd: #40918c; --na: #151a3c;
  --dot-on: #d9608f; --dot-on-bd: #f08fb2; --star-off: #3b4380; --drop-bd: #3f909c; --drop-on: #35a0a6; --drop-on-bd: #72d4d2;
  --ok: #80dab2; --danger: #ff9393; --glow: rgba(217,96,143,.22);
  --shadow: 0 22px 60px rgba(5,6,25,.55); --shadow-sm: 0 2px 10px rgba(5,6,25,.5);
  --body-bg:
    radial-gradient(ellipse at 14% -6%, rgba(217,96,143,.38), transparent 52%),
    radial-gradient(ellipse at 96% 2%, rgba(42,160,160,.34), transparent 46%),
    radial-gradient(ellipse at 50% 112%, rgba(245,150,100,.30), transparent 52%),
    linear-gradient(165deg, #2a2a6c 0%, #1a2e5b 38%, #1b4a5b 72%, #1c6468 100%);
}
:root[data-theme="tranquil"] .sheet,
:root[data-theme="tranquil"] .auth-card { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(245,182,107,.22); }
:root[data-theme="tranquil"] .ptitle h1,
:root[data-theme="tranquil"] .auth-title { background: linear-gradient(90deg, #ffe3b0 0%, #f4a070 55%, #e5709c 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="tranquil"] .btn { background: linear-gradient(135deg, #f4a070, #d9608f); }
:root[data-theme="tranquil"] .btn:hover { filter: brightness(1.08); }
:root[data-theme="tranquil"] .btn.ghost { background: transparent; color: var(--gold); border-color: var(--gold); }
:root[data-theme="tranquil"] .days a.sel { background: linear-gradient(135deg, #f4a070, #d9608f); color: #2a1232; }
:root[data-theme="tranquil"] .pcell.l1 { background: #7a4a7a; }
:root[data-theme="tranquil"] .pcell.l2 { background: #c0558a; }
:root[data-theme="tranquil"] .pcell.l3 { background: #f08a5d; }
:root[data-theme="tranquil"] .check input:checked + .box { background: #f08a5d; border-color: #f08a5d; }
:root[data-theme="tranquil"] .mdot { box-shadow: 0 0 8px currentColor; }
