:root {
  color-scheme: light;
  --ink: #17202a;
  --ink-2: #243443;
  --muted: #5a6573;
  --muted-2: #87939d;
  --line: #ddd9d1;
  --paper: #ece9e1;
  --white: #ffffff;
  --red-dark: #a71e17;
  --red-soft: #f8e8e5;
  --amber: #f2c200;
  --red: #d8281c;
  --blue: #2f6db5;
  --green: #2e8b57;
  --shadow: 0 16px 45px rgba(24, 45, 61, .055);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(216, 40, 28, .24); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #0f1822; color: #ece9e1; padding: 28px 17px 18px; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 10px; }
.brand-mark { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; position: relative; color: #fff; background: var(--red); font-size: 14px; font-weight: 900; letter-spacing: -5px; padding-right: 4px; box-shadow: 0 7px 22px rgba(216, 40, 28, .2); }
.brand-mark span:last-child { color: #fff; }
.brand-mark.small { width: 31px; height: 31px; border-radius: 10px; font-size: 12px; }
.brand-copy { display: flex; flex-direction: column; gap: 4px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.3px; }
.brand-copy small { color: #8d9aa7; font-size: 9px; letter-spacing: 1.45px; font-weight: 700; }
.sidebar-label { margin: 55px 12px 13px; color: #72818e; font-weight: 700; font-size: 9px; letter-spacing: 1.55px; }
.main-nav { display: grid; gap: 6px; }
.nav-item { height: 46px; padding: 0 13px; border-radius: 11px; display: flex; align-items: center; gap: 12px; position: relative; color: #9daab5; text-decoration: none; font-size: 12px; font-weight: 650; transition: background .18s ease, color .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-item.active { background: rgba(216, 40, 28, .18); color: #ffe5e2; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: currentColor; font-size: 20px; line-height: 1; font-weight: 400; }
.timer-nav-icon { font-size: 22px; }
.nav-active-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(216,40,28,.15); }
.sidebar-bottom { margin-top: auto; }
.connection-card { display: flex; align-items: center; gap: 10px; padding: 12px 11px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.035); border-radius: 12px; }
.connection-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(50, 195, 159, .11); }
.connection-icon span { width: 7px; height: 7px; border-radius: 50%; background: #51d3a3; box-shadow: 0 0 0 4px rgba(81,211,163,.1); }
.connection-card strong, .connection-card small { display: block; }
.connection-card strong { font-size: 10px; color: #e4ebee; }
.connection-card small { margin-top: 4px; font-size: 9px; color: #8b98a4; }
.sidebar-footer { display: flex; align-items: center; gap: 7px; padding: 18px 10px 0; color: #84919d; font-size: 9px; }
.mini-mark { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 6px; color: #fff; background: var(--red); font-size: 7px; font-weight: 900; }
.version { margin-left: auto; color: #596876; }

.main-content { min-width: 0; }
.topbar { height: 66px; background: rgba(255,255,255,.84); border-bottom: 1px solid var(--line); padding: 0 clamp(24px, 4vw, 62px); display: flex; justify-content: space-between; align-items: center; }
.breadcrumbs { display: flex; align-items: center; gap: 11px; color: #8895a0; font-size: 11px; }
.breadcrumbs strong { color: #354757; font-weight: 700; }
.crumb-separator { color: #bbc4cb; }
.topbar-right { display: flex; align-items: center; gap: 13px; }
.live-status { display: inline-flex; align-items: center; gap: 8px; color: #627382; font-size: 10px; font-weight: 650; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #b5c0c7; box-shadow: 0 0 0 4px #eef2f3; }
.live-status.connected .live-dot { background: #21ac82; box-shadow: 0 0 0 4px #e2f5ed; }
.live-status.disconnected .live-dot { background: var(--red); box-shadow: 0 0 0 4px #fce9e7; }
.icon-button { width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid #e4eaed; border-radius: 10px; color: #637482; background: #fff; transition: .18s ease; }
.icon-button:hover { border-color: #efc4c0; color: var(--red-dark); background: #fff5f4; }
.icon-button svg, .display-card-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mobile-brand { display: none; align-items: center; gap: 9px; font-size: 12px; }

.content-wrap { width: min(1440px, 100%); margin: 0 auto; padding: 34px clamp(24px, 4vw, 62px) 22px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 28px; }
.eyebrow, .section-kicker, .panel-kicker { color: #83929c; font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.eyebrow-line { width: 16px; height: 2px; background: var(--red); border-radius: 10px; }
h1 { margin: 0; color: #132332; font-size: clamp(29px, 3vw, 39px); font-weight: 750; letter-spacing: -1.7px; line-height: 1.05; }
.heading-period { color: var(--red); }
.page-heading p { margin: 9px 0 0; color: #7a8995; font-size: 12px; }
.date-chip { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; padding: 9px 12px; border: 1px solid #e6ecee; border-radius: 11px; color: #586b79; background: rgba(255,255,255,.62); font-size: 10px; font-weight: 650; white-space: nowrap; }
.date-icon { color: var(--red); font-size: 17px; }
.date-divider { width: 1px; height: 14px; margin: 0 2px; background: #e0e7ea; }

.mode-section { margin-bottom: 19px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.section-heading h2 { margin: 4px 0 0; color: #273948; font-size: 16px; font-weight: 720; letter-spacing: -.35px; }
.section-note { color: #8c99a2; font-size: 10px; padding-bottom: 2px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.mode-card { min-width: 0; min-height: 133px; text-align: left; padding: 14px 15px 12px; color: inherit; background: rgba(255,255,255,.78); border: 1px solid #e4eaed; border-radius: 14px; box-shadow: 0 2px 8px rgba(23,46,59,.018); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.mode-card:hover { transform: translateY(-2px); border-color: #bddbd7; box-shadow: 0 9px 24px rgba(25,66,69,.06); }
.mode-card.selected { border-color: var(--red); background: #fff8f7; box-shadow: 0 0 0 2px rgba(216,40,28,.08), 0 8px 22px rgba(25,66,69,.045); }
.mode-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mode-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; }
.mode-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sport-icon { background: #f8e8e5; color: var(--red); }
.circuit-icon { background: #e8eef7; color: var(--blue); }
.reaction-icon { background: #fff8da; color: #8a7000; }
.mode-arrow { opacity: 0; color: var(--red); font-size: 15px; transform: translate(-2px,2px); transition: .18s ease; }
.mode-card:hover .mode-arrow, .mode-card.selected .mode-arrow { opacity: 1; transform: none; }
.mode-title, .mode-description, .mode-meta { display: block; }
.mode-title { color: #263948; font-size: 11px; font-weight: 750; letter-spacing: -.1px; }
.mode-description { margin-top: 4px; color: #87939d; font-size: 9px; line-height: 1.45; }
.mode-meta { margin-top: 10px; color: #99a4ac; font-size: 7px; font-weight: 800; letter-spacing: 1px; }
.mode-meta-dot { display: inline-block; width: 4px; height: 4px; margin-right: 5px; vertical-align: 1px; background: var(--red); border-radius: 50%; }

.timer-layout { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.45fr); align-items: stretch; gap: 13px; }
.panel { background: #fff; border: 1px solid #e4eaed; border-radius: 15px; box-shadow: var(--shadow); }
.setup-panel { padding: 18px 18px 14px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 9px; }
.panel-heading h2 { margin: 5px 0 0; color: #203241; font-size: 14px; font-weight: 760; letter-spacing: -.25px; }
.panel-kicker { font-size: 8px; }
.edit-tag { display: flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 7px; color: #6c7c86; background: #f5f8f8; font-size: 8px; white-space: nowrap; }
.edit-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 16px; }
.preset-button { padding: 6px 9px; border: 1px solid #e5ecee; border-radius: 7px; color: #71808a; background: #fff; font-size: 8px; font-weight: 650; transition: .15s ease; }
.preset-button:hover, .preset-button.active { color: var(--red-dark); border-color: #efc4c0; background: #fff5f4; }
.preset-button:disabled, .save-preset-button:disabled, .saved-preset-item button:disabled { opacity: .5; cursor: not-allowed; }
.save-settings { width: 100%; min-height: 36px; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--red); border-radius: 8px; color: #fff; background: var(--red); box-shadow: 0 5px 13px rgba(216,40,28,.16); font-size: 9px; font-weight: 750; transition: background .16s ease, box-shadow .16s ease; }
.save-settings:hover { background: #ad2118; box-shadow: 0 7px 15px rgba(216,40,28,.22); }
.saved-presets { margin: -3px 0 14px; padding: 11px; border: 1px solid #e8eef0; border-radius: 10px; background: #f8fafb; }
.saved-presets-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 8px; }
.saved-presets-heading > div { display: grid; gap: 3px; }
.saved-presets-heading small { color: #9aa6ad; font-size: 7px; }
.save-preset-button { flex: 0 0 auto; padding: 6px 8px; border: 1px solid #efc4c0; border-radius: 7px; color: #a71e17; background: #fff5f4; font-size: 8px; font-weight: 700; transition: background .15s ease, border-color .15s ease; }
.save-preset-button:hover:not(:disabled) { border-color: #df908a; background: #f8e8e5; }
.saved-preset-list { display: grid; gap: 6px; }
.saved-preset-empty { padding: 8px 9px; border: 1px dashed #dce5e8; border-radius: 7px; color: #9aa6ad; font-size: 8px; line-height: 1.45; }
.saved-preset-item { display: flex; align-items: stretch; gap: 5px; min-width: 0; }
.saved-preset-load { flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 7px 9px; text-align: left; border: 1px solid #e4eaed; border-radius: 8px; color: #465b68; background: #fff; transition: border-color .15s ease, background .15s ease; }
.saved-preset-load:hover:not(:disabled) { border-color: #efc4c0; background: #fff8f7; }
.saved-preset-copy { display: grid; gap: 3px; min-width: 0; }
.saved-preset-copy strong { overflow: hidden; color: #344b59; font-size: 8px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.saved-preset-copy small { color: #98a5ac; font-size: 7px; }
.saved-preset-load-mark { flex: 0 0 auto; color: #a71e17; font-size: 12px; }
.saved-preset-actions { display: flex; gap: 4px; }
.saved-preset-actions button { width: 29px; padding: 0; border: 1px solid #e5ebed; border-radius: 8px; color: #86949d; background: #fff; font-size: 11px; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.saved-preset-actions button:hover:not(:disabled) { color: #a71e17; border-color: #efc4c0; background: #fff5f4; }
.saved-preset-actions .delete-saved-preset:hover:not(:disabled) { color: #b8574e; border-color: #e8c3bf; background: #fff8f7; }
.preset-dialog { width: min(390px, calc(100vw - 28px)); padding: 0; overflow: hidden; border: 1px solid #e2e9eb; border-radius: 16px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px rgba(15, 36, 48, .2); }
.preset-dialog::backdrop { background: rgba(14, 28, 40, .48); backdrop-filter: blur(3px); }
.preset-dialog form { padding: 21px; }
.preset-dialog h2 { margin: 6px 0 0; color: #203241; font-size: 17px; letter-spacing: -.35px; }
.preset-dialog p { margin: 7px 0 17px; color: #87959d; font-size: 10px; line-height: 1.5; }
.preset-dialog .field { display: grid; gap: 0; }
.preset-dialog .field input { height: 39px; }
.preset-dialog-actions { display: flex; justify-content: end; gap: 7px; margin-top: 18px; }
.preset-dialog-actions button { min-height: 34px; padding: 0 12px; border-radius: 8px; font-size: 9px; font-weight: 720; }
.preset-dialog-cancel { border: 1px solid #e3e9eb; color: #6f7d87; background: #fff; }
.preset-dialog-submit { border: 1px solid var(--red); color: #fff; background: var(--red); box-shadow: 0 5px 13px rgba(216,40,28,.17); }
.preset-dialog-actions button:hover { filter: brightness(.97); }
.sound-dialog { width: min(470px, calc(100vw - 28px)); max-height: min(92vh, 760px); overflow-y: auto; }
.sound-dialog form { padding: 22px; }
.sound-settings-list { display: grid; gap: 10px; }
.sound-toggle { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 53px; padding: 10px 12px; border: 1px solid #e7edef; border-radius: 10px; background: #fbfcfc; cursor: pointer; }
.sound-toggle > span { display: grid; gap: 4px; min-width: 0; }
.sound-toggle strong { color: #3a4d59; font-size: 10px; font-weight: 720; }
.sound-toggle small { color: #8d9ba3; font-size: 8px; line-height: 1.35; }
.sound-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sound-toggle i { position: relative; flex: 0 0 auto; width: 34px; height: 19px; border-radius: 20px; background: #d9e1e4; transition: background .16s ease; }
.sound-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(20,38,50,.16); transition: transform .16s ease; }
.sound-toggle input:checked + i { background: #d8281c; }
.sound-toggle input:checked + i::after { transform: translateX(15px); }
.sound-toggle input:focus-visible + i { outline: 3px solid rgba(216,40,28,.25); outline-offset: 2px; }
.sound-field { display: grid; gap: 5px; padding: 3px 2px; }
.sound-field .field-label { margin: 0; }
.sound-field output { color: #a71e17; font-variant-numeric: tabular-nums; }
.sound-field input[type="range"] { width: 100%; height: 22px; accent-color: var(--red); }
.sound-field select { width: 100%; min-height: 37px; padding: 0 10px; border: 1px solid #e5ebed; border-radius: 8px; color: #344955; background: #fbfcfc; font-size: 10px; }
.local-sound-section { display: grid; gap: 9px; margin-top: 3px; padding: 12px; border: 1px solid #e2ddd4; border-radius: 11px; background: #f8f6f1; }
.sound-section-title { color: #6f7b85; font-size: 7px; font-weight: 800; letter-spacing: 1.15px; }
.local-sound-section .sound-toggle { background: #fff; }
.sound-note { margin: 11px 0 0 !important; padding-left: 2px; font-size: 8px !important; }
.sound-preview-section { display: grid; gap: 8px; margin: 3px 0; padding: 12px; border: 1px solid #e5ded2; border-radius: 11px; background: #f7f5ef; }
.sound-preview-grid { display: grid; grid-template-columns: 1fr; gap: 7px; }
.sound-preview-button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; border: 1px solid #e4dfd5; border-radius: 9px; color: var(--ink); background: #fff; text-align: left; cursor: pointer; touch-action: manipulation; }
.sound-preview-button:hover { border-color: #d8281c; background: #fffaf8; }
.sound-preview-button:active { transform: scale(.99); }
.sound-preview-button:focus-visible { outline: 3px solid rgba(216,40,28,.22); outline-offset: 2px; }
.sound-preview-button > span:last-child { display: grid; gap: 3px; }
.sound-preview-button strong { color: #243443; font-size: 10px; font-weight: 780; }
.sound-preview-button small { color: #77838a; font-size: 8px; line-height: 1.3; }
.sound-preview-icon { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #fff; background: var(--red); font-size: 15px; font-weight: 850; }
.sound-preview-note { margin: 0 !important; color: #748089; font-size: 8px !important; line-height: 1.4; }
.sound-dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.sound-dialog-actions button { min-height: 34px; padding: 0 11px; border-radius: 8px; font-size: 8px; font-weight: 720; }
.sound-dialog-actions button:hover { filter: brightness(.97); }
#settingsFields { display: grid; gap: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field-label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: #788792; font-size: 9px; font-weight: 650; }
.field-label small { color: #a2adb5; font-size: 8px; font-weight: 500; }
.input-wrap { position: relative; }
.field input, .field textarea { width: 100%; height: 35px; padding: 0 10px; color: #263947; background: #fbfcfc; border: 1px solid #e5ebed; border-radius: 8px; font-size: 11px; font-weight: 650; transition: border-color .16s ease, box-shadow .16s ease; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(216,40,28,.1); }
.field input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button, .field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field textarea { min-height: 74px; padding: 9px 10px; resize: vertical; line-height: 1.5; font-size: 10px; }
.time-input { display: grid; grid-template-columns: 1fr 12px 1fr; align-items: center; gap: 4px; }
.time-input input { text-align: center; padding: 0 5px; }
.time-separator { color: #a7b2b9; text-align: center; font-size: 15px; font-weight: 500; }
.field-suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #a0abb2; font-size: 8px; pointer-events: none; }
.panel-note { display: flex; align-items: start; gap: 7px; margin-top: 17px; padding-top: 12px; border-top: 1px solid #eef1f2; color: #8d9aa3; font-size: 8px; line-height: 1.5; }
.note-icon { display: grid; place-items: center; flex: 0 0 auto; width: 13px; height: 13px; border: 1px solid #aab8bf; border-radius: 50%; font-size: 8px; font-weight: 700; }
.backup-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px; border: 1px solid #e7ecee; border-radius: 10px; background: #f8fafb; }
.backup-action > span { display: grid; gap: 3px; min-width: 0; }
.backup-action strong { color: #52636e; font-size: 9px; font-weight: 720; }
.backup-action small { color: #89969e; font-size: 8px; }
.backup-download { flex: 0 0 auto; min-width: 86px; min-height: 44px; padding: 0 12px; border: 1px solid #cfd9dc; border-radius: 8px; color: #344b59; background: #fff; font-size: 9px; font-weight: 750; touch-action: manipulation; }
.backup-download:hover { border-color: #aebdc1; background: #f1f5f5; }

.clock-panel { overflow: hidden; position: relative; padding: 18px 21px 13px; background: linear-gradient(145deg, #fff 0%, #f4f2ec 100%); }
.clock-panel::before { content: ""; position: absolute; width: 280px; height: 280px; top: -175px; right: -145px; border-radius: 50%; border: 1px solid rgba(216,40,28,.07); box-shadow: 0 0 0 22px rgba(216,40,28,.02), 0 0 0 44px rgba(216,40,28,.014); pointer-events: none; }
.clock-panel-head { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; z-index: 1; }
.current-session { display: flex; align-items: center; gap: 9px; }
.session-symbol { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #a71e17; background: #f8e8e5; font-size: 19px; }
.current-session small, .current-session strong { display: block; }
.current-session small { margin-bottom: 3px; color: #9aa6ac; font-size: 7px; font-weight: 800; letter-spacing: 1px; }
.current-session strong { color: #304351; font-size: 10px; font-weight: 750; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; color: #73818a; background: #f1f4f5; font-size: 7px; font-weight: 800; letter-spacing: .65px; }
.state-dot { width: 5px; height: 5px; border-radius: 50%; background: #aab5ba; }
.state-running { color: #267244; background: #e8f7f1; }
.state-running .state-dot { background: #15aa7d; box-shadow: 0 0 0 3px rgba(21,170,125,.12); animation: pulse 1.4s infinite; }
.state-paused { color: #9a6b20; background: #fff6e5; }
.state-paused .state-dot { background: #e2a53c; }
.state-finished { color: #667580; background: #eef2f4; }
.state-finished .state-dot { background: #718491; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(21,170,125,.04); } }
.clock-main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 163px; padding: 19px 0 12px; z-index: 1; }
.phase-label { min-height: 17px; color: #91a0a8; font-size: 9px; font-weight: 750; letter-spacing: 1.1px; text-transform: uppercase; }
.time-display { color: #152838; font-size: clamp(57px, 7.4vw, 88px); font-variant-numeric: tabular-nums; font-weight: 760; line-height: .98; letter-spacing: -5px; transition: color .2s ease, transform .2s ease; }
.clock-panel.phase-work .phase-label { color: var(--red); }
.clock-panel.phase-rest .phase-label { color: #8a7000; }
.clock-panel.phase-transition .phase-label { color: var(--blue); }
.clock-panel.phase-signal .phase-label { color: #d8281c; }
.clock-panel.phase-signal .time-display { color: #d8281c; transform: scale(1.02); }
.clock-panel.phase-finished .time-display { color: var(--green); }
.clock-subline { min-height: 15px; margin-top: 9px; color: #98a4ab; font-size: 9px; }
.progress-track { height: 4px; overflow: hidden; background: #edf1f2; border-radius: 20px; }
.progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d8281c, #f06a5f); transition: width .2s linear; }
.phase-rest .progress-fill { background: linear-gradient(90deg, #d2a900, #f2c200); }
.phase-transition .progress-fill { background: linear-gradient(90deg, #2f6db5, #7da8dd); }
.clock-details { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 2vw, 26px); min-height: 62px; }
.detail-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.detail-icon { display: grid; place-items: center; flex: 0 0 auto; width: 23px; height: 23px; color: #a71e17; background: #f8e8e5; border-radius: 7px; font-size: 8px; font-weight: 850; }
.next-detail { color: #7b8dbf; background: #f0f3fa; font-size: 13px; }
.result-detail { color: #bd812c; background: #fff7e9; font-size: 8px; }
.detail-item small, .detail-item strong { display: block; white-space: nowrap; }
.detail-item small { margin-bottom: 3px; color: #a0abb1; font-size: 6px; font-weight: 800; letter-spacing: .9px; }
.detail-item strong { color: #40525e; font-size: 9px; font-weight: 720; }
.detail-item strong em { color: #9ba7ae; font-style: normal; font-weight: 500; }
.detail-divider { width: 1px; height: 26px; background: #e9eef0; }
.reaction-divider, .reaction-summary { display: none; }
.mode-reaction .reaction-divider, .mode-reaction .reaction-summary { display: flex; }
.reaction-action { margin: 0 0 11px; text-align: center; }
.reaction-button { width: min(100%, 360px); min-height: 49px; border: 0; border-radius: 12px; display: inline-flex; justify-content: center; align-items: center; gap: 10px; color: #fff; background: #173548; font-weight: 750; box-shadow: 0 6px 16px rgba(18,49,66,.12); transition: transform .12s ease, background .15s ease; }
.reaction-button:not(:disabled) { color: #fff; background: var(--red); animation: reaction-ready .65s infinite alternate; }
.reaction-button:active:not(:disabled) { transform: scale(.98); }
.reaction-button-mark { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.reaction-button:not(:disabled) .reaction-button-mark { background: #377b36; border-color: #377b36; box-shadow: 0 0 0 4px rgba(55,123,54,.15); }
.reaction-action > small { display: block; margin-top: 7px; color: #93a0a7; font-size: 8px; }
@keyframes reaction-ready { to { box-shadow: 0 0 0 5px rgba(216,40,28,.18), 0 7px 19px rgba(18,49,66,.11); } }
.control-row { display: grid; grid-template-columns: minmax(95px, .85fr) minmax(150px, 1.5fr) minmax(95px, .85fr); gap: 8px; }
.control-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; font-size: 9px; font-weight: 750; transition: transform .12s ease, background .16s ease, box-shadow .16s ease; }
.control-button:active { transform: scale(.985); }
.control-button:disabled { opacity: .52; cursor: not-allowed; }
.control-button.secondary { color: #6a7984; background: #fff; border: 1px solid #e5ebee; }
.control-button.secondary:hover:not(:disabled) { border-color: #c9d9db; background: #f8fbfb; }
.control-button.primary { color: #fff; background: var(--red); border: 1px solid var(--red); box-shadow: 0 6px 14px rgba(216,40,28,.18); }
.control-button.primary:hover:not(:disabled) { background: #ad2118; box-shadow: 0 8px 16px rgba(216,40,28,.22); }
.control-symbol { font-size: 12px; font-weight: 500; }
.clock-foot { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 11px; color: #99a4aa; font-size: 7px; }
.clock-foot > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.foot-led { width: 5px; height: 5px; border-radius: 50%; background: #3fb69c; }

.bottom-strip { display: grid; grid-template-columns: 1fr auto; gap: 13px; margin-top: 13px; }
.tip-card, .display-card { display: flex; align-items: center; min-height: 59px; border-radius: 12px; border: 1px solid #e4eaed; background: rgba(255,255,255,.74); }
.tip-card { gap: 11px; padding: 10px 14px; }
.tip-mark { display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; border-radius: 9px; color: #a71e17; background: #f8e8e5; font-size: 13px; }
.tip-card strong, .tip-card small, .display-card strong, .display-card small { display: block; }
.tip-card strong, .display-card strong { color: #52636d; font-size: 9px; font-weight: 730; }
.tip-card small, .display-card small { margin-top: 4px; color: #98a4ab; font-size: 8px; }
.display-card { gap: 9px; padding: 9px 10px; min-width: 235px; }
.display-card-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #6d8191; background: #f0f4f5; }
.display-card button { margin-left: auto; width: 23px; height: 23px; border: 0; border-radius: 7px; color: #778892; background: #f4f7f8; font-size: 12px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 17px; color: #a2adb3; font-size: 8px; }
.footer-dot { padding: 0 3px; color: #c0c9cd; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 100; transform: translate(-50%, 14px); opacity: 0; pointer-events: none; padding: 10px 15px; color: #fff; background: #152b39; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 10px; transition: .22s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* TV layout: no settings or controls, just a clean full-screen display. */
body.tv-mode { overflow: hidden; background: #0f1822; color: #ece9e1; }
body.tv-mode .app-shell { display: block; min-height: 100vh; }
body.tv-mode .sidebar, body.tv-mode .topbar, body.tv-mode .mode-section, body.tv-mode .setup-panel, body.tv-mode .bottom-strip, body.tv-mode .page-footer, body.tv-mode .date-chip { display: none !important; }
body.tv-mode .content-wrap { width: 100%; max-width: none; height: 100vh; padding: 38px 5vw 28px; display: flex; flex-direction: column; justify-content: center; }
body.tv-mode .page-heading { margin: 0 0 20px; align-items: center; }
body.tv-mode .eyebrow { color: #82939d; }
body.tv-mode h1 { color: #f1f6f7; font-size: clamp(26px, 3vw, 42px); }
body.tv-mode .page-heading p { color: #9eacb4; font-size: clamp(12px, 1.1vw, 16px); }
body.tv-mode .timer-layout { display: block; flex: 1; min-height: 0; }
body.tv-mode .clock-panel { width: 100%; height: 100%; min-height: 0; padding: 28px clamp(24px, 5vw, 90px) 22px; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 50% 43%, #243443 0, #16222e 38%, #0f1822 82%); border: 1px solid rgba(236,233,225,.13); border-radius: 24px; box-shadow: 0 28px 80px rgba(0,0,0,.18); }
body.tv-mode .clock-panel::before { top: -280px; right: -190px; width: 590px; height: 590px; border-color: rgba(236,233,225,.065); box-shadow: 0 0 0 38px rgba(236,233,225,.018), 0 0 0 78px rgba(236,233,225,.013); }
body.tv-mode .clock-panel-head { position: absolute; top: 28px; left: clamp(24px, 5vw, 90px); right: clamp(24px, 5vw, 90px); }
body.tv-mode .session-symbol { width: 42px; height: 42px; color: #ffaaa3; background: rgba(216,40,28,.15); font-size: 25px; }
body.tv-mode .current-session small { color: #89a0a9; font-size: 9px; }
body.tv-mode .current-session strong { color: #e8f0f1; font-size: 15px; }
body.tv-mode .state-pill { color: #aebdc2; background: rgba(255,255,255,.07); font-size: 9px; }
body.tv-mode .state-running { color: #b8f1d9; background: rgba(22,170,125,.14); }
body.tv-mode .state-paused { color: #f4cf8b; background: rgba(226,165,60,.13); }
body.tv-mode .clock-main { min-height: 0; padding: 0; flex: 1; }
body.tv-mode .phase-label {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: clamp(64px, 8vh, 124px);
  padding: 12px 24px;
  border: 2px solid rgba(255,255,255,.12);
  border-radius: clamp(12px, 1.25vw, 22px);
  color: #f5f8f8;
  background: #33495a;
  font-size: clamp(30px, 3.2vw, 58px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: .055em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 2px 10px rgba(0,0,0,.22);
  box-shadow: 0 12px 35px rgba(0,0,0,.16);
}
body.tv-mode .time-display { color: #f5f8f8; font-size: clamp(120px, 18vw, 520px); letter-spacing: -.065em; text-shadow: 0 9px 50px rgba(0,0,0,.14); }
body.tv-mode .clock-panel.phase-work .phase-label,
body.tv-mode .clock-panel.phase-signal .phase-label { color: #fff; background: #d8281c; border-color: #ff756a; }
body.tv-mode .clock-panel.phase-rest .phase-label,
body.tv-mode .clock-panel.phase-prepare .phase-label { color: #17242d; background: #f2c200; border-color: #ffe36a; text-shadow: none; }
body.tv-mode .clock-panel.phase-transition .phase-label { color: #fff; background: #286ab4; border-color: #8db9ed; }
body.tv-mode .clock-panel.phase-waiting .phase-label { color: #fff; background: #574da1; border-color: #a9a0ff; }
body.tv-mode .clock-panel.phase-finished .phase-label { color: #fff; background: #18764f; border-color: #70d2a5; }
body.tv-mode .clock-panel.phase-signal .time-display { color: #ffaaa3; }
body.tv-mode .clock-subline { margin-top: 20px; color: #91a6ae; font-size: clamp(12px, 1.15vw, 16px); }
body.tv-mode .progress-track { height: clamp(22px, 3vh, 42px); margin-top: 12px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.12); }
body.tv-mode .clock-panel.phase-work .progress-track { background: rgba(216,40,28,.25); }
body.tv-mode .clock-panel.phase-rest .progress-track,
body.tv-mode .clock-panel.phase-prepare .progress-track { background: rgba(242,194,0,.25); }
body.tv-mode .clock-panel.phase-transition .progress-track { background: rgba(47,109,181,.3); }
body.tv-mode .clock-details { min-height: 83px; gap: clamp(26px, 5vw, 72px); }
body.tv-mode .detail-icon { width: 36px; height: 36px; border-radius: 11px; color: #ffaaa3; background: rgba(216,40,28,.14); font-size: 11px; }
body.tv-mode .next-detail { color: #8db9ed; background: rgba(47,109,181,.18); font-size: 20px; }
body.tv-mode .detail-item small { color: #8da1a8; font-size: 8px; letter-spacing: 1.5px; }
body.tv-mode .detail-item strong { color: #e1e9ea; font-size: 15px; }
body.tv-mode .detail-item strong em { color: #8fa1a8; }
body.tv-mode .detail-divider { height: 34px; background: rgba(255,255,255,.12); }
body.tv-mode .reaction-summary { display: flex; }
body.tv-mode .clock-foot { margin-top: 14px; color: #8499a1; font-size: 9px; }
body.tv-mode .tv-audio-status:not([hidden]) { display: inline-flex; align-items: center; gap: 7px; color: #c6d1d4; font-size: 9px; white-space: nowrap; }
body.tv-mode .tv-audio-status::before { content: ""; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #d5a63b; box-shadow: 0 0 0 3px rgba(213,166,59,.15); }
body.tv-mode .tv-audio-status[data-state="running"]::before { background: #41c58a; box-shadow: 0 0 0 3px rgba(65,197,138,.15); }
body.tv-mode .tv-audio-status[data-state="blocked"]::before { background: #e64b42; box-shadow: 0 0 0 3px rgba(230,75,66,.15); }
body.tv-mode .foot-led { background: #67b980; }
body.tv-mode .clock-message { color: #91a6ae; }

.mobile-connect-card { display: none; }
.mobile-connect-card[hidden] { display: none !important; }
body.tv-mode .mobile-connect-card:not([hidden]) {
  position: absolute;
  z-index: 3;
  right: clamp(18px, 2.2vw, 42px);
  bottom: clamp(18px, 2vw, 34px);
  width: clamp(122px, 9vw, 176px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px;
  color: #203642;
  text-align: center;
  background: rgba(248, 251, 250, .97);
  border: 1px solid rgba(194, 219, 215, .9);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
body.tv-mode .mobile-connect-card strong { font-size: clamp(9px, .6vw, 12px); font-weight: 800; }
body.tv-mode .mobile-connect-card small { color: #75858c; font-size: clamp(8px, .48vw, 10px); }
body.tv-mode .mobile-connect-card svg { display: block; width: 100%; aspect-ratio: 1; border-radius: 4px; }
body.tv-mode .mobile-connect-card span { color: #60717a; font-size: clamp(8px, .48vw, 10px); font-weight: 700; overflow-wrap: anywhere; }
body.tv-mode .mobile-connect-card[data-connected="false"] svg { opacity: .16; }
body.tv-mode .control-row, body.tv-mode .clock-foot { margin-right: clamp(132px, 11vw, 205px); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 210px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .content-wrap { padding-inline: 27px; }
  .topbar { padding-inline: 27px; }
  .timer-layout { grid-template-columns: minmax(260px, .8fr) minmax(0,1.3fr); }
  .clock-panel { padding-inline: 16px; }
  .clock-details { gap: 12px; }
}
@media (max-width: 850px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-brand { display: flex; }
  .breadcrumbs { display: none; }
  .topbar { height: 57px; padding-inline: 16px; }
  .topbar-right { gap: 8px; }
  .content-wrap { padding: 25px 17px 18px; }
  .page-heading { align-items: center; margin-bottom: 22px; }
  .date-chip { padding: 7px 9px; gap: 6px; font-size: 9px; }
  .section-note { display: none; }
  .timer-layout { grid-template-columns: 1fr; }
  .setup-panel { order: 2; }
  .clock-panel { order: 1; }
  .mode-card { min-height: 124px; padding: 12px 11px; }
  .mode-title { font-size: 10px; }
  .mode-description { font-size: 8px; }
  .mode-meta { font-size: 6px; letter-spacing: .6px; }
  .bottom-strip { grid-template-columns: 1fr; }
  .display-card { min-width: 0; }
}
@media (max-width: 560px) {
  .topbar { height: 54px; padding-inline: 12px; }
  .mobile-brand { font-size: 11px; }
  .mobile-brand .brand-mark { width: 28px; height: 28px; }
  .live-status { font-size: 8px; gap: 6px; }
  .icon-button { width: 30px; height: 30px; }
  .content-wrap { padding: 22px 12px 14px; }
  .page-heading { align-items: start; }
  .page-heading p { max-width: 230px; font-size: 10px; line-height: 1.45; }
  .eyebrow { font-size: 7px; letter-spacing: 1px; }
  h1 { font-size: 30px; }
  .date-chip { margin-top: 4px; border: 0; padding: 5px 0; background: transparent; }
  .date-icon { font-size: 14px; }
  .section-heading h2 { font-size: 14px; }
  .section-kicker { font-size: 8px; }
  .mode-grid { gap: 6px; }
  .mode-card { min-height: 119px; padding: 9px 8px; border-radius: 11px; }
  .mode-icon { width: 27px; height: 27px; border-radius: 8px; }
  .mode-icon svg { width: 15px; height: 15px; }
  .mode-card-top { margin-bottom: 8px; }
  .mode-title { font-size: 8px; line-height: 1.3; }
  .mode-description { margin-top: 4px; font-size: 7px; line-height: 1.35; }
  .mode-meta { margin-top: 8px; font-size: 5px; letter-spacing: .45px; }
  .mode-meta-dot { width: 3px; height: 3px; margin-right: 3px; }
  .clock-panel { padding: 14px 13px 11px; border-radius: 13px; }
  .clock-panel-head { align-items: start; }
  .session-symbol { width: 27px; height: 27px; }
  .current-session small { font-size: 6px; }
  .current-session strong { font-size: 9px; }
  .state-pill { padding: 5px 6px; font-size: 6px; }
  .clock-main { min-height: 150px; padding: 19px 0 11px; }
  .phase-label { font-size: 8px; }
  .time-display { font-size: clamp(58px, 18vw, 80px); letter-spacing: -4px; }
  .clock-subline { margin-top: 7px; font-size: 8px; }
  .clock-details { min-height: 56px; gap: 8px; justify-content: space-around; }
  .detail-item { gap: 5px; }
  .detail-icon { width: 20px; height: 20px; border-radius: 6px; font-size: 7px; }
  .detail-item small { font-size: 5px; letter-spacing: .55px; }
  .detail-item strong { font-size: 8px; }
  .detail-divider { height: 22px; }
  .control-row { grid-template-columns: 1fr 1.5fr 1fr; gap: 5px; }
  .control-button { min-height: 38px; gap: 4px; border-radius: 8px; font-size: 7px; }
  .control-symbol { font-size: 10px; }
  .clock-foot { font-size: 6px; }
  .setup-panel { padding: 14px 13px 12px; }
  .saved-presets { margin-bottom: 12px; padding: 9px; }
  .saved-presets-heading small { font-size: 7px; }
  .save-preset-button { padding: 6px 7px; font-size: 7px; }
  .saved-preset-load { padding: 7px; }
  .saved-preset-copy strong { font-size: 8px; }
  .saved-preset-copy small { font-size: 6px; }
  .saved-preset-actions button { width: 27px; }
  .panel-heading h2 { font-size: 13px; }
  .bottom-strip { gap: 7px; }
  .tip-card { padding: 9px; }
  .tip-card strong, .display-card strong { font-size: 8px; }
  .tip-card small, .display-card small { font-size: 7px; line-height: 1.35; }
  .page-footer { font-size: 7px; }
  .sound-dialog form { padding: 18px; }
  .sound-dialog-actions { justify-content: stretch; }
  .sound-dialog-actions button { flex: 1 1 auto; }
  body.tv-mode .content-wrap { padding: 18px 15px; }
  body.tv-mode .page-heading { margin-bottom: 10px; }
  body.tv-mode h1 { font-size: 22px; }
  body.tv-mode .page-heading p { font-size: 9px; }
  body.tv-mode .clock-panel { padding: 15px; border-radius: 15px; }
  body.tv-mode .clock-panel-head { top: 15px; left: 15px; right: 15px; }
  body.tv-mode .time-display { font-size: clamp(78px, 20vw, 145px); }
  body.tv-mode .phase-label { min-height: 56px; padding: 8px; font-size: clamp(21px, 5.5vw, 34px); letter-spacing: .04em; }
  body.tv-mode .progress-track { height: 18px; margin-top: 8px; }
  body.tv-mode .tv-audio-status:not([hidden]) { font-size: 7px; }
  body.tv-mode .clock-details { min-height: 58px; gap: 10px; }
  body.tv-mode .detail-item small { font-size: 5px; letter-spacing: .5px; }
  body.tv-mode .detail-item strong { font-size: 8px; }
  body.tv-mode .detail-icon { width: 22px; height: 22px; border-radius: 7px; font-size: 7px; }
  body.tv-mode .clock-foot { font-size: 6px; }
}

@media (max-width: 360px) {
  #connectionLabel { display: none; }
  .topbar-right { gap: 5px; }
}

@media (max-width: 560px) {
  .topbar { min-height: 60px; height: auto; padding-block: 7px; }
  .topbar-right { gap: 9px; }
  .live-status { gap: 7px; font-size: 10px; }
  .icon-button { width: 44px; height: 44px; }
  .content-wrap { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .eyebrow { font-size: 9px; }
  .page-heading p { max-width: 260px; font-size: 12px; }
  .section-kicker { font-size: 10px; }
  .mode-card { min-height: 58px; display: flex; align-items: center; gap: 7px; padding: 8px 7px; border-radius: 10px; }
  .mode-card-top { display: flex; flex: 0 0 auto; margin: 0; }
  .mode-icon { width: 24px; height: 24px; }
  .mode-icon svg { width: 14px; height: 14px; }
  .mode-description, .mode-meta { display: none; }
  .mode-title { font-size: 11px; line-height: 1.2; text-align: left; letter-spacing: 0; }
  .mode-grid { gap: 6px; }
  .section-heading { margin-bottom: 8px; }
  .mode-section { margin-bottom: 12px; }
  .panel-heading h2 { font-size: 16px; }
  .panel-kicker, .edit-tag { font-size: 10px; }
  .preset-button, .save-preset-button { min-height: 44px; padding-inline: 10px; font-size: 11px; }
  .saved-presets { padding: 11px; }
  .saved-presets-heading small, .saved-preset-empty { font-size: 11px; }
  .saved-preset-copy strong { font-size: 12px; }
  .saved-preset-copy small { font-size: 10px; }
  .saved-preset-load { min-height: 48px; }
  .saved-preset-actions button { width: 42px; min-height: 44px; font-size: 15px; }
  .field-label { font-size: 12px; line-height: 1.35; }
  .field-label small { font-size: 11px; }
  .field input, .field textarea, .time-input input { min-height: 44px; height: 44px; font-size: 16px; }
  .field textarea { min-height: 112px; height: auto; line-height: 1.45; }
  .field-suffix { font-size: 12px; }
  .save-settings { min-height: 48px; font-size: 13px; }
  .control-button { min-height: 48px; padding-inline: 5px; font-size: 11px; }
  .control-symbol { font-size: 14px; }
  .phase-label { font-size: 10px; }
  .clock-subline { font-size: 10px; }
  .current-session small, .clock-foot { font-size: 10px; }
  .current-session strong { font-size: 13px; }
  .state-pill { font-size: 9px; }
  .detail-icon { width: 24px; height: 24px; font-size: 9px; }
  .detail-item small { font-size: 9px; letter-spacing: .2px; }
  .detail-item strong { font-size: 12px; }
  .sound-dialog { max-height: min(88vh, 760px); max-height: min(88dvh, 760px); }
  .sound-dialog form { padding: 16px; }
  .sound-dialog h2 { font-size: 20px; }
  .sound-dialog p { font-size: 13px !important; line-height: 1.45; }
  .sound-toggle { min-height: 58px; padding: 11px 12px; }
  .sound-toggle strong { font-size: 13px; }
  .sound-toggle small { font-size: 11px; }
  .sound-field .field-label { font-size: 12px; }
  .sound-field select { min-height: 44px; font-size: 16px; }
  .sound-field input[type="range"] { height: 40px; }
  .sound-section-title { font-size: 10px; }
  .sound-preview-section { gap: 9px; padding: 11px; }
  .sound-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sound-preview-button { min-height: 70px; display: grid; justify-items: start; align-content: center; gap: 5px; padding: 7px; border-radius: 10px; }
  .sound-preview-icon { width: 27px; height: 27px; flex-basis: 27px; font-size: 14px; }
  .sound-preview-button strong { font-size: 11px; }
  .sound-preview-button small { font-size: 9px; }
  .sound-note { font-size: 11px !important; }
  .sound-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .sound-dialog-actions button { min-height: 44px; padding-inline: 8px; font-size: 11px; }
  .sound-dialog-actions button:last-child { grid-column: 1 / -1; }
  body.tv-mode .control-row, body.tv-mode .reaction-action { display: none !important; }
}

@media (max-width: 800px) {
  body.tv-mode .mobile-connect-card { display: none !important; }
  body.tv-mode .control-row, body.tv-mode .clock-foot { margin-right: 0; }
}
/* Cloud login follows the same Judo Klatovy navy and red palette. */
.cloud-auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 10%, rgba(216, 40, 28, .1), transparent 34rem),
    var(--paper);
}

.cloud-auth-gate[hidden] {
  display: none;
}

.cloud-auth-card {
  width: min(100%, 440px);
  padding: clamp(26px, 6vw, 42px);
  border: 1px solid rgba(159, 177, 189, .28);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 28, 42, .12);
}

.cloud-auth-card h1 {
  margin: 14px 0 8px;
  color: #101c2a;
  font-size: clamp(28px, 7vw, 36px);
}

.cloud-auth-card > p {
  margin: 0 0 24px;
  color: #758594;
  line-height: 1.6;
}

.cloud-auth-card form {
  display: grid;
  gap: 16px;
}

.cloud-auth-card .field input {
  width: 100%;
}

.cloud-auth-error {
  min-height: 20px;
  margin: 0;
  color: #b43b38;
  font-size: 14px;
}

.auth-submit {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: #d8281c;
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.auth-submit:hover {
  background: #a71e17;
}

.auth-submit:disabled {
  cursor: wait;
  opacity: .7;
}

.cloud-signout {
  border: 1px solid rgba(114, 133, 147, .24);
  border-radius: 12px;
  padding: 9px 12px;
  background: #fff;
  color: #5b6e7d;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* Judo Klatovy visual system and the mobile circuit setup. */
.quick-presets-label { display: block; margin-bottom: 7px; color: #6f7b85; font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.quick-presets .preset-row { margin: 0 0 15px; }
.cloud-auth-gate { background: radial-gradient(circle at 10% 10%, rgba(216,40,28,.1), transparent 34rem), var(--paper); }
.auth-submit { background: var(--red); }
.auth-submit:hover { background: #ad2118; }

.circuit-wizard { display: grid; gap: 0; min-width: 0; }
.wizard-intro { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.wizard-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.wizard-progress li { display: flex; align-items: center; gap: 7px; min-width: 0; color: #68747e; font-size: 12px; font-weight: 700; }
.wizard-progress li > span { display: grid; flex: 0 0 28px; place-items: center; width: 28px; height: 28px; border: 1px solid #c9c5bc; border-radius: 50%; color: #65717b; background: #f4f2ec; font-size: 12px; }
.wizard-progress li.active { color: var(--ink); }
.wizard-progress li.active > span { border-color: var(--red); color: #fff; background: var(--red); box-shadow: 0 0 0 4px rgba(216,40,28,.1); }
.wizard-progress li.complete > span { border-color: #243443; color: #fff; background: #243443; }
.wizard-page h3 { margin: 0 0 5px; color: var(--ink); font-size: 20px; letter-spacing: -.45px; }
.wizard-page-hint { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.wizard-name-field { margin: 0 0 11px; padding: 13px; border: 1px solid #ddd9d1; border-radius: 14px; background: #f4f2ec; }
.wizard-name-field .field-label { color: var(--ink); font-size: 13px; font-weight: 750; }
.wizard-stepper-grid { display: grid; gap: 9px; }
.wizard-stepper-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 72px; padding: 10px 11px 10px 13px; border: 1px solid #ddd9d1; border-radius: 14px; background: #f4f2ec; }
.wizard-stepper-label { display: grid; gap: 4px; min-width: 0; color: var(--ink); font-size: 13px; font-weight: 750; line-height: 1.2; }
.wizard-stepper-label small { color: var(--muted); font-size: 10px; font-weight: 550; line-height: 1.35; }
.wizard-stepper { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.wizard-stepper button { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid #ccc8bf; border-radius: 11px; color: var(--ink); background: #fff; font-size: 23px; line-height: 1; touch-action: manipulation; }
.wizard-stepper button:active, .circuit-add-station:active, .wizard-back:active, .wizard-next:active, .wizard-save:active { transform: scale(.98); }
.wizard-stepper input { width: 50px; height: 44px; padding: 0 3px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; font-size: 20px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.wizard-unit { min-width: 22px; color: var(--muted); font-size: 11px; }
.wizard-advanced { margin-top: 10px; border: 1px solid #ddd9d1; border-radius: 13px; background: rgba(255,255,255,.42); }
.wizard-advanced summary { display: grid; gap: 3px; min-height: 52px; align-content: center; padding: 8px 13px; color: var(--ink); font-size: 13px; font-weight: 750; cursor: pointer; list-style: none; }
.wizard-advanced summary { position: relative; padding-right: 38px; }
.wizard-advanced summary::-webkit-details-marker { display: none; }
.wizard-advanced summary::after { content: "+"; position: absolute; right: 29px; color: var(--red); font-size: 20px; }
.wizard-advanced[open] summary::after { content: "−"; }
.wizard-advanced summary span + span { color: var(--muted); font-size: 10px; font-weight: 550; }
.wizard-advanced .wizard-stepper-card { margin: 0 9px 9px; }
.circuit-station-list { display: grid; gap: 8px; }
.circuit-station-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 58px; padding: 6px 7px 6px 9px; border: 1px solid #ddd9d1; border-radius: 13px; background: #f4f2ec; }
.circuit-station-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #243443; background: #dedbd3; font-size: 12px; font-weight: 800; }
.circuit-station-input { width: 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid #d5d1c8; border-radius: 9px; color: var(--ink); background: #fff; font-size: 16px; }
.circuit-station-remove { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 11px; color: #8a3732; background: #f8e8e5; font-size: 22px; touch-action: manipulation; }
.circuit-station-remove:disabled { opacity: .35; cursor: not-allowed; }
.circuit-add-station { width: 100%; min-height: 50px; margin-top: 10px; border: 1px dashed #9d9991; border-radius: 13px; color: #243443; background: rgba(255,255,255,.4); font-size: 13px; font-weight: 750; touch-action: manipulation; }
.circuit-station-count { margin: 9px 1px 0; color: var(--muted); font-size: 11px; }
.circuit-summary { padding: 14px; border: 1px solid #d7d2c8; border-radius: 16px; background: #f4f2ec; }
.circuit-summary-title { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.circuit-summary-mark { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; color: #fff; background: var(--red); font-size: 11px; font-weight: 900; }
.circuit-summary-title small, .circuit-summary-title strong { display: block; }
.circuit-summary-title small { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .9px; }
.circuit-summary-title strong { color: var(--ink); font-size: 15px; }
.circuit-summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(23,32,42,.1); color: var(--muted); font-size: 12px; }
.circuit-summary-row strong { color: var(--ink); text-align: right; }
.circuit-summary-row.total { color: var(--ink); font-weight: 750; }
.circuit-summary-row.total strong { color: var(--red); font-size: 16px; }
.circuit-summary-stations { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 15px; margin: 12px 0 0; padding-left: 20px; color: var(--ink); font-size: 12px; }
.wizard-sound-note { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.wizard-sound-note span { color: var(--red); font-size: 17px; }
.circuit-wizard-actions { display: none; }

@media (max-width: 850px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .main-content, .content-wrap, .timer-layout, .setup-panel, .clock-panel { min-width: 0; }
  .topbar { position: sticky; top: 0; z-index: 20; min-height: 60px; height: auto; padding: max(7px, env(safe-area-inset-top)) 12px 7px; background: rgba(244,242,236,.96); border-bottom: 1px solid rgba(23,32,42,.1); backdrop-filter: blur(14px); }
  .mobile-brand { flex: 0 0 auto; color: var(--ink); font-size: 13px; }
  .mobile-brand .brand-mark { box-shadow: none; }
  .topbar-right { flex: 0 0 auto; gap: 5px; }
  .live-status { flex: 0 0 auto; color: #42515e; font-size: 10px; }
  .icon-button { width: 44px; height: 44px; border-radius: 12px; color: #243443; }
  .content-wrap { padding: 20px 14px max(26px, env(safe-area-inset-bottom)); }
  .page-heading { align-items: center; gap: 8px; margin-bottom: 17px; }
  .page-heading p { max-width: 270px; font-size: 12px; line-height: 1.45; }
  .date-chip { flex: 0 0 auto; }
  .mode-section { margin-bottom: 14px; }
  .section-heading { margin-bottom: 9px; }
  .mode-grid { gap: 7px; }
  .mode-card { display: flex; align-items: center; gap: 7px; min-height: 60px; padding: 8px 9px; border-radius: 13px; }
  .mode-card-top { display: flex; flex: 0 0 auto; margin: 0; }
  .mode-icon { width: 28px; height: 28px; }
  .mode-title { font-size: clamp(11px, 3vw, 13px); line-height: 1.2; letter-spacing: 0; }
  .mode-description, .mode-meta, .mode-arrow { display: none; }
  .timer-layout { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .setup-panel { order: 1; padding: 16px 14px 14px; }
  .clock-panel { order: 2; padding: 17px 16px 14px; }
  .clock-panel { scroll-margin-top: 74px; }
  body.timer-active:not(.tv-mode) .setup-panel { display: none !important; }
  body.timer-active:not(.tv-mode) .clock-panel { order: 1; }
  .panel-heading { align-items: center; }
  .panel-heading h2 { font-size: 19px; }
  .panel-kicker, .edit-tag { font-size: 10px; }
  .quick-presets { margin-top: 14px; }
  .quick-presets-label { font-size: 10px; }
  .preset-row { gap: 8px; margin: 0 0 13px; }
  .preset-button { min-height: 44px; padding: 8px 11px; border-radius: 10px; font-size: 12px; }
  .preset-button:hover, .preset-button.active { border-color: #d8281c; color: #a71e17; background: #fff5f4; }
  .saved-presets { margin: 0 0 14px; padding: 11px; border-color: #e0dcd4; background: #f8f6f1; }
  .saved-presets-heading { margin-bottom: 8px; }
  .saved-presets-heading small { font-size: 10px; }
  .saved-preset-empty { display: none; }
  .saved-preset-empty { font-size: 11px; }
  .saved-preset-copy strong { font-size: 12px; }
  .saved-preset-copy small { font-size: 10px; }
  .saved-preset-load { min-height: 48px; padding: 8px 10px; }
  .saved-preset-actions button { width: 44px; min-height: 44px; font-size: 15px; }
  .quick-presets .circuit-quick-preset { display: grid; flex: 1 1 calc(50% - 5px); min-width: 0; align-content: center; gap: 5px; min-height: 67px; text-align: left; }
  .circuit-quick-preset strong { color: var(--ink); font-size: 12px; line-height: 1.2; }
  .circuit-quick-preset small { color: var(--muted); font-size: 10px; line-height: 1.25; }
  .circuit-quick-preset.active { border-width: 2px; padding: 7px 10px; background: #fff; }
  .circuit-quick-preset.active strong::before { content: "✓ "; color: var(--red); }
  #settingsFields { gap: 10px; }
  .field-label { color: #40505d; font-size: 13px; line-height: 1.35; }
  .field-label small { font-size: 11px; }
  .field input, .field textarea, .time-input input, .sound-field select,
  .preset-dialog .field input, .cloud-auth-card input,
  #settingsFields input, #settingsFields textarea, #settingsFields select { min-height: 44px; height: 44px; font-size: 16px !important; }
  .field textarea { height: auto; min-height: 112px; }
  .sound-field input[type="range"] { min-height: 40px; height: 40px; }
  .sound-dialog, .preset-dialog { max-width: calc(100vw - 24px); max-height: min(88dvh, 760px); overflow-y: auto; }
  .sound-dialog form, .preset-dialog form { padding: 17px; }
  .sound-dialog-actions button, .preset-dialog-actions button { min-height: 46px; font-size: 13px; }
  .control-row { grid-template-columns: minmax(74px,.8fr) minmax(130px,1.6fr) minmax(74px,.8fr); gap: 7px; }
  .control-button { min-height: 50px; padding-inline: 6px; border-radius: 11px; font-size: 12px; }
  .control-symbol { font-size: 16px; }
  .time-display { font-size: clamp(62px, 18vw, 90px); letter-spacing: -.055em; }
  .clock-main { min-height: 180px; }
  .phase-label { font-size: 11px; }
  .clock-subline { font-size: 12px; }
  .current-session small { font-size: 9px; }
  .current-session strong { font-size: 13px; }
  .state-pill { font-size: 9px; }
  .clock-details { gap: 12px; min-height: 62px; }
  .detail-item small { font-size: 9px; letter-spacing: .3px; }
  .detail-item strong { font-size: 12px; }
  .detail-icon { width: 27px; height: 27px; font-size: 10px; }
  .clock-foot { font-size: 9px; }
  .bottom-strip, .page-footer { display: none; }
  .circuit-wizard { padding-bottom: 86px; }
  .circuit-wizard-actions { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: grid; grid-template-columns: minmax(88px,.75fr) minmax(0,1.5fr); gap: 8px; margin: 0; padding: 10px max(14px, calc((100vw - 820px) / 2)) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(23,32,42,.12); background: rgba(244,242,236,.97); backdrop-filter: blur(12px); }
  .wizard-back, .wizard-next, .wizard-save { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 52px; padding: 0 10px; border-radius: 13px; font-size: 14px; font-weight: 780; touch-action: manipulation; }
  .wizard-back { border: 1px solid #d7d2c8; color: var(--ink); background: #fff; }
  .wizard-next, .wizard-save { border: 1px solid var(--red); color: #fff; background: var(--red); box-shadow: 0 5px 14px rgba(216,40,28,.18); }
  .wizard-next[hidden], .wizard-save[hidden], .wizard-back[hidden] { display: none !important; }
  .wizard-next span, .wizard-save span { font-size: 18px; }
  .circuit-wizard[data-wizard-step="1"] .wizard-next { grid-column: 1 / -1; }
  .wizard-page[hidden] { display: none !important; }
  .wizard-advanced summary::after { right: 28px; }
  .panel-note { font-size: 10px; }
  .backup-action { margin-top: 14px; padding: 11px; }
  .backup-action strong { font-size: 11px; }
  .backup-action small { font-size: 9px; }
  .backup-download { min-width: 96px; font-size: 11px; }
  body.mobile-mode .content-wrap { padding-top: 18px; }
  body.tv-mode { overflow: hidden; }
}

@media (max-width: 390px) {
  .topbar { padding-inline: 9px; }
  .live-status #connectionLabel { display: none; }
  .live-status { width: 9px; overflow: hidden; }
  .topbar-right { gap: 4px; }
  .icon-button { width: 42px; height: 42px; }
  .content-wrap { padding-inline: 11px; }
  .mode-grid { gap: 5px; }
  .mode-card { gap: 5px; padding-inline: 6px; }
  .mode-icon { width: 25px; height: 25px; }
  .mode-title { font-size: 11px; }
  .setup-panel { padding-inline: 11px; }
  .circuit-wizard-actions { padding-right: 11px; padding-left: 11px; }
  .wizard-stepper-card { gap: 7px; padding-inline: 9px; }
  .wizard-stepper { gap: 3px; }
  .wizard-stepper button { flex-basis: 40px; width: 40px; height: 44px; }
  .wizard-stepper input { width: 43px; }
  .wizard-unit { min-width: 18px; font-size: 10px; }
}

@media (max-width: 360px) {
  .mobile-brand strong { display: none; }
  .page-heading { display: block; }
  .date-chip { margin-top: 8px; }
}

@media (max-width: 850px) {
  body.circuit-wizard-active .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.timer-active .circuit-wizard-actions,
  body.clock-controls-visible .circuit-wizard-actions { display: none !important; }
  button { touch-action: manipulation; }
}

@media (max-width: 520px) {
  .cloud-auth-gate {
    padding: 16px;
  }
  .cloud-auth-card {
    border-radius: 20px;
  }
}

/* Phone-first Randori setup: large time steppers and a compact training summary. */
@media (max-width: 850px) {
  .mode-title { font-size: 14px; }
  .quick-presets-label { color: #53616d; font-size: 12px; letter-spacing: 0; }
}

.quick-presets .quick-preset-card { display: grid; flex: 1 1 calc(50% - 5px); min-width: 0; min-height: 68px; align-content: center; gap: 5px; padding: 9px 11px; text-align: left; }
.quick-preset-card strong { color: var(--ink); font-size: 13px; line-height: 1.2; }
.quick-preset-card small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.quick-preset-card.active { border-width: 2px; padding: 8px 10px; background: #fff; }
.quick-preset-card.active strong::before { content: "✓ "; color: var(--red); }
.randori-setup { display: grid; gap: 11px; min-width: 0; }
.randori-setup .wizard-intro { margin-bottom: 0; font-size: 13px; line-height: 1.45; }
.randori-setup .wizard-name-field { min-width: 0; margin: 0; padding: 11px 13px; }
.randori-setup .field-label { display: grid; gap: 4px; color: var(--ink); font-size: 14px; font-weight: 750; }
.randori-setup .field-label small { color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.35; }
.randori-core-settings, .randori-advanced .wizard-stepper-grid { display: grid; gap: 9px; min-width: 0; }
.randori-time-field { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid #ddd9d1; border-radius: 14px; background: #f4f2ec; }
.randori-duration-control { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 0; }
.randori-time-step { display: grid; flex: 0 0 48px; place-items: center; width: 48px; height: 48px; padding: 0; border: 1px solid #ccc8bf; border-radius: 12px; color: var(--ink); background: #fff; font-size: 25px; line-height: 1; touch-action: manipulation; }
.randori-time-step:active { transform: scale(.97); }
.randori-duration-control .time-input { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 3px; min-width: 0; }
#settingsFields .randori-duration-control .time-input input { box-sizing: border-box; flex: 0 0 48px; width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0 2px; appearance: textfield; -moz-appearance: textfield; border: 1px solid #d5d1c8; border-radius: 9px; color: var(--ink); background: #fff; font-size: 22px !important; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
#settingsFields .randori-duration-control .time-input input::-webkit-inner-spin-button,
#settingsFields .randori-duration-control .time-input input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.randori-duration-control .time-separator { color: var(--ink); font-size: 22px; font-weight: 800; }
.randori-setup .wizard-stepper-card { min-height: 72px; background: #f4f2ec; }
.randori-setup .wizard-stepper-label { font-size: 14px; }
.randori-setup .wizard-stepper-label small { font-size: 11px; }
.randori-setup .wizard-stepper button { width: 48px; height: 48px; flex-basis: 48px; }
#settingsFields .randori-setup .wizard-stepper input { width: 50px; height: 48px; font-size: 22px !important; }
.randori-setup .wizard-unit { font-size: 12px; }
.randori-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 12px; min-width: 0; padding: 11px 14px; border: 1px solid #ddd9d1; border-radius: 13px; background: #fff; }
.randori-summary-copy { display: grid; gap: 2px; }
.randori-summary-copy small { color: var(--muted); font-size: 11px; }
.randori-summary-copy strong { color: var(--red); font-size: 20px; font-variant-numeric: tabular-nums; }
.randori-summary-detail { color: #52616e; font-size: 12px; font-weight: 650; }
.randori-advanced { margin-top: 0; }
.randori-advanced summary { min-height: 60px; font-size: 14px; }
.randori-advanced summary span + span { font-size: 11px; }
.randori-advanced .wizard-stepper-card { margin: 0 9px 9px; }
.randori-setup + .save-settings { min-height: 52px; font-size: 14px; }
.randori-setup .saved-presets-heading small { color: #6f7b85; }

@media (max-width: 390px) {
  .randori-time-step { flex-basis: 44px; width: 44px; height: 44px; }
  #settingsFields .randori-duration-control .time-input input { flex-basis: 48px; width: 48px; min-width: 48px; height: 44px; min-height: 44px; font-size: 20px !important; }
  .randori-setup .wizard-stepper button { flex-basis: 42px; width: 42px; height: 44px; }
  #settingsFields .randori-setup .wizard-stepper input { width: 44px; }
  .randori-summary-detail { font-size: 11px; }
}

@media (min-width: 851px) {
  /* The mobile URL remains phone-first when it is previewed from a laptop. */
  body.mobile-mode .app-shell { display: block; min-height: 100vh; }
  body.mobile-mode .sidebar { display: none !important; }
  body.mobile-mode .main-content { width: 100%; min-width: 0; }
  body.mobile-mode .topbar { position: sticky; top: 0; z-index: 20; height: auto; min-height: 60px; padding: 7px 14px; background: rgba(244,242,236,.96); border-bottom: 1px solid rgba(23,32,42,.1); backdrop-filter: blur(14px); }
  body.mobile-mode .mobile-brand { display: flex; color: var(--ink); font-size: 13px; }
  body.mobile-mode .breadcrumbs { display: none; }
  body.mobile-mode .topbar-right { gap: 6px; }
  body.mobile-mode .live-status { flex: 0 0 auto; color: #42515e; font-size: 10px; }
  body.mobile-mode .icon-button { width: 44px; height: 44px; border-radius: 12px; color: #243443; }
  body.mobile-mode .content-wrap { width: min(100%, 680px); margin: 0 auto; padding: 18px 14px max(26px, env(safe-area-inset-bottom)); }
  body.mobile-mode .page-heading { align-items: center; gap: 8px; margin-bottom: 17px; }
  body.mobile-mode .page-heading p { max-width: 270px; font-size: 12px; line-height: 1.45; }
  body.mobile-mode .date-chip { flex: 0 0 auto; padding: 7px 9px; gap: 6px; font-size: 9px; }
  body.mobile-mode .mode-section { margin-bottom: 14px; }
  body.mobile-mode .section-heading { margin-bottom: 9px; }
  body.mobile-mode .mode-grid { gap: 7px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.mobile-mode .mode-card { display: flex; align-items: center; gap: 7px; min-height: 60px; padding: 8px 9px; border-radius: 13px; }
  body.mobile-mode .mode-card-top { display: flex; flex: 0 0 auto; margin: 0; }
  body.mobile-mode .mode-icon { width: 28px; height: 28px; }
  body.mobile-mode .mode-description, body.mobile-mode .mode-meta, body.mobile-mode .mode-arrow { display: none; }
  body.mobile-mode .mode-title { font-size: 14px; line-height: 1.2; letter-spacing: 0; }
  body.mobile-mode .timer-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  body.mobile-mode .setup-panel { order: 1; padding: 16px 14px 14px; }
  body.mobile-mode .clock-panel { order: 2; padding: 17px 16px 14px; }
  body.mobile-mode .clock-panel { scroll-margin-top: 74px; }
  body.mobile-mode .control-row { grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr) minmax(0, .8fr); gap: 7px; }
  body.mobile-mode .control-button { min-width: 0; min-height: 50px; padding-inline: 5px; border-radius: 11px; font-size: 11px; }
  body.mobile-mode .control-symbol { font-size: 14px; }
  body.mobile-mode .time-display { font-size: clamp(62px, 18vw, 90px); letter-spacing: -.055em; }
  body.mobile-mode .clock-main { min-height: 180px; }
  body.mobile-mode .phase-label { font-size: 11px; }
  body.mobile-mode .clock-subline { font-size: 12px; }
  body.mobile-mode .current-session small { font-size: 9px; }
  body.mobile-mode .current-session strong { font-size: 13px; }
  body.mobile-mode .state-pill { font-size: 9px; }
  body.mobile-mode .clock-details { gap: 12px; min-height: 62px; }
  body.mobile-mode .detail-item small { font-size: 9px; letter-spacing: .3px; }
  body.mobile-mode .detail-item strong { font-size: 12px; }
  body.mobile-mode .detail-icon { width: 27px; height: 27px; font-size: 10px; }
  body.mobile-mode .clock-foot { font-size: 9px; }
  body.mobile-mode .bottom-strip, body.mobile-mode .page-footer { display: none; }
  body.mobile-mode .saved-presets { margin: 0 0 14px; padding: 11px; background: #f8f6f1; }
  body.mobile-mode .saved-presets-heading small, body.mobile-mode .saved-preset-empty { font-size: 11px; }
  body.mobile-mode .preset-button, body.mobile-mode .save-preset-button { min-height: 44px; padding-inline: 10px; font-size: 11px; }
  body.mobile-mode #settingsFields input, body.mobile-mode #settingsFields select { min-height: 44px; height: 44px; font-size: 16px !important; }
  body.mobile-mode #settingsFields textarea { min-height: 112px; height: auto; font-size: 16px !important; }
}

@media (max-width: 390px) {
  .control-button { min-width: 0; padding-inline: 4px; gap: 3px; font-size: 10px; white-space: nowrap; }
  #skipButton .control-symbol { display: none; }
}

@media (max-width: 350px) {
  .control-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  #resetButton { grid-area: 1 / 1; }
  #skipButton { grid-area: 1 / 2; }
  #startButton { grid-area: 2 / 1 / 3 / 3; }
}

/* JudoCentrum module hub and cloud weather station. */
body.module-hub .app-shell, body.weather-module .app-shell { display: block; }
body.module-hub .sidebar, body.weather-module .sidebar { display: none; }
body.module-hub .topbar, body.weather-module .topbar { position: sticky; top: 0; z-index: 20; height: 66px; padding-inline: clamp(18px, 5vw, 72px); backdrop-filter: blur(14px); }
body.module-hub .content-wrap, body.weather-module .content-wrap { width: min(1120px, 100%); padding: clamp(24px, 6vw, 64px) clamp(18px, 5vw, 54px) 28px; }
body.module-hub .breadcrumbs, body.weather-module .breadcrumbs { display: none; }
body.module-hub .mobile-brand, body.weather-module .mobile-brand { display: flex; color: var(--ink); font-size: 15px; }
body.module-hub .topbar-right .sound-test, body.module-hub .topbar-right .display-link,
body.weather-module .topbar-right .sound-test, body.weather-module .topbar-right .display-link,
body.module-hub .topbar-right #openAudioSettings, body.weather-module .topbar-right #openAudioSettings,
body.module-hub .topbar-right .live-status, body.weather-module .topbar-right .live-status { display: none; }
body.cloud-prep-mode .control-row, body.cloud-prep-mode .reaction-action, body.cloud-prep-mode .display-card,
body.cloud-prep-mode .topbar-right .sound-test, body.cloud-prep-mode .topbar-right #openAudioSettings { display: none !important; }
.cloud-prep-banner { max-width: 760px; margin: 16px 0 0 !important; padding: 12px 15px; border: 1px solid #e8c9c4; border-radius: 12px; color: #77413b !important; background: #fff4f1; font-size: 13px !important; line-height: 1.5 !important; }
.module-hub { min-height: calc(100vh - 122px); }
.hub-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: clamp(34px, 7vw, 70px); }
.hub-heading h1, .weather-heading h1 { font-size: clamp(36px, 6vw, 62px); letter-spacing: -2.7px; }
.hub-heading p, .weather-heading p { max-width: 540px; margin: 14px 0 0; color: var(--muted); font-size: clamp(15px, 2vw, 19px); line-height: 1.5; }
.hub-access { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 10px 13px; border: 1px solid #dfe7e5; border-radius: 999px; color: #536a62; background: rgba(255,255,255,.7); font-size: 12px; font-weight: 700; }
.hub-access-dot, .module-tile-status i { width: 8px; height: 8px; border-radius: 50%; background: #aeb9bd; }
.hub-section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; color: var(--muted-2); font-size: 12px; }
.module-tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.module-tile { position: relative; display: flex; flex-direction: column; min-height: 265px; padding: clamp(20px, 3vw, 31px); overflow: hidden; border: 1px solid #dfe5e6; border-radius: 22px; color: inherit; background: rgba(255,255,255,.88); box-shadow: 0 14px 36px rgba(24,45,61,.05); text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.module-tile:hover { transform: translateY(-3px); border-color: #e7aaa5; box-shadow: 0 22px 48px rgba(24,45,61,.1); }
.module-tile-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 30px; border-radius: 16px; color: #fff; background: var(--red); font-size: 30px; }
.module-tile-icon.weather-icon { color: #856900; background: #fff2bf; }
.module-tile-arrow { position: absolute; top: 27px; right: 29px; color: #8997a0; font-size: 20px; transition: transform .18s ease; }
.module-tile:hover .module-tile-arrow { color: var(--red); transform: translate(2px,-2px); }
.module-tile-kicker { color: #83929c; font-size: 9px; font-weight: 800; letter-spacing: 1.35px; }
.module-tile > strong { margin-top: 8px; color: var(--ink); font-size: clamp(22px, 3vw, 30px); letter-spacing: -.7px; }
.module-tile > small { max-width: 430px; margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.module-tile-status { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 24px; color: #70808b; font-size: 11px; font-weight: 650; }
.timer-tile .module-tile-status i { background: #28aa83; box-shadow: 0 0 0 4px #e4f5ef; }
.weather-tile .module-tile-status i[data-state="online"] { background: #28aa83; box-shadow: 0 0 0 4px #e4f5ef; }
.weather-tile .module-tile-status i[data-state="stale"], .weather-tile .module-tile-status i[data-state="waiting"] { background: #d7a833; box-shadow: 0 0 0 4px #fff5d8; }
.weather-tile .module-tile-status i[data-state="offline"] { background: var(--red); box-shadow: 0 0 0 4px #fbe9e7; }
.hub-footer-note { margin: 20px 2px 0; color: #81909a; font-size: 12px; line-height: 1.5; }
.weather-heading { margin-bottom: 28px; }
.back-to-modules { display: inline-block; margin-bottom: 31px; color: #536879; font-size: 13px; font-weight: 700; text-decoration: none; }
.back-to-modules:hover { color: var(--red-dark); }
.weather-status-card { display: flex; align-items: center; gap: 10px; min-height: 58px; margin: 0 0 14px; padding: 13px 16px; border: 1px solid #e1e6e5; border-radius: 14px; color: #63727b; background: rgba(255,255,255,.72); }
.weather-status-card small { margin-left: auto; color: #8e9ba2; font-size: 11px; }
.weather-status-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: #aab4b8; }
.weather-status-card[data-state="online"] .weather-status-dot { background: #27a77f; box-shadow: 0 0 0 4px #e3f5ef; }
.weather-status-card[data-state="stale"] .weather-status-dot { background: #d7a833; box-shadow: 0 0 0 4px #fff5d8; }
.weather-status-card[data-state="offline"] .weather-status-dot { background: var(--red); box-shadow: 0 0 0 4px #fbe9e7; }
.weather-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.weather-metric { display: grid; justify-items: start; gap: 7px; min-height: 150px; padding: 20px; border: 1px solid #e1e6e5; border-radius: 17px; background: #fff; box-shadow: 0 8px 26px rgba(24,45,61,.035); }
.weather-metric > span { color: #82909a; font-size: 10px; font-weight: 800; letter-spacing: 1.1px; }
.weather-metric strong { color: var(--ink); font-size: clamp(33px, 5vw, 48px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -1.5px; }
.weather-metric small { color: #87949b; font-size: 12px; }
.weather-history-card { position: relative; margin-top: 14px; padding: 20px; border: 1px solid #e1e6e5; border-radius: 17px; background: #fff; box-shadow: 0 8px 26px rgba(24,45,61,.035); }
.weather-history-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; }
.weather-history-heading h2 { margin: 5px 0 0; color: var(--ink-2); font-size: 19px; }
.weather-history-heading > span { color: #87949b; font-size: 11px; }
.weather-chart { display: block; width: 100%; height: auto; min-height: 130px; margin-top: 14px; overflow: visible; }
.weather-chart:empty { display: none; }
.weather-chart .chart-grid { stroke: #e9edec; stroke-width: 1; }
.weather-chart .chart-line { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.weather-chart .chart-dot { fill: #fff; stroke: var(--red); stroke-width: 2; }
.weather-empty { display: grid; justify-items: center; gap: 9px; min-height: 190px; align-content: center; padding: 18px; text-align: center; }
.weather-empty-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px; color: #9c7d10; background: #fff5d2; font-size: 25px; }
.weather-empty strong { color: var(--ink-2); font-size: 16px; }
.weather-empty small { max-width: 430px; color: #87949b; font-size: 12px; line-height: 1.55; }
.weather-privacy-note { margin: 16px 3px 0; color: #84919a; font-size: 11px; line-height: 1.5; }

@media (max-width: 650px) {
  body.module-hub .topbar, body.weather-module .topbar { height: 58px; padding-inline: 14px; }
  body.module-hub .content-wrap, body.weather-module .content-wrap { padding: 27px 14px max(26px, env(safe-area-inset-bottom)); }
  .hub-heading { display: grid; align-items: start; gap: 17px; margin-bottom: 35px; }
  .hub-access { justify-self: start; }
  .module-tile-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .module-tile { min-height: 225px; padding: 20px; border-radius: 18px; }
  .module-tile-icon { width: 45px; height: 45px; margin-bottom: 22px; border-radius: 13px; font-size: 26px; }
  .module-tile-arrow { top: 24px; right: 23px; }
  .module-tile > small { font-size: 13px; }
  .weather-heading { margin-bottom: 22px; }
  .back-to-modules { margin-bottom: 24px; }
  .weather-status-card { flex-wrap: wrap; }
  .weather-status-card small { width: 100%; margin-left: 19px; }
  .weather-metric-grid { gap: 8px; }
  .weather-metric { min-height: 124px; gap: 6px; padding: 13px 10px; border-radius: 13px; }
  .weather-metric > span { font-size: 8px; letter-spacing: .75px; }
  .weather-metric strong { font-size: clamp(25px, 8vw, 37px); letter-spacing: -1px; }
  .weather-metric small { font-size: 10px; }
  .weather-history-card { padding: 14px; border-radius: 14px; }
  .weather-history-heading h2 { font-size: 16px; }
  .weather-history-heading > span { font-size: 9px; }
}
