:root{--bg:#000;--panel:#090909;--line:#303030;--muted:#a3a3a3;--timer-min-height:150px}
html,body{width:100%;height:100%;margin:0;background:#000;overflow:hidden}
body{height:100dvh}
#appShell{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;flex-direction:column;transform-origin:top left;background:#000}
#appShell>header{flex:0 0 auto;width:100%;max-width:none;height:60px;min-height:0;padding:0 clamp(12px,3vw,48px);gap:12px;flex-wrap:nowrap;background:#000}
#appShell .header-actions{gap:12px;flex-shrink:0}
#appShell>main{flex:1 1 0;min-height:0;width:100%;max-width:none;margin:0;padding:16px clamp(12px,3vw,48px) 12px;display:grid;grid-template-rows:auto minmax(var(--timer-min-height),1fr) auto auto auto;gap:14px}
#appShell .intro{margin:0;min-width:0}
#appShell .intro .eyebrow{margin:0 0 5px;font-size:9px;line-height:1.4;max-width:none}
#appShell .intro h1{font-size:clamp(21px,2.5vw,34px);line-height:1.15}
#appShell .timer{min-width:0;min-height:var(--timer-min-height);padding:16px 24px;border-color:#303030;background:#000;display:grid;grid-template-rows:auto minmax(0,1fr) 6px auto;gap:12px}
#appShell .timer-top{min-height:12px}
#appShell .digits{min-height:0;min-width:0;height:100%;width:100%;margin:0;display:flex;justify-content:center;align-items:center;line-height:1;letter-spacing:-.04em;font-size:clamp(42px,11vw,200px)}
#appShell .track{margin:0;height:6px;background:#252525}
#appShell .timer-bottom{min-width:0;align-items:center;gap:8px;flex-wrap:wrap;font-size:10px;line-height:1.4}
#appShell .timer-running{padding:5px 9px;font-size:10px;white-space:normal}
#appShell .controls{margin:0;width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:14px}
#appShell .timer-actions{display:flex;align-items:center;justify-content:center;gap:8px}
#appShell .controls>.control-divider{display:none}
#appShell .icon-button,#appShell .palette summary{width:44px;height:44px;min-width:44px;padding:0;display:flex;align-items:center;justify-content:center;margin:0;border-radius:9px}
#appShell .icon-button svg,#appShell .palette summary svg{width:22px;height:22px}
#appShell #custom{order:0;flex-basis:auto;min-width:0;width:100%;display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) minmax(0,1.4fr);align-items:stretch;gap:10px;margin:0;padding:0}
#appShell #custom .time-group{order:0;width:auto;min-width:0;max-width:none;height:128px;margin:0;padding:9px 10px 10px;flex:none;background:#090909;border-color:var(--line)}
#appShell #custom legend{font-size:12px;padding:0 5px}
#appShell #custom .group-fields{width:100%;height:100%;align-items:center;justify-content:center;gap:7px}
#appShell #custom .step-field{width:clamp(40px,5vw,64px);min-width:0;gap:5px}
#appShell #custom label{font-size:10px;gap:4px;padding:0;white-space:normal}
#appShell #custom input{width:100%;min-width:0;height:42px;padding:0;text-align:center;font-size:18px;background:#121212}
#appShell #custom .step-buttons{width:100%;gap:4px}
#appShell #custom .step-buttons button{width:calc(50% - 2px);min-width:0;height:27px;padding:0;margin:0;background:#171717}
#appShell #custom .colon{padding:0 0 22px;font-size:16px}
#appShell #custom #error{position:absolute;left:0;top:auto;bottom:100%;margin:0 0 6px;padding:6px 8px;border-radius:6px;background:#151515;z-index:7}
#appShell .appearance-controls{order:0;flex-basis:auto;display:flex;gap:8px;width:auto;margin:0;height:44px}
#appShell .appearance-controls>#palette,#appShell .appearance-controls>.sound-picker{width:44px;height:44px;flex-basis:44px;margin:0}
#appShell .appearance-controls #chooseSound{width:44px;height:44px;min-width:44px}
#appShell .setup{min-width:0}
#appShell .section-heading{margin:0 0 8px}
#appShell .section-heading h2{font-size:14px}
#appShell .presets{grid-template-columns:repeat(10,minmax(0,1fr));gap:8px}
#appShell .presets button{min-width:0;padding:11px 4px;font-size:21px;background:#090909}
#appShell .presets small{display:inline;font-size:10px}
#appShell footer{padding:0;font-size:9px;line-height:1.2;justify-content:flex-end}
#appShell .palette-menu,#appShell .sound-menu{background:#111;border-color:#303030;z-index:10}
@media(max-width:900px){
 #appShell .controls{grid-template-columns:minmax(0,1fr) auto;gap:10px}
 #appShell .timer-actions{grid-column:1;grid-row:1;justify-content:flex-start}
 #appShell .appearance-controls{grid-column:2;grid-row:1}
 #appShell #custom{grid-column:1/-1;grid-row:2}
 #appShell #custom .time-group{height:118px}
 #appShell .presets button{font-size:18px;padding:10px 3px}
}
@media(max-width:520px){
 #appShell>header{height:52px;padding:0 12px;gap:8px}
 #appShell .brand{font-size:13px;letter-spacing:1px;gap:5px;white-space:nowrap}
 #appShell .brand-icon{font-size:25px}
 #appShell .header-actions{gap:7px}
 #appShell .languages{gap:3px}
 #appShell .languages button{width:29px;height:28px;padding:2px}
 #appShell #fullscreen{width:30px;height:30px;padding:0;font-size:18px}
 #appShell #fullscreen span{display:none}
 #appShell>main{padding:10px 12px;gap:10px}
 #appShell .intro .eyebrow{font-size:7px;letter-spacing:1px}
 #appShell .intro h1{font-size:21px}
 #appShell .timer{padding:12px;gap:8px}
 #appShell .timer-top{font-size:9px}
 #appShell .timer-bottom{flex-direction:column;text-align:center;justify-content:center;gap:5px;font-size:8px}
 #appShell .timer-bottom #hint,#appShell .timer-bottom #totalLabel{width:100%;line-height:1.3}
 #appShell #custom{gap:6px;grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr) minmax(0,1.25fr)}
 #appShell #custom .time-group{height:112px;padding:7px 5px}
 #appShell #custom legend{font-size:10px;padding:0 3px}
 #appShell #custom .group-fields{gap:3px}
 #appShell #custom .step-field{width:calc(50% - 4px);max-width:48px}
 #appShell #custom .time-group:nth-of-type(2) .step-field{width:44px}
 #appShell #custom label{font-size:8px}
 #appShell #custom input{height:35px;font-size:16px}
 #appShell #custom .step-buttons{gap:2px}
 #appShell #custom .step-buttons button{width:calc(50% - 1px);height:24px;font-size:16px}
 #appShell #custom .colon{font-size:12px;padding-bottom:20px}
 #appShell .icon-button,#appShell .palette summary,#appShell .appearance-controls #chooseSound{width:40px;height:40px;min-width:40px}
 #appShell .appearance-controls,#appShell .appearance-controls>#palette,#appShell .appearance-controls>.sound-picker{height:40px}
 #appShell .appearance-controls>#palette,#appShell .appearance-controls>.sound-picker{width:40px;flex-basis:40px}
 #appShell .presets{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
 #appShell .presets button{font-size:16px;padding:7px 3px}
 #appShell .presets small{font-size:9px}
 #appShell .section-heading h2{font-size:12px}
 #appShell .section-heading{margin-bottom:6px}
}
@media(max-height:620px) and (min-width:521px){
 #appShell>header{height:44px}
 #appShell>main{padding-top:8px;padding-bottom:8px;gap:8px}
 #appShell .intro h1{font-size:23px}
 #appShell .intro .eyebrow{font-size:8px;margin-bottom:3px}
 #appShell #custom .time-group{height:108px;padding-top:6px;padding-bottom:6px}
 #appShell .controls{gap:8px}
 #appShell .timer{padding:10px 18px;gap:8px}
 #appShell .presets button{padding:8px 3px;font-size:18px}
 #appShell .section-heading{margin-bottom:5px}
}

/* Academy signature stays above the date in both clock and countdown views. */
#appShell .timer-bottom{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.75fr);align-items:end;gap:6px 12px;flex-direction:row;text-align:left}
#appShell .display-signature{grid-column:1;grid-row:1 / span 2;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:7px}
#appShell .display-logo{display:block;width:clamp(100.386px,13.689vh,173.394px);height:clamp(100.386px,13.689vh,173.394px);object-fit:contain;flex:none}
#appShell .timer-bottom #hint{width:100%;text-align:left;line-height:1.4}
#appShell .timer-bottom #totalLabel{grid-column:2;grid-row:1;width:auto;text-align:right;align-self:end;line-height:1.4}
#appShell .timer-bottom #returnTimer{grid-column:2;grid-row:2;justify-self:end;max-width:100%;text-align:right}
#appShell .timer{min-height:210px}

#appShell .timer-top{align-items:flex-start}
#appShell .timer-brand{display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-width:0}
#appShell #timerName:empty{display:none}
#appShell .display-signature{gap:0}

#appShell #custom{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) minmax(0,1.4fr) minmax(0,1.1fr)}
#appShell #custom .total-group .total-value{height:100%;display:flex;align-items:center;justify-content:center;min-width:0}
#appShell #trainingTotal{display:block;max-width:100%;padding:10px 5px;font-size:clamp(20.8px,2.21vw,33.8px);font-weight:600;color:var(--accent);font-variant-numeric:tabular-nums;letter-spacing:-.5px}
#appShell .timer{min-height:240px}
@media(max-width:700px){#appShell #custom{grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr) minmax(0,1.25fr)}#appShell #custom .total-group{grid-column:1/-1;height:56px;padding:4px 10px}#appShell #trainingTotal{padding:0;font-size:26px}}

/* Phase label sits directly above the progress bar. */
#appShell .timer{grid-template-rows:auto minmax(0,1fr) auto auto}
#appShell .progress-section{min-width:0;display:flex;flex-direction:column;gap:8px}
#appShell .progress-section #timerName{max-width:none;display:block;font-size:11px;letter-spacing:1.4px;line-height:1.3;overflow-wrap:normal}
#appShell .progress-section #timerName:empty{display:none}

/* Read-only fight and rest totals, stacked in the same panel. */
#appShell #custom .total-group .total-value{flex-direction:column;justify-content:center;gap:6px}
#appShell #custom .total-part{width:100%;min-width:0;display:flex;flex-direction:column;align-items:center;gap:2px}
#appShell #custom .total-part>span{font-size:9px;line-height:1.2;color:var(--muted)}
#appShell #trainingTotal,#appShell #trainingRestTotal{display:block;max-width:100%;padding:0;font-size:clamp(20.8px,2.21vw,33.8px);line-height:1.05;font-weight:600;color:var(--accent);font-variant-numeric:tabular-nums;letter-spacing:-.5px}
@media(max-width:700px){#appShell #custom .total-group{height:104px}#appShell #trainingTotal,#appShell #trainingRestTotal{font-size:26px}}

/* Center the clock independently of the academy logo and status text. */
#appShell .timer{position:relative;display:flex;flex-direction:column}
#appShell .timer-top,#appShell .timer-bottom,#appShell .progress-section{position:relative;z-index:1;flex:none}
#appShell .progress-section{margin-top:auto}
#appShell .digits{position:absolute;top:50%;left:24px;width:calc(100% - 48px);height:55%;transform:translateY(-50%);margin:0;pointer-events:none}
@media(max-width:700px){#appShell .timer{min-height:320px}}
@media(max-width:520px){#appShell .digits{left:12px;width:calc(100% - 24px)}}

/* Scale the academy logo with the viewport; center it on compact screens. */
#appShell .timer{--logo-size:min(13.689vh,9vw,173.394px)}
#appShell .display-logo{width:var(--logo-size);height:var(--logo-size)}
@media(max-width:900px){
 #appShell .timer{--logo-size:min(16vw,12vh,80px)}
 #appShell .timer-top{min-height:var(--logo-size);justify-content:flex-end}
 #appShell .timer-brand{position:absolute;top:0;left:50%;transform:translateX(-50%);align-items:center}
 #appShell #status{max-width:calc(50% - var(--logo-size)/2 - 10px);font-size:8px;line-height:1.3;letter-spacing:.5px}
}

/* Live device time is independent of the centered countdown and academy logo. */
#appShell #trainingClock{position:absolute;top:0;left:50%;transform:translateX(-50%);font-size:clamp(28px,4.2vw,59.5px);line-height:1.2;font-weight:600;font-variant-numeric:tabular-nums;color:var(--accent);white-space:nowrap;letter-spacing:1px}
#appShell #trainingClock[hidden]{display:none}
@media(max-width:900px){#appShell #trainingClock{left:0;transform:none;max-width:calc(50% - var(--logo-size)/2 - 6px);font-size:clamp(21px,4.2vw,38.5px);letter-spacing:0}}

/* Enlarge the main clock by 40% within the available display bounds. */
#appShell.clock-mode .digits{height:77%}
body.clock-mode #appShell .digits{height:77%}
#appShell .sound-menu .sound-option{grid-template-columns:minmax(0,1fr) 32px;gap:8px}

/* Fight and rest on the left; their configured sum on the right. */
#appShell #custom{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) minmax(0,1.4fr) minmax(0,1.7fr)}
#appShell #custom .total-group .total-value{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;align-items:center;container-type:inline-size}
#appShell .total-breakdown{display:flex;flex-direction:column;gap:6px;min-width:0}
#appShell #custom .total-combined{height:100%;justify-content:center;padding-left:10px}
#appShell #trainingTotal,#appShell #trainingRestTotal,#appShell #trainingCombinedTotal{display:block;max-width:100%;padding:0;font-size:clamp(12px,9cqi,33.8px);line-height:1.05;font-weight:600;color:var(--accent);font-variant-numeric:tabular-nums;letter-spacing:-.5px;white-space:nowrap}
@media(max-width:700px){#appShell #custom{grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr) minmax(0,1.25fr)}#appShell #custom .total-group{grid-column:1/-1}}

/* Reserve the same label row above every numeric field. */
#appShell #custom .group-fields{height:auto;align-items:flex-start;padding-top:3px}
#appShell #custom .step-field label{display:grid;grid-template-rows:12px auto;row-gap:4px;line-height:12px;align-items:start}
#appShell #custom .step-field label>input{grid-row:2}
#appShell #custom .step-field label>span:not(.sr-only){grid-row:1}
#appShell #custom .group-fields .colon{padding:28px 0 0;line-height:1}
/* Let the totals panel contain both rows at every viewport size. */
#appShell #custom .total-group{height:auto;min-height:104px;align-self:stretch;padding:8px 10px 10px}
#appShell #custom .total-group .total-value{height:auto;min-height:0;align-items:center}
#appShell #custom .total-breakdown{min-width:0;gap:6px}
#appShell #custom .total-part{min-width:0;gap:3px}
#appShell #custom .total-part>span{font-size:9px;line-height:1.2;overflow-wrap:anywhere;text-align:center}
#appShell #custom .total-combined{padding-left:0}
#appShell #trainingTotal,#appShell #trainingRestTotal,#appShell #trainingCombinedTotal{font-size:clamp(10px,8.4cqi,33.8px);line-height:1.05;letter-spacing:-.5px}
@media(max-width:520px){#appShell #custom .step-field label{grid-template-rows:10px auto;line-height:10px}#appShell #custom .group-fields .colon{padding-top:23px}}

#appShell footer{justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
#appShell footer .producer-credit{text-align:left;margin-right:auto;letter-spacing:1px}
#appShell footer .producer-credit a{color:inherit;text-decoration:none}
#appShell footer .producer-credit a:hover{text-decoration:underline}

/* A persistent pause signal inside the panel leaves remaining time visible. */
#appShell .pause-indicator{position:absolute;z-index:2;top:72%;left:12px;width:calc(100% - 24px);text-align:center;font-size:clamp(16px,2.5vw,36px);line-height:1.2;font-weight:700;letter-spacing:.12em;color:var(--accent);pointer-events:none;animation:paused-signal 1.2s ease-in-out infinite}
@keyframes paused-signal{0%,100%{opacity:1}50%{opacity:.15}}
@media(prefers-reduced-motion:reduce){#appShell .pause-indicator{animation:none}}

/* All panels stretch to the tallest panel in their grid row. */
#appShell #custom .time-group{height:auto;min-height:128px;align-self:stretch}
@media(max-width:900px){#appShell #custom .time-group{min-height:118px}}
@media(max-width:520px){#appShell #custom .time-group{min-height:112px}}
@media(max-height:620px) and (min-width:521px){#appShell #custom .time-group{min-height:108px}}
/* Center the pause signal in the gap below the countdown. */
#appShell .pause-indicator{top:82%;transform:translateY(-50%)}
