/* THEMES: everything coloured comes from these variables. The default look is "fire"; [data-theme] blocks at the end override them.
   The theme is chosen in Settings and remembered on this device (theme.js applies it before the page draws). */
:root {
  color-scheme: dark;
  --bg: #0b1020; --bg-image: none; --card: #151c36; --card2: #1d2647; --line: #2a3563; --text: #e8ecff; --dim: #9aa6d6;
  --accent: #ff7a2f; --accent2: #ffb347; --accent-text: #1a0d00; --glow: rgba(255, 122, 47, .45);
  --ok: #38d27a; --ok-text: #03230f; --bad: #ff5c6c; --info: #5aa9ff;
  --input-bg: #0f1530; --nav-bg: #0e1530ee;
  --ok-bg: #12341f; --info-bg: #11284a; --bad-bg: #3a1620; --frozen-bg: #1b2f3c; --frozen-text: #7fd8ff;
  --streak: #ff7a2f; --streak2: #ffb347; --streak-text: #1a0d00; --streak-glow: rgba(255, 122, 47, .45); /* the daily flames: orange in every theme except neon */
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px; --radius-btn: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg) var(--bg-image) no-repeat fixed; color: var(--text); font: 17px/1.45 var(--font); padding-bottom: 5.5rem; }
#app { max-width: 36rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; }
a { color: var(--info); }
.top { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.top h1 { flex: 1; margin: 0; }
.back { text-decoration: none; font-size: 1.6rem; color: var(--dim); padding: .2rem .5rem; }
.card { background: var(--card-bg, var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .7rem 0; }
.card.click { cursor: pointer; }
.card.click:active { background: var(--card2); }
.row { display: flex; align-items: center; gap: .7rem; }
.row.sp { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.dim { color: var(--dim); }
.small { font-size: .85rem; }
.big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }
.name { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
button, .btn { font: inherit; font-weight: 700; border: 0; border-radius: var(--radius-btn); padding: .8rem 1.1rem; background: var(--card2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button:disabled { opacity: .5; }
.btn.main, button.main { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-text); }
.btn.go, button.go { background: var(--ok); color: var(--ok-text); }
.btn.danger, button.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.btn.xl, button.xl { display: block; width: 100%; font-size: 1.3rem; padding: 1.1rem; margin-top: .6rem; }
.btn.sm, button.sm { padding: .45rem .8rem; font-size: .9rem; border-radius: 10px; }
.stack > * + * { margin-top: .6rem; }
input, textarea, select { font: inherit; width: 100%; padding: .75rem .9rem; border-radius: 12px; border: 1px solid var(--line); background: var(--input-bg); color: var(--text); }
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; }
.err { color: var(--bad); min-height: 1.3em; }
.pill { display: inline-block; border-radius: 99px; padding: .1rem .6rem; font-size: .8rem; font-weight: 700; background: var(--card2); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.pill.started { background: var(--info-bg); color: var(--info); }
.pill.missed { background: var(--bad-bg); color: var(--bad); }
.pill.frozen { background: var(--frozen-bg); color: var(--frozen-text); }
.week { display: flex; gap: .4rem; justify-content: space-between; margin-top: .6rem; }
.dot { flex: 1; text-align: center; font-size: .75rem; color: var(--dim); }
.dot i { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--card2); margin-bottom: .2rem; line-height: 2.1; font-style: normal; font-size: 1rem; }
.dot.done i { background: var(--ok); color: var(--ok-text); }
.dot.today i { outline: 2px solid var(--accent); }
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.grid4 .card { margin: 0; text-align: center; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.badge { text-align: center; padding: .7rem .3rem; border-radius: 16px; background: var(--card-bg, var(--card)); border: 1px solid var(--line); }
.badge .medal { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto .3rem; display: grid; place-items: center; font-size: 1.8rem; border: 4px solid; }
.badge.off { opacity: .35; filter: grayscale(1); }
.m-bronze { background: #5a3a1e; border-color: #cd7f32; }
.m-silver { background: #3a4150; border-color: #c0c8d8; }
.m-gold { background: #5a4710; border-color: #ffd24a; }
.m-diamond { background: #123a52; border-color: #7fe9ff; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin-top: .5rem; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars div.zero { background: var(--card2); }
nav#nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: var(--nav-bg); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
nav#nav a { flex: 1; max-width: 8rem; text-align: center; padding: .6rem .2rem .7rem; text-decoration: none; color: var(--dim); font-size: .78rem; position: relative; }
nav#nav a b { display: block; font-size: 1.4rem; font-weight: 400; }
nav#nav a.on { color: var(--accent2); }
nav#nav a em { position: absolute; top: .3rem; right: 28%; background: var(--bad); color: #fff; border-radius: 99px; font-style: normal; font-size: .7rem; padding: 0 .4rem; }
#toast { position: fixed; left: 50%; bottom: 6rem; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; }
#toast.show { opacity: 1; }
#toast.bad { border-color: var(--bad); }
.hero { text-align: center; padding: 3rem 0 1rem; }
.hero .logo { font-size: 4rem; }
.switch { display: flex; align-items: center; gap: .6rem; }
.switch input { width: 1.4rem; height: 1.4rem; }
.timer { font-variant-numeric: tabular-nums; }
.runtime { font-size: 3rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; margin: 1rem 0; }
.badge .medal { overflow: hidden; }
.badge .medal img { width: 100%; height: 100%; object-fit: cover; }
.badge .medal:has(img) { border: 0; background: none; width: 84px; height: 84px; border-radius: 0; }
.run.rest { border-color: var(--info); background: var(--card2); }
.bar { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; margin-top: .6rem; }
.bar i { display: block; height: 100%; width: 0; background: var(--ok); }
.trail { --d: 2.4rem; display: flex; align-items: flex-start; margin-top: .8rem; }
.col { flex: none; width: var(--d); display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.dayname { font-size: .75rem; color: var(--dim); }
.node { width: var(--d); height: var(--d); border-radius: 50%; border: 2px solid var(--line); background: var(--card2); color: var(--accent-text); display: grid; place-items: center; }
.node svg { width: 85%; height: 85%; display: block; }
.seg { flex: 1; height: 3px; margin-top: calc(var(--d) / 2 - 1.5px); background: var(--line); min-width: 2px; }
.seg.on { background: linear-gradient(90deg, var(--streak), var(--streak2)); }
.node.done { background: linear-gradient(135deg, var(--streak), var(--streak2)); border-color: var(--streak2); color: var(--streak-text); box-shadow: 0 0 12px var(--streak-glow); }
.node.today { border-color: var(--streak); }
.trail.small { --d: 1.2rem; margin-top: .5rem; }
.trail.small .node { border-width: 1.5px; box-shadow: none; }
.trail.small .seg { height: 2px; margin-top: calc(var(--d) / 2 - 1px); }
.node.future { opacity: .5; border-style: dashed; }
.node.frozen { border-color: var(--info); color: var(--info); font-size: 1.1rem; background: var(--card2); }
.trail.small .node.frozen { font-size: .6rem; }
.mini { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; overflow: hidden; vertical-align: middle; margin-right: .45rem; font-size: 1.1rem; flex: none; }
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini:has(img) { background: none; border: 0; }
.big-mini { width: 2.6rem; height: 2.6rem; margin: 0; font-size: 1.6rem; }
.hero-badge .medal { width: 84px; height: 84px; }
a.card .medal { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; overflow: hidden; border: 4px solid; flex: none; }
a.card .medal img { width: 100%; height: 100%; object-fit: cover; }
a.card .medal:has(img) { border: 0; background: none; border-radius: 0; width: 72px; height: 72px; }
.streakline { display: flex; align-items: center; gap: .6rem; height: 2.6rem; }
.streakline .flame { font-size: 2.1rem; line-height: 1; display: grid; place-items: center; width: 2.6rem; }
.streakline .num { font-size: 2.6rem; font-weight: 800; line-height: 1; min-width: 1ch; }
.streakline .frz { font-size: 1.1rem; }
.streakline .big-mini { margin: 0; }
.streakline + a { display: block; margin-top: .5rem; }

/* ---- THEME: brand (the OkSure Brand from Nexus reference/brand: dark, techy, glass, one blue accent) ---- */
[data-theme="brand"] {
  --bg: #04070b; --bg-image: radial-gradient(ellipse at 30% 0%, rgb(20 40 56 / .35), transparent 60%);
  --card: #0c1218; --card-bg: linear-gradient(135deg, #193651 0%, #0a0f11 100%); --card2: rgba(64, 161, 251, .14); --line: rgba(170, 180, 195, .2);
  --text: #e6e9ee; --dim: #8b93a0;
  --accent: #40a1fb; --accent2: #70b8fc; --accent-text: #04121f; --glow: rgba(64, 161, 251, .45);
  --ok: #3ee6a0; --ok-text: #03251a; --bad: #ff6a55; --info: #40a1fb;
  --input-bg: rgba(0, 0, 0, .4); --nav-bg: rgba(4, 7, 11, .92);
  --ok-bg: rgba(62, 230, 160, .14); --info-bg: rgba(64, 161, 251, .16); --bad-bg: rgba(255, 106, 85, .16); --frozen-bg: rgba(112, 184, 252, .14); --frozen-text: #70b8fc;
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --radius: 12px; --radius-btn: 10px;
}
[data-theme="brand"] h1 { text-transform: uppercase; letter-spacing: .14em; font-size: 1.35rem; font-weight: 600; }
[data-theme="brand"] h2 { letter-spacing: .16em; color: var(--accent); }
[data-theme="brand"] .card, [data-theme="brand"] .badge { border: 1px solid transparent; background: var(--card-bg) padding-box, linear-gradient(135deg, #40a1fb, #000) border-box; }
[data-theme="brand"] .card { box-shadow: inset 3px 0 0 var(--accent); }
[data-theme="brand"] button, [data-theme="brand"] .btn { letter-spacing: .04em; font-weight: 600; border: 1px solid var(--accent); background: transparent; color: var(--accent); }
[data-theme="brand"] .btn.main, [data-theme="brand"] button.main { background: var(--accent); color: var(--accent-text); box-shadow: 0 0 16px var(--glow); }
[data-theme="brand"] .btn.go, [data-theme="brand"] button.go { background: var(--ok); color: var(--ok-text); border-color: var(--ok); }
[data-theme="brand"] .btn.danger, [data-theme="brand"] button.danger { border-color: var(--bad); color: var(--bad); }
[data-theme="brand"] .btn.xl, [data-theme="brand"] button.xl { letter-spacing: .08em; }
[data-theme="brand"] .theme-pick button.on { border-width: 2px; }

/* ---- THEME: fire is the original dark navy and orange (the defaults at the top) ---- */

/* ---- THEME: light, clean and bright, orange accent ---- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa; --card: #ffffff; --card2: #eaeef7; --line: #d6dcea; --text: #1a2036; --dim: #5b6682;
  --accent: #f2600c; --accent2: #ff9a3d; --accent-text: #ffffff; --glow: rgba(242, 96, 12, .4);
  --ok: #1f9d55; --ok-text: #ffffff; --bad: #d93a4c; --info: #2866d8;
  --input-bg: #ffffff; --nav-bg: rgba(255, 255, 255, .94);
  --ok-bg: #dcf4e6; --info-bg: #dde8fb; --bad-bg: #fbe0e4; --frozen-bg: #dff1fa; --frozen-text: #1b7fa8;
}
[data-theme="light"] .card { box-shadow: 0 1px 3px rgba(26, 32, 54, .08); }
[data-theme="light"] a { color: var(--info); }

/* ---- THEME: neon, sporty black with electric lime ---- */
[data-theme="neon"] {
  --bg: #050605; --card: #111611; --card2: #1b231b; --line: #2a3626; --text: #f3ffe9; --dim: #94a68a;
  --accent: #b6ff2e; --accent2: #e6ff5c; --accent-text: #0b1400; --glow: rgba(182, 255, 46, .4);
  --ok: #3ee6a0; --ok-text: #03251a; --bad: #ff5d73; --info: #4dd2ff;
  --input-bg: #0a0e0a; --nav-bg: rgba(5, 6, 5, .94);
  --ok-bg: #123324; --info-bg: #0f2c3a; --bad-bg: #3a1620; --frozen-bg: #0f2c3a; --frozen-text: #7fe3ff;
  --radius: 10px; --radius-btn: 10px;
  --streak: #b6ff2e; --streak2: #e6ff5c; --streak-text: #0b1400; --streak-glow: rgba(182, 255, 46, .4);
}
[data-theme="neon"] h1 { text-transform: uppercase; font-weight: 800; letter-spacing: .04em; }
[data-theme="neon"] .btn.main, [data-theme="neon"] button.main { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

/* ---- theme picker (Settings) ---- */
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.theme-pick button { padding: .7rem; text-align: left; border: 2px solid var(--line); background: var(--card2); }
.theme-pick button.on { border-color: var(--accent); }
.theme-pick .sw { display: flex; gap: 4px; margin-bottom: .4rem; }
.theme-pick .sw i { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .5); }
[data-theme="light"] .streakline + a { color: var(--accent) !important; }
