/*
 * Life Discipline Tracker: the tool's own components, styled in the site's design language (7 Oct 2026, on the
 * UltraCompress Pro template, after MindSharp). Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme
 * toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). This file holds only what the tool itself
 * needs: the twelve accent colours the catalogue of areas refers to (var(--accent-*) and -dim), the toolbar with the level
 * badge, date, pill tabs and the jump list, the overall score ring, the progress and badge card, the area score cards (an
 * auto-filled grid, so the last row never has an empty slot however many areas are switched on), the area view with its
 * item cards (yes button, number stepper, star rating, time field), the month heatmap, the day list, the insight cards,
 * the area switches, the windows, the toasts and the information sections. Light is the default; dark applies when <html>
 * has no data-theme.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --ok: #166534; --warn: #92400e; --bad: #b91c1c;
    --accent-orange: #ea580c; --accent-orange-dim: rgba(234, 88, 12, 0.14);
    --accent-indigo: #4f46e5; --accent-indigo-dim: rgba(79, 70, 229, 0.14);
    --accent-green: #16a34a; --accent-green-dim: rgba(22, 163, 74, 0.14);
    --accent-mint: #059669; --accent-mint-dim: rgba(5, 150, 105, 0.14);
    --accent-cyan: #0891b2; --accent-cyan-dim: rgba(8, 145, 178, 0.14);
    --accent-pink: #db2777; --accent-pink-dim: rgba(219, 39, 119, 0.14);
    --accent-blue: #2563eb; --accent-blue-dim: rgba(37, 99, 235, 0.14);
    --accent-yellow: #a16207; --accent-yellow-dim: rgba(202, 138, 4, 0.16);
    --accent-purple: #7c3aed; --accent-purple-dim: rgba(124, 58, 237, 0.14);
    --accent-red: #dc2626; --accent-red-dim: rgba(220, 38, 38, 0.14);
    --accent-teal: #0d9488; --accent-teal-dim: rgba(13, 148, 136, 0.14);
    --accent-gold: #b45309; --accent-gold-dim: rgba(180, 83, 9, 0.16);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --accent-orange: #fb923c; --accent-indigo: #818cf8; --accent-green: #4ade80; --accent-mint: #34d399; --accent-cyan: #22d3ee;
    --accent-pink: #f472b6; --accent-blue: #60a5fa; --accent-yellow: #facc15; --accent-purple: #a78bfa; --accent-red: #f87171;
    --accent-teal: #2dd4bf; --accent-gold: #fbbf24;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }
.hidden-input { display: none; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm { padding: 8px 15px; }
.btn-icon.btn-sm { width: 38px; height: 38px; padding: 0; }
.btn-icon.btn-sm svg { width: 17px; height: 17px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.level-badge { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 200px; }
.level-icon { font-size: 1.3rem; line-height: 1; }
.level-text { display: flex; flex-direction: column; line-height: 1.2; }
.level-name { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); }
.level-xp { font-size: 0.72rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.xp-bar { flex: 1; min-width: 50px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--gradient-brand); transition: width 0.5s ease; }
.header-date { display: flex; flex-direction: column; line-height: 1.2; }
.date-day { font-weight: 700; font-size: 0.9rem; color: var(--text-strong); }
.date-full { font-size: 0.78rem; color: var(--text-3); }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; overflow-x: auto; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.jump-select { width: auto; min-width: 190px; border-radius: 9999px; padding: 9px 36px 9px 16px; font-size: 0.85rem; font-weight: 600; }
.view[hidden] { display: none; }

/* ----- Cards ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:last-child { margin-bottom: 0; }
.card--wide { grid-column: span 2; }
.settings-column { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; }
.card-text { color: var(--text-2); margin: 0 0 14px; line-height: 1.55; font-size: 0.95rem; }
.section-heading { font-size: 1.25rem; margin: 24px 0 14px; display: flex; align-items: center; gap: 8px; }
.form-hint { font-size: 0.78rem; color: var(--text-3); margin: 0; line-height: 1.5; }
.mini-title { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin: 18px 0 10px; }

/* ----- Overall score ----- */
.overall-body { display: flex; align-items: center; gap: 28px; }
.overall-ring { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.overall-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.ring-progress { fill: none; stroke: url(#scoreGradient); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.overall-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.overall-number { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 3rem; font-weight: 700; line-height: 1; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.overall-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-top: 4px; }
.overall-text h2 { margin: 0 0 6px; font-size: 1.35rem; }
.overall-text p { margin: 0 0 14px; color: var(--text-2); }
.streak-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.streak-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9999px; background: var(--chip); border: 1px solid var(--chip-border); font-size: 0.82rem; font-weight: 600; color: var(--text-strong); }

/* ----- Progress and badges ----- */
.level-display { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.level-big-icon { font-size: 2.4rem; line-height: 1; }
.level-big-name { margin: 0; font-size: 1.3rem; }
.level-big-sub { margin: 2px 0 0; color: var(--text-3); font-size: 0.85rem; }
.xp-progress-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.xp-progress-fill { height: 100%; width: 0; border-radius: 5px; background: var(--gradient-brand); transition: width 0.5s ease; }
.xp-progress-text { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-3); margin-top: 6px; font-variant-numeric: tabular-nums; }
.badges-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.badge-item.earned { background: var(--tint-brand); border: 1px solid var(--tint-brand-border); }
.badge-item.locked .badge-icon { opacity: 0.6; }
.badge-icon { font-size: 1.4rem; line-height: 1; }
.badge-name { font-size: 0.72rem; font-weight: 600; color: var(--text-2); }

/* ----- Area score cards: a wrapping row whose cards grow, so the last row is always full whatever the count ----- */
.score-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.score-card { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 18px; text-align: left; background: var(--surface); border: 1px solid var(--surface-border); border-left: 4px solid var(--card-accent, var(--brand)); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); font-family: inherit; color: var(--text); cursor: pointer; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.score-card:hover { transform: translateY(-3px); box-shadow: var(--surface-hover-shadow); }
.score-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.score-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.score-card-title { font-weight: 700; font-size: 0.95rem; color: var(--text-strong); }
.score-card-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.8rem; font-weight: 700; line-height: 1.1; color: var(--card-accent, var(--text-strong)); font-variant-numeric: tabular-nums; }
.score-card-subtitle { font-size: 0.78rem; color: var(--text-3); }
.score-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--card-accent-dim, var(--tint-brand)); flex-shrink: 0; }
.score-card-trend { font-size: 0.8rem; font-weight: 600; color: var(--text-3); }
.score-card-trend.trend-up { color: var(--ok); }
.score-card-trend.trend-mid { color: var(--warn); }
.grade-good { color: var(--ok); } .grade-fair { color: var(--warn); } .grade-poor { color: var(--bad); }

