:root {
  color-scheme: dark;
  --bg: #110d16;
  --panel: #17111e;
  --text: #f7eee8;
  --muted: #9a899d;
  --line: #2d2334;
  --accent: #ff9a62;
  --accent-strong: #ffb078;
  --violet: #a779e8;
  --accent-soft: rgba(255, 154, 98, .13);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(circle at 50% 48%, rgba(112, 66, 139, .12) 0, transparent 34%),
    radial-gradient(circle at 82% 90%, rgba(197, 87, 60, .055) 0, transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); text-decoration: none; font-size: 19px; font-weight: 600; letter-spacing: -.7px; }
.brand span { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.tracking-trigger { height: 38px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: #16101c; color: #b8a9ba; border-radius: 999px; padding: 0 14px; font-size: 10px; cursor: pointer; }
.tracking-trigger:hover, .tracking-trigger.active { color: var(--text); border-color: #493454; background: #201628; }
.tracking-trigger svg { width: 14px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
.icon-button, .secondary-control {
  border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted);
}
.icon-button { width: 40px; height: 40px; border-radius: 50%; }
.icon-button:hover { color: var(--text); background: #211829; }
.icon-button svg, .secondary-control svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.timer-section { flex: 1; display: flex; align-items: center; flex-direction: column; justify-content: center; padding: 38px 24px 42px; }

.timer-stage { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; }
.timer-wrap { position: relative; width: min(61vw, 360px); aspect-ratio: 1; margin: 0 0 38px; display: grid; place-items: center; }
.study-categories { position: absolute; right: calc(50% + 210px); top: 50%; width: 128px; display: grid; gap: 7px; transform: translateY(calc(-50% - 19px)); }
.category-title { margin: 0 0 3px 3px; color: var(--theme-muted, #817487); font-size: 8px; letter-spacing: 1.7px; }
.study-category { display: flex; align-items: center; gap: 9px; width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--theme-line, #302438); border-radius: 9px; background: var(--theme-surface, rgba(20,15,25,.8)); color: var(--theme-muted, #9a899d); font-size: 10px; cursor: pointer; backdrop-filter: blur(8px); transition: all .2s; }
.study-category:hover { color: var(--theme-text, #fff); transform: translateX(-2px); }
.study-category.active { color: var(--theme-text, #fff); border-color: color-mix(in srgb, var(--category-color) 55%, transparent); background: color-mix(in srgb, var(--theme-surface-solid) 85%, var(--category-color)); }
.study-category i { width: 7px; height: 7px; border-radius: 50%; background: var(--category-color); box-shadow: 0 0 8px color-mix(in srgb, var(--category-color) 55%, transparent); }
.study-category b { margin-left: auto; color: var(--category-color); font-size: 9px; opacity: 0; }
.study-category.active b { opacity: 1; }
.study-category[data-category="russe"] { --category-color: #ff6b5f; }
.study-category[data-category="fac"] { --category-color: #8f83ff; }
.study-category[data-category="letton"] { --category-color: #4fc58b; }
.progress { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.track, .segment, .remaining-mask { fill: none; stroke-width: 2; }
.track { stroke: var(--line); }
.segment { stroke-linecap: round; transition: opacity .25s; }
.focus-segment { stroke: url(#focusGradient); filter: drop-shadow(0 0 6px rgba(244,127,89,.38)); }
.break-segment { stroke: url(#breakGradient); filter: drop-shadow(0 0 6px rgba(167,121,232,.42)); }
.remaining-mask { stroke: #2d2334; stroke-linecap: butt; transition: stroke-dashoffset .5s linear; }
body[data-mode="focus"] .break-segment { opacity: .42; }
body[data-mode="short"] .focus-segment { opacity: .38; }
.timer-content { text-align: center; z-index: 1; }
.status { color: var(--accent-strong); font-size: 9px; letter-spacing: 2.4px; margin: 0 0 13px; font-weight: 600; }
#timer { display: block; font-family: "DM Mono", monospace; font-weight: 300; font-size: clamp(64px, 10vw, 88px); letter-spacing: -6px; line-height: 1; font-variant-numeric: tabular-nums; }
.session { margin: 17px 0 0; color: var(--muted); font-size: 11px; }

.controls { display: flex; align-items: center; gap: 28px; }
.primary-control { min-width: 146px; padding: 15px 24px; border: 0; border-radius: 999px; background: linear-gradient(135deg, #ffad72, #f3845a); color: #241019; font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px; font-weight: 600; cursor: pointer; box-shadow: 0 0 0 0 var(--accent-soft), 0 8px 30px rgba(227,105,75,.08); transition: transform .15s, box-shadow .2s; }
.primary-control:hover { transform: translateY(-1px); box-shadow: 0 0 0 7px var(--accent-soft); }
.primary-control:active { transform: translateY(0) scale(.98); }
.secondary-control { width: 40px; height: 40px; border-radius: 50%; }
.secondary-control:hover { color: var(--text); background: #201726; }
.hint { color: #4c4c49; font-size: 10px; margin: 30px 0 0; }
kbd { font: inherit; border: 1px solid #35283c; border-radius: 4px; padding: 2px 5px; color: #95849a; }

.settings { position: fixed; z-index: 5; top: 0; right: 0; width: min(420px, 100%); height: 100%; background: #15101b; border-left: 1px solid var(--line); padding: 32px; transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.settings.open { transform: translateX(0); }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.settings h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -1px; }
.eyebrow { color: var(--accent); font-size: 9px; letter-spacing: 2px; }
#closeSettings { font-size: 27px; font-weight: 200; }
fieldset { border: 0; margin: 31px 0 15px; padding: 0; }
legend { width: 100%; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
legend span { float: right; color: var(--muted); font-size: 10px; font-weight: 400; }
fieldset label { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 15px 0; font-size: 12px; color: #aaa; }
input[type="number"] { width: 64px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #211829; color: var(--text); text-align: center; outline: 0; }
.theme-fieldset { margin-bottom: 0; }
.theme-fieldset select { min-width: 178px; padding: 9px 30px 9px 11px; border: 1px solid var(--theme-line); border-radius: 7px; outline: none; background: var(--theme-surface-solid); color: var(--theme-text); font-size: 11px; cursor: pointer; }
input[type="number"]:focus { border-color: #56564f; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; }
.switch-row small { color: var(--muted); display: block; margin-top: 5px; font-size: 10px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row i { width: 38px; height: 21px; background: #362a3d; border-radius: 20px; position: relative; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #777; border-radius: 50%; transition: .2s; }
.switch-row input:checked + i { background: linear-gradient(90deg, var(--violet), var(--accent)); }
.switch-row input:checked + i::after { transform: translateX(17px); background: #1a1020; }
.save-button { width: 100%; margin-top: 32px; border: 0; border-radius: 6px; padding: 14px; background: #f4e8e2; color: #21131e; font-size: 11px; font-weight: 600; cursor: pointer; }
.overlay { position: fixed; z-index: 4; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .3s; }
.overlay.show { opacity: 1; pointer-events: auto; }

.panel-close { border: 0; background: transparent; color: var(--muted); font-size: 23px; cursor: pointer; line-height: 1; }

.tracking-panel { position: fixed; z-index: 5; top: 50%; left: 50%; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 28px); overflow-y: auto; padding: 28px; border: 1px solid #382940; border-radius: 18px; background: #17111e; box-shadow: 0 28px 100px rgba(0,0,0,.58); opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(.985); pointer-events: none; transition: opacity .22s, transform .22s; }
.tracking-panel.open { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.tracking-header { display: flex; justify-content: space-between; align-items: flex-start; }
.tracking-header h2 { margin: 5px 0 0; font-size: 22px; letter-spacing: -.8px; }
.tracking-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 22px; padding: 4px; border: 1px solid #302438; border-radius: 9px; background: #120d17; }
.tracking-tab { border: 0; border-radius: 6px; padding: 8px 5px; background: transparent; color: #776a79; font-size: 9px; cursor: pointer; }
.tracking-tab:hover { color: #c7b9c9; }
.tracking-tab.active { background: #2b1d38; color: #eadbfa; box-shadow: inset 0 0 0 1px rgba(185,140,255,.08); }
.tracking-category-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 11px; }
.tracking-category-filter > span { margin-right: 4px; color: var(--theme-muted); font-size: 8px; text-transform: uppercase; letter-spacing: 1.2px; }
.tracking-category-filter button { display: flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--theme-muted); font-size: 8px; cursor: pointer; }
.tracking-category-filter button.active { border-color: var(--theme-line); background: var(--theme-surface); color: var(--theme-text); }
.tracking-category-filter i { width: 5px; height: 5px; border-radius: 50%; }
.russe-dot { background: #ff6b5f; }.fac-dot { background: #8f83ff; }.letton-dot { background: #4fc58b; }
.tracking-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 25px 0 27px; }
.tracking-stats > div { padding: 16px; border: 1px solid #302438; border-radius: 10px; background: #1b1422; }
.tracking-stats strong { display: block; color: #f5eae6; font-family: "DM Mono", monospace; font-size: 21px; font-weight: 400; }
.tracking-stats span { display: block; margin-top: 5px; color: #796c7c; font-size: 9px; }
.study-breakdown { display: grid; gap: 7px; margin: -13px 0 24px; }
.breakdown-row { display: grid; grid-template-columns: 48px 1fr 55px; align-items: center; gap: 9px; color: var(--theme-muted); font-size: 8px; }
.breakdown-track { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.breakdown-fill { height: 100%; min-width: 0; border-radius: inherit; }
.breakdown-row[data-category="russe"] .breakdown-fill { background: linear-gradient(90deg, #e55150, #ff8c62); }
.breakdown-row[data-category="fac"] .breakdown-fill { background: linear-gradient(90deg, #7064df, #a995ff); }
.breakdown-row[data-category="letton"] .breakdown-fill { background: linear-gradient(90deg, #2d9365, #63d99f); }
.breakdown-row strong { color: var(--theme-text); text-align: right; font: 400 8px "DM Mono", monospace; }
.calendar-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 11px; color: #8f8192; font-size: 9px; }
.period-navigation { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.period-navigation strong { min-width: 86px; color: #c0b2c2; text-align: center; font-size: 9px; font-weight: 500; }
.period-navigation button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid #34263c; border-radius: 6px; background: #1c1423; color: #9b899f; font-size: 17px; cursor: pointer; }
.period-navigation button:hover { color: var(--text); border-color: #5b3f6d; }
.calendar-scroll { overflow-x: auto; padding: 2px 1px 10px; scrollbar-color: #44324e transparent; }
.calendar-grid { display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column; grid-auto-columns: 11px; gap: 3px; width: max-content; min-width: 100%; }
.calendar-cell, .legend-cell { width: 11px; height: 11px; border-radius: 3px; background: #2a2031; }
.calendar-cell { transition: transform .12s, filter .12s; }
.calendar-cell:hover { transform: scale(1.35); filter: brightness(1.18); }
.calendar-cell.future { opacity: .25; }
.calendar-cell.outside { opacity: .2; }
.calendar-grid[data-view="month"] { grid-template-rows: repeat(7, 19px); grid-auto-columns: 19px; gap: 5px; justify-content: center; }
.calendar-grid[data-view="month"] .calendar-cell { width: 19px; height: 19px; border-radius: 5px; }
.calendar-grid[data-view="week"] { width: 100%; grid-template: 68px / repeat(7, minmax(48px, 1fr)); grid-auto-flow: row; gap: 6px; }
.calendar-grid[data-view="day"] { width: 100%; grid-template: repeat(2, 50px) / repeat(12, minmax(35px, 1fr)); grid-auto-flow: row; gap: 5px; }
.calendar-grid[data-view="week"] .calendar-cell, .calendar-grid[data-view="day"] .calendar-cell { width: auto; height: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 7px; }
.calendar-cell b { color: rgba(255,255,255,.72); font-size: 9px; font-weight: 500; text-transform: uppercase; }
.calendar-cell span { color: rgba(255,255,255,.48); font-size: 8px; }
.level-0 { background: #2a2031; }
.level-1 { background: #513665; }
.level-2 { background: #80519b; }
.level-3 { background: #ba657e; }
.level-4 { background: #e77d55; box-shadow: 0 0 7px rgba(231,125,85,.18); }
.calendar-footer { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 7px; color: #706372; font-size: 8px; }
.calendar-footer span:first-child { margin-right: 3px; }
.calendar-footer span:last-child { margin-left: 3px; }
.tracking-note { margin: 18px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: #716473; font-size: 9px; }

@media (max-width: 550px) {
  .topbar { height: 68px; }
  .timer-section { padding-top: 25px; }
  .timer-wrap { width: min(88vw, 340px); margin: 0 0 36px; }
  .hint { display: none; }
  .settings { padding: 25px; }
  .tracking-trigger { width: 38px; padding: 0; justify-content: center; }
  .tracking-trigger > span { display: none; }
  .tracking-panel { padding: 21px; }
  .tracking-stats { margin: 20px 0 23px; }
  .calendar-grid[data-view="week"] { min-width: 430px; }
  .calendar-grid[data-view="day"] { min-width: 610px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }

/* Ambiances dynamiques : repos, concentration et pause */
body {
  --theme-bg: #111326;
  --theme-bg-deep: #0a0c19;
  --theme-surface: rgba(25, 25, 48, .82);
  --theme-surface-solid: #19192f;
  --theme-line: rgba(171, 148, 255, .18);
  --theme-text: #fbf8ff;
  --theme-muted: #9895b4;
  --theme-a: #a98bff;
  --theme-b: #ff8ea1;
  --theme-c: #ffbd72;
  --theme-glow-a: rgba(145, 112, 255, .22);
  --theme-glow-b: rgba(255, 120, 147, .13);
  --action-a: #b79aff;
  --action-b: #ff8ea1;
  --action-ink: #171124;
  background:
    radial-gradient(circle at 19% 20%, var(--theme-glow-a) 0, transparent 30%),
    radial-gradient(circle at 82% 76%, var(--theme-glow-b) 0, transparent 31%),
    linear-gradient(145deg, var(--theme-bg), var(--theme-bg-deep));
  transition: color .6s ease, background-color .6s ease;
  overflow-x: hidden;
}

body[data-state="focus"] {
  --theme-bg: #1c1119;
  --theme-bg-deep: #0e0b13;
  --theme-surface: rgba(40, 22, 30, .82);
  --theme-surface-solid: #28161f;
  --theme-line: rgba(255, 133, 91, .19);
  --theme-muted: #b09a9f;
  --theme-a: #ff765c;
  --theme-b: #ff4f8b;
  --theme-c: #ffd166;
  --theme-glow-a: rgba(255, 91, 85, .23);
  --theme-glow-b: rgba(255, 181, 70, .13);
  --action-a: #ffd166;
  --action-b: #ff795d;
  --action-ink: #321313;
}

body[data-state="break"] {
  --theme-bg: #0b1b22;
  --theme-bg-deep: #080e19;
  --theme-surface: rgba(14, 37, 46, .82);
  --theme-surface-solid: #10252d;
  --theme-line: rgba(75, 223, 202, .18);
  --theme-muted: #88a9ae;
  --theme-a: #55e6c1;
  --theme-b: #42bff5;
  --theme-c: #9b7bff;
  --theme-glow-a: rgba(44, 219, 185, .2);
  --theme-glow-b: rgba(80, 145, 255, .14);
  --action-a: #59e5c3;
  --action-b: #4bbdf2;
  --action-ink: #082027;
}

body::before, body::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 330px;
  height: 330px;
  border-radius: 44% 56% 63% 37% / 49% 42% 58% 51%;
  filter: blur(55px);
  opacity: .28;
  pointer-events: none;
  transition: background .7s ease, transform 1.1s ease;
}
body::before { top: -190px; left: -90px; background: var(--theme-a); transform: rotate(-12deg); }
body::after { right: -130px; bottom: -210px; background: var(--theme-b); transform: rotate(28deg); }
body[data-state="focus"]::before { transform: rotate(8deg) scale(1.12); }
body[data-state="break"]::after { transform: rotate(5deg) scale(1.14); }

.app { position: relative; z-index: 1; }
.topbar { border-color: var(--theme-line); background: rgba(8, 9, 20, .16); backdrop-filter: blur(12px); }
.brand span, .eyebrow { color: var(--theme-a); transition: color .45s; }
.icon-button { color: var(--theme-muted); border: 1px solid transparent; transition: color .35s, background .35s, border-color .35s, box-shadow .35s; }
.icon-button:hover { color: var(--theme-a); border-color: color-mix(in srgb, var(--theme-a) 28%, transparent); background: color-mix(in srgb, var(--theme-surface-solid) 82%, var(--theme-a)); }
.secondary-control {
  --control-color: var(--theme-a);
  color: var(--control-color);
  border: 1px solid color-mix(in srgb, var(--control-color) 35%, transparent);
  background: color-mix(in srgb, var(--theme-surface-solid) 82%, var(--control-color));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--control-color) 5%, transparent), 0 8px 24px color-mix(in srgb, var(--control-color) 9%, transparent);
  transition: color .4s, background .4s, border-color .4s, box-shadow .4s, transform .15s;
}
#skipButton { --control-color: var(--theme-b); }
.secondary-control:hover {
  color: var(--theme-text);
  border-color: color-mix(in srgb, var(--control-color) 62%, transparent);
  background: color-mix(in srgb, var(--theme-surface-solid) 65%, var(--control-color));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--control-color) 10%, transparent), 0 10px 30px color-mix(in srgb, var(--control-color) 18%, transparent);
  transform: translateY(-1px);
}
.secondary-control:active { transform: translateY(0) scale(.95); }
.tracking-trigger { border-color: var(--theme-line); background: var(--theme-surface); color: var(--theme-muted); transition: all .35s ease; }
.tracking-trigger:hover, .tracking-trigger.active { color: var(--theme-text); border-color: color-mix(in srgb, var(--theme-a) 52%, transparent); background: color-mix(in srgb, var(--theme-surface-solid) 86%, var(--theme-a)); }
.tracking-trigger svg { stroke: var(--theme-a); transition: stroke .4s; }

.timer-wrap::before {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 35%, color-mix(in srgb, var(--theme-a) 12%, transparent), transparent 67%);
  box-shadow: inset 0 0 70px color-mix(in srgb, var(--theme-b) 5%, transparent), 0 20px 80px rgba(0,0,0,.2);
  transition: background .6s, box-shadow .6s;
}
.track { stroke: var(--theme-line); transition: stroke .5s; }
.remaining-mask { stroke: color-mix(in srgb, var(--theme-bg) 80%, #25243a); transition: stroke-dashoffset .5s linear, stroke .5s; }
body[data-state="idle"] .focus-segment, body[data-state="idle"] .break-segment { opacity: .72; }
body[data-state="focus"] .focus-segment { opacity: 1; filter: drop-shadow(0 0 10px rgba(255,107,83,.56)); }
body[data-state="focus"] .break-segment { opacity: .22; }
body[data-state="break"] .break-segment { opacity: 1; filter: drop-shadow(0 0 10px rgba(69,211,205,.56)); }
body[data-state="break"] .focus-segment { opacity: .2; }
.status { display: inline-flex; padding: 6px 10px; border: 1px solid color-mix(in srgb, var(--theme-a) 24%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--theme-a) 9%, transparent); color: var(--theme-a); transition: color .45s, background .45s, border-color .45s; }
#timer { color: var(--theme-text); text-shadow: 0 8px 45px color-mix(in srgb, var(--theme-a) 12%, transparent); }
.session, .hint { color: var(--theme-muted); transition: color .45s; }
.primary-control { background: linear-gradient(135deg, var(--action-a), var(--action-b)); color: var(--action-ink); box-shadow: 0 9px 35px color-mix(in srgb, var(--theme-a) 18%, transparent); transition: transform .15s, box-shadow .3s, background .5s; }
.primary-control:hover { box-shadow: 0 0 0 7px color-mix(in srgb, var(--theme-a) 12%, transparent), 0 12px 42px color-mix(in srgb, var(--theme-a) 22%, transparent); }
kbd { border-color: var(--theme-line); color: var(--theme-muted); background: var(--theme-surface); }

.settings, .tracking-panel { border-color: var(--theme-line); background: var(--theme-surface-solid); }
.switch-row input:checked + i { background: linear-gradient(135deg, var(--theme-a), var(--theme-b)); }
.save-button { background: linear-gradient(135deg, var(--theme-text), color-mix(in srgb, var(--theme-text) 82%, var(--theme-a))); }
.tracking-tab.active { background: color-mix(in srgb, var(--theme-surface-solid) 72%, var(--theme-a)); color: var(--theme-text); }
.tracking-stats > div { border-color: var(--theme-line); background: color-mix(in srgb, var(--theme-surface-solid) 92%, #000); }
.period-navigation button { border-color: color-mix(in srgb, var(--theme-a) 28%, var(--theme-line)); background: color-mix(in srgb, var(--theme-surface-solid) 86%, var(--theme-a)); color: var(--theme-a); transition: color .35s, border-color .35s, background .35s; }
.period-navigation button:hover { color: var(--theme-text); border-color: color-mix(in srgb, var(--theme-a) 58%, transparent); background: color-mix(in srgb, var(--theme-surface-solid) 70%, var(--theme-a)); }
.panel-close { color: var(--theme-muted); transition: color .3s, transform .2s; }
.panel-close:hover { color: var(--theme-a); transform: rotate(6deg) scale(1.08); }

@media (max-width: 780px) {
  .timer-stage { flex-direction: column; }
  .study-categories { position: static; order: -1; display: flex; width: auto; transform: none; margin-bottom: 18px; }
  .category-title { display: none; }
  .study-category { width: 104px; }
  .study-category:hover { transform: translateY(-1px); }
}
/* Lisibilité générale renforcée */
.brand { font-size: 21px; }
.tracking-trigger { font-size: 11.5px; }
.status { font-size: 10.5px; }
.session { font-size: 12.5px; }
.hint { font-size: 11.5px; }
.category-title, .eyebrow { font-size: 10px; }
.study-category { font-size: 12px; }
.settings h2 { font-size: 27px; }
legend { font-size: 14px; }
legend span, .switch-row small { font-size: 11px; }
fieldset label, .switch-row { font-size: 13px; }
.save-button { font-size: 12px; }
.tracking-header h2 { font-size: 24px; }
.tracking-tab { font-size: 11px; }
.tracking-category-filter > span, .tracking-category-filter button { font-size: 10px; }
.tracking-stats span { font-size: 11px; }
.calendar-heading, .period-navigation strong { font-size: 10.5px; }
.calendar-footer, .tracking-note, .breakdown-row, .breakdown-row strong { font-size: 9.5px; }

/* Graisse uniforme pour une lecture plus nette */
body, body * { font-weight: 600 !important; }

/* Affiche Latvijas PSR — thème soviétique letton */
.latvian-poster-copy { display: none; }
body[data-theme="latvian-ssr"] {
  --theme-bg: #111719;
  --theme-bg-deep: #090d0e;
  --theme-surface: rgba(15, 21, 23, .94);
  --theme-surface-solid: #111719;
  --theme-line: rgba(232, 210, 162, .42);
  --theme-text: #f0ddb3;
  --theme-muted: #b9a783;
  --theme-a: #d93425;
  --theme-b: #d49b32;
  --theme-c: #f0ddb3;
  --theme-glow-a: transparent;
  --theme-glow-b: transparent;
  --action-a: #d93425;
  --action-b: #d93425;
  --action-ink: #f2dfb5;
  background:
    linear-gradient(90deg, rgba(5, 8, 9, .16), rgba(5, 8, 9, .06) 65%, rgba(5, 8, 9, .1)),
    url("assets/latvian-ssr-poster-v3.png") center / cover fixed no-repeat;
}
body[data-theme="latvian-ssr"][data-state="focus"] {
  --theme-surface: rgba(24, 19, 17, .94);
  --theme-surface-solid: #181311;
  --theme-line: rgba(239, 214, 164, .48);
  --theme-muted: #c1aa7c;
  --theme-a: #e13b28;
  --theme-b: #d9a035;
  --theme-c: #f0ddb3;
  --action-a: #df3826;
  --action-b: #df3826;
}
body[data-theme="latvian-ssr"][data-state="break"] {
  --theme-surface: rgba(16, 23, 26, .95);
  --theme-surface-solid: #10171a;
  --theme-line: rgba(232, 210, 162, .45);
  --theme-muted: #b6aa90;
  --theme-a: #e7c777;
  --theme-b: #c28a2c;
  --theme-c: #cf3827;
  --action-a: #e7c777;
  --action-b: #e7c777;
  --action-ink: #111719;
}
body[data-theme="latvian-ssr"]::before, body[data-theme="latvian-ssr"]::after { opacity: 0; }
body[data-theme="latvian-ssr"] .topbar { background: #111719; border-bottom: 3px solid #d93425; box-shadow: none; backdrop-filter: none; }
body[data-theme="latvian-ssr"] .brand { text-transform: uppercase; letter-spacing: .3px; text-shadow: none; }
body[data-theme="latvian-ssr"] .brand::after { content: "  ·  LATVIJAS PSR"; color: var(--theme-a); font: 600 8px "DM Mono", monospace; letter-spacing: 1.5px; }
body[data-theme="latvian-ssr"] .latvian-poster-copy { position: absolute; z-index: 0; left: clamp(25px, 5vw, 72px); top: 105px; display: flex; flex-direction: column; align-items: flex-start; width: 280px; color: #ead6aa; pointer-events: none; text-transform: uppercase; }
body[data-theme="latvian-ssr"] .latvian-poster-copy span { padding: 3px 8px; background: #e2c776; color: #111719; font: 900 9px Arial, sans-serif; letter-spacing: 2.6px; }
body[data-theme="latvian-ssr"] .latvian-poster-copy strong { margin-top: 3px; color: #db3526; font: 900 clamp(42px, 5.6vw, 78px)/.86 Impact, "Arial Black", sans-serif; letter-spacing: -1px; }
body[data-theme="latvian-ssr"] .latvian-poster-copy small { margin-top: 8px; color: #ead6aa; font: 900 9px Arial, sans-serif; letter-spacing: 1.5px; }
body[data-theme="latvian-ssr"] .timer-wrap::before { inset: 7%; border: 2px solid rgba(234, 214, 170, .28); background: rgba(12, 18, 20, .88); box-shadow: none; }
body[data-theme="latvian-ssr"] #focusGradient stop:nth-child(1) { stop-color: #e13a28; }
body[data-theme="latvian-ssr"] #focusGradient stop:nth-child(2) { stop-color: #e13a28; }
body[data-theme="latvian-ssr"] #focusGradient stop:nth-child(3) { stop-color: #e13a28; }
body[data-theme="latvian-ssr"] #breakGradient stop:nth-child(1) { stop-color: #e0c577; }
body[data-theme="latvian-ssr"] #breakGradient stop:nth-child(2) { stop-color: #e0c577; }
body[data-theme="latvian-ssr"] #breakGradient stop:nth-child(3) { stop-color: #e0c577; }
body[data-theme="latvian-ssr"] .track { stroke: rgba(233, 213, 164, .3); }
body[data-theme="latvian-ssr"] .remaining-mask { stroke: #172322; }
body[data-theme="latvian-ssr"] .focus-segment, body[data-theme="latvian-ssr"] .break-segment { filter: none; }
body[data-theme="latvian-ssr"][data-state="focus"] #focusGradient stop:nth-child(1),
body[data-theme="latvian-ssr"][data-state="focus"] #focusGradient stop:nth-child(2),
body[data-theme="latvian-ssr"][data-state="focus"] #focusGradient stop:nth-child(3) { stop-color: #e13a28; }
body[data-theme="latvian-ssr"][data-state="break"] #breakGradient stop:nth-child(1), body[data-theme="latvian-ssr"][data-state="break"] #breakGradient stop:nth-child(2), body[data-theme="latvian-ssr"][data-state="break"] #breakGradient stop:nth-child(3) { stop-color: #eddaa8; }
body[data-theme="latvian-ssr"] .study-category,
body[data-theme="latvian-ssr"] .timer-wrap,
body[data-theme="latvian-ssr"] .flashcards-layout,
body[data-theme="latvian-ssr"] .university-schedule-panel,
body[data-theme="latvian-ssr"] .revision-planner { box-shadow: none; }
body[data-theme="latvian-ssr"] .study-category { border-radius: 0; backdrop-filter: none; }
body[data-theme="latvian-ssr"] .primary-control,
body[data-theme="latvian-ssr"] .secondary-control,
body[data-theme="latvian-ssr"] .status { border-radius: 3px; text-transform: uppercase; }
body[data-theme="latvian-ssr"] .settings,
body[data-theme="latvian-ssr"] .tracking-panel,
body[data-theme="latvian-ssr"] .flashcards-layout,
body[data-theme="latvian-ssr"] .university-schedule-panel,
body[data-theme="latvian-ssr"] .revision-planner { background-image: none; border-color: var(--theme-line); }
body[data-theme="latvian-ssr"] .flashcards-trigger,
body[data-theme="latvian-ssr"] .university-trigger,
body[data-theme="latvian-ssr"] .tracking-trigger,
body[data-theme="latvian-ssr"] .settings,
body[data-theme="latvian-ssr"] .tracking-panel,
body[data-theme="latvian-ssr"] .flashcards-layout,
body[data-theme="latvian-ssr"] .university-category,
body[data-theme="latvian-ssr"] .university-schedule-panel,
body[data-theme="latvian-ssr"] .revision-planner,
body[data-theme="latvian-ssr"] .review-card { border-radius: 0; backdrop-filter: none; box-shadow: none; }
body[data-theme="latvian-ssr"] .primary-control { background: var(--action-a); border: 2px solid #111719; box-shadow: 4px 4px 0 #111719; }
body[data-theme="latvian-ssr"] .primary-control:hover { box-shadow: 2px 2px 0 #111719; transform: translate(2px, 2px); }
body[data-theme="latvian-ssr"] .secondary-control { border-radius: 0; background: var(--theme-surface-solid); box-shadow: 3px 3px 0 rgba(0,0,0,.6); }
body[data-theme="latvian-ssr"] .status { background: var(--theme-a); border: 0; color: #f0ddb3; letter-spacing: 1.7px; }
body[data-theme="latvian-ssr"] .study-category[data-category="russe"] { --category-color: #dc3928; }
body[data-theme="latvian-ssr"] .study-category[data-category="fac"] { --category-color: #d49b32; }
body[data-theme="latvian-ssr"] .study-category[data-category="letton"] { --category-color: #ead6aa; }
@media (max-width: 880px) {
  body[data-theme="latvian-ssr"] .latvian-poster-copy { top: 94px; opacity: .62; }
  body[data-theme="latvian-ssr"] .latvian-poster-copy strong { font-size: 27px; }
  body[data-theme="latvian-ssr"] .brand::after { display: none; }
}
@media (max-width: 620px) {
  body[data-theme="latvian-ssr"] { background-position: 61% center; }
  body[data-theme="latvian-ssr"] .latvian-poster-copy { display: none; }
}
