@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:wght@400;500&display=swap');

:root { color-scheme:dark; font-family:'DM Mono',monospace; color:#fff; background:#1a0040; }
* { box-sizing:border-box; }
body { margin:0; min-width:280px; min-height:100svh; background:linear-gradient(#1a00402e,#100020a6),url('portal-background.png') center/cover fixed; }
button { -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
button { font:inherit; cursor:pointer; }
button:disabled { cursor:default; }
:focus-visible { outline:3px solid #ffe0a7; outline-offset:5px; }
.timer-shell { width:min(720px,100%); min-height:100svh; margin:auto; padding:max(12px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); display:flex; flex-direction:column; }
main { width:100%; margin:auto 0; padding:12px 0 16px; }
.stopwatch-layout { display:grid; gap:24px; }
.clock-panel { display:flex; align-items:center; justify-content:center; min-height:clamp(180px,30svh,260px); text-align:center; padding:clamp(26px,6svh,48px) 8px; border:1.5px solid #e9b4ff55; border-radius:26px; background:linear-gradient(140deg,#321050eb,#19052ff2); box-shadow:0 18px 50px #0b001950,inset 0 1px #ffffff0d; }
#timer-display { display:flex; justify-content:center; align-items:baseline; white-space:nowrap; font-variant-numeric:tabular-nums; font-weight:500; line-height:1.1; letter-spacing:-.065em; font-size:clamp(3.2rem,16.5vw,7rem); }
#timer-fraction { font-size:.45em; letter-spacing:-.045em; color:#ffbd80; margin-left:.1em; }
.has-hours #timer-display { font-size:clamp(2.1rem,11.8vw,5.8rem); }
.timer-controls { display:grid; gap:14px; }
#timer-toggle { width:100%; min-height:clamp(124px,21svh,170px); border:2px solid #ffbc8566; border-radius:24px; background:linear-gradient(115deg,#ad410a 0%,#b03a59 50%,#8622a6 100%); color:#fff; box-shadow:0 12px 28px #10002145,inset 0 1px #ffffff35; font:400 clamp(3.6rem,14vw,5.4rem)/1 'Bebas Neue','Arial Narrow',sans-serif; letter-spacing:.055em; }
#timer-toggle:active { transform:translateY(2px); box-shadow:0 4px 12px #10002145; }
#timer-reset { min-height:58px; border:1px solid #e3b6fc66; border-radius:17px; color:#f8e9ff; background:#23063d9c; font-size:1rem; }
#timer-reset:disabled { color:#ba9dcb; border-color:#ffffff1a; background:#23063d60; }
#timer-reset:not(:disabled):hover { border-color:#ffbd80; background:#4e176d; }
.is-running .clock-panel { border-color:#ffbc85b0; }
.is-running #timer-toggle { background:linear-gradient(115deg,#b02b3c,#902458); border-color:#ffa3ab9e; }
.no-script { margin-top:20px; line-height:1.6; }
.sr-only { position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width:600px) and (orientation:portrait) {
  .timer-shell { height:100svh; padding:max(12px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); }
  main { flex:1; min-height:0; margin:0; padding:0; display:flex; flex-direction:column; }
  .stopwatch-layout { flex:1; min-height:0; grid-template-rows:clamp(108px,20svh,164px) minmax(200px,1fr); gap:12px; }
  .clock-panel { min-height:0; padding:12px 8px; border-radius:22px; }
  .timer-controls { min-height:0; grid-template-rows:minmax(0,1fr) 52px; gap:12px; }
  #timer-toggle { min-height:0; font-size:clamp(4rem,22vw,7rem); border-radius:26px; }
  #timer-reset { min-height:52px; }
}
@media (orientation:landscape) and (max-height:560px) {
  .timer-shell { width:min(1100px,100%); height:100svh; padding-top:max(8px,env(safe-area-inset-top)); padding-bottom:max(12px,env(safe-area-inset-bottom)); }
  main { flex:1; min-height:0; margin:0; padding:0; display:flex; flex-direction:column; }
  .stopwatch-layout { flex:1; min-height:0; grid-template-columns:minmax(0,1fr) minmax(0,1.9fr); align-items:stretch; gap:16px; }
  .clock-panel { display:flex; flex-direction:column; justify-content:center; padding:20px 6px; }
  #timer-display { font-size:clamp(2.7rem,7vw,5.2rem); }
  .has-hours #timer-display { font-size:clamp(1.9rem,5vw,3.7rem); }
  .timer-controls { min-height:0; grid-template-rows:minmax(112px,1fr) 48px; gap:12px; }
  #timer-toggle { min-height:112px; font-size:clamp(4rem,10vw,6rem); }
  #timer-reset { min-height:48px; }
}