/* ----- Area view ----- */
.domain-header { padding: 16px 20px; border-bottom: 1px solid var(--surface-border); border-top: 4px solid var(--card-accent, var(--brand)); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.domain-title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.domain-title-row h2 { margin: 0; font-size: 1.3rem; }
.domain-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--card-accent-dim, var(--tint-brand)); flex-shrink: 0; }
.domain-meta { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-3); }
.domain-header-right { display: flex; align-items: center; gap: 16px; }
.domain-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.domain-score-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--card-accent, var(--link)); font-variant-numeric: tabular-nums; }
.domain-score-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.domain-nav { display: flex; gap: 6px; }
.metrics-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.metric-card { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--surface-border); background: var(--surface-2); }
.metric-card.is-pinned { border-color: var(--brand); }
.metric-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.metric-title { font-weight: 600; font-size: 0.95rem; color: var(--text-strong); line-height: 1.3; }
.metric-weight { flex-shrink: 0; font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 9999px; background: var(--chip); border: 1px solid var(--chip-border); color: var(--text-3); }
.metric-weight.w-critical { color: var(--bad); border-color: var(--bad); }
.metric-weight.w-high { color: var(--warn); border-color: var(--warn); }
.metric-weight.w-info { opacity: 0.7; }
.metric-input { display: flex; flex-direction: column; gap: 6px; }
.metric-target { font-size: 0.75rem; color: var(--text-3); }
.metric-description { font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }
.yes-btn { align-self: flex-start; padding: 9px 16px 9px 12px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.88rem; font-weight: 600; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.yes-btn::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--chip-border); background: transparent; transition: background 0.2s ease, border-color 0.2s ease; }
.yes-btn[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.yes-btn[aria-pressed="true"]::before { background: #fff; border-color: #fff; box-shadow: inset 0 0 0 4px #8B5CF6; }
.yes-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.number-group { display: flex; align-items: center; gap: 8px; }
.number-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--surface); color: var(--text-strong); font-size: 1.1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.number-btn:hover { border-color: var(--brand); color: var(--link); }
.form-input { width: 100%; min-width: 0; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.form-input::placeholder { color: var(--placeholder); }
select.form-input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
select.form-input option { color: #0a0a14; background: #fff; }
.number-field { width: 86px; text-align: center; font-weight: 700; padding: 8px 10px; font-variant-numeric: tabular-nums; }
.number-field::-webkit-outer-spin-button, .number-field::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-field[type=number] { -moz-appearance: textfield; appearance: textfield; }
.number-unit { font-size: 0.8rem; color: var(--text-3); min-width: 0; }
.time-field { width: 150px; padding: 8px 12px; font-weight: 600; }
.rating-group { display: flex; gap: 4px; }
.star-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--chip-border); background: var(--surface); color: var(--chip-border); font-size: 1.3rem; line-height: 1; cursor: pointer; transition: color 0.15s ease, transform 0.15s ease, border-color 0.15s ease; }
.star-btn:hover { transform: scale(1.08); border-color: var(--brand); }
.star-btn.is-on { color: #f59e0b; border-color: rgba(245, 158, 11, 0.5); }
.star-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.custom-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid var(--surface-border); }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--chip-border); background: var(--surface); font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); }
.icon-btn.is-on { background: var(--tint-brand); border-color: var(--brand); }
.domain-footer { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.domain-footer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-state { flex: 1 1 100%; text-align: center; padding: 30px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon { font-size: 2.2rem; line-height: 1; }
.empty-state h3 { margin: 6px 0 0; font-size: 1.1rem; }
.empty-state p { margin: 0 0 10px; color: var(--text-3); font-size: 0.92rem; }

/* ----- Heatmap and day list ----- */
.month-nav { display: flex; align-items: center; gap: 10px; }
.month-label { font-weight: 700; min-width: 140px; text-align: center; color: var(--text-strong); }
.heat-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; font-size: 0.72rem; text-align: center; color: var(--text-3); font-weight: 600; }
.heat-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-cell { aspect-ratio: 1; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; color: var(--text-3); }
.heat-cell.is-empty { background: transparent; }
.heat-cell.is-today { outline: 2px solid var(--brand); outline-offset: -2px; }
.heat-cell.level-1 { background: rgba(139, 92, 246, 0.2); color: var(--text-strong); }
.heat-cell.level-2 { background: rgba(139, 92, 246, 0.38); color: var(--text-strong); }
.heat-cell.level-3 { background: rgba(139, 92, 246, 0.58); color: #fff; }
.heat-cell.level-4 { background: rgba(139, 92, 246, 0.8); color: #fff; }
.heat-cell.level-5 { background: var(--gradient-brand); color: #fff; }
.heat-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.72rem; color: var(--text-3); }
.heat-cell.is-legend { width: 16px; height: 16px; aspect-ratio: auto; border-radius: 4px; display: block; }
.day-list { display: flex; flex-direction: column; gap: 8px; }
.day-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.day-card .score-card-value { font-size: 1.4rem; }

/* ----- Insights ----- */
.insights-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.insight-list { display: flex; flex-direction: column; gap: 8px; }
.insight-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.9rem; }
.insight-icon { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.insight-text { flex: 1; min-width: 0; color: var(--text); }
.insight-value { font-weight: 700; color: var(--link); flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.avg-list { display: flex; flex-direction: column; gap: 8px; }
.avg-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) 44px; align-items: center; gap: 10px; font-size: 0.85rem; }
.avg-name { font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avg-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.avg-fill { height: 100%; border-radius: 4px; background: var(--ok); }
.avg-fill.grade-fair { background: var(--warn); } .avg-fill.grade-poor { background: var(--bad); }
.avg-value { text-align: right; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ----- Settings ----- */
.domain-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--surface-border); }
.switch-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-label { font-weight: 600; font-size: 0.92rem; color: var(--text-strong); }
.switch-hint { font-size: 0.75rem; color: var(--text-3); }
.toggle { position: relative; width: 46px; height: 26px; flex-shrink: 0; border-radius: 9999px; border: 0; padding: 0; background: var(--chip-border); cursor: pointer; transition: background 0.2s ease; }
.toggle .toggle-knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.toggle[aria-checked="true"] { background: var(--gradient-brand); }
.toggle[aria-checked="true"] .toggle-knob { transform: translateX(20px); }
.toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Forms in windows ----- */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group[hidden] { display: none; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--text-strong); }
.form-error { margin-top: 4px; font-size: 0.8rem; color: var(--danger); }
.form-error:empty { display: none; }

/* ----- Windows ----- */
.modal-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); width: 100%; max-width: 520px; max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; transform: translateY(12px); transition: transform 0.25s ease; }
.modal--narrow { max-width: 420px; }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { margin: 0; font-size: 1.15rem; }
.modal-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color 0.2s ease, color 0.2s ease; }
.modal-close:hover { border-color: var(--brand); color: var(--link); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal-footer--center { justify-content: center; }
.confirm-message { margin: 0; color: var(--text); }
.result-body { text-align: center; }
.result-icon { font-size: 3.2rem; line-height: 1; margin-bottom: 8px; animation: pop 0.4s ease; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-message { color: var(--text-2); margin: 6px 0 8px; }
.result-xp { margin: 0; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--link); }

/* ----- Toasts ----- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.toast { background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 400px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast-icon { font-size: 1.1rem; line-height: 1; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: #4ade80; } .toast.error { border-left-color: #f87171; } .toast.warning { border-left-color: #fbbf24; } .toast.info { border-left-color: #38bdf8; }
.toast.leaving { opacity: 0; transform: translateX(40px); }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .card-grid, .insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card--wide { grid-column: span 2; }
    .settings-column { grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .settings-column .card:last-child { grid-column: span 2; }
    .info-section .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .level-badge { flex: 1; min-width: 0; }
    .header-date { display: none; }
    .view-tabs { width: 100%; }
    .view-tab { flex: 1; padding: 8px 6px; font-size: 0.78rem; text-align: center; }
    .jump-select { width: 100%; }
    .card-grid, .insights-grid { grid-template-columns: 1fr; gap: 14px; }
    .card--wide, .settings-column, .settings-column .card:last-child { grid-column: auto; }
    .settings-column { grid-template-columns: 1fr; }
    .card-header { padding-left: 16px; padding-right: 16px; }
    .card-body { padding: 14px 16px 16px; }
    .overall-body { flex-direction: column; text-align: center; gap: 16px; }
    .overall-ring { width: 150px; height: 150px; }
    .overall-number { font-size: 2.5rem; }
    .streak-badges { justify-content: center; }
    .score-grid { gap: 12px; }
    .score-card { flex-basis: 100%; }
    .domain-header { padding: 14px 16px; }
    .domain-header-right { width: 100%; justify-content: space-between; }
    .metric-card { flex-basis: 100%; }
    .domain-footer { padding: 12px 16px; }
    .domain-footer-actions { width: 100%; }
    .domain-footer-actions .btn { flex: 1; }
    .domain-toggles { grid-template-columns: 1fr; }
    .heat-cell { font-size: 0.7rem; border-radius: 6px; }
    .badges-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-row { grid-template-columns: 1fr; }
    .modal-overlay { padding: 8px; }
    .modal-body, .modal-header, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .toast-container { bottom: 16px; right: 16px; left: 16px; align-items: flex-end; }
    .toast { min-width: 0; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .modal, .toast, .toggle .toggle-knob, .score-card, .ring-progress, .xp-fill, .xp-progress-fill, .result-icon, .star-btn, .yes-btn { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
}
