/* =========================================================================
   Timer editor - borderless light theme matched to rija.io
   ========================================================================= */
:root{
  --te-bg:#F1F4F3;
  --te-surface:#FFFFFF;
  --te-soft:#EDF1EF;
  --te-text:#101513;
  --te-muted:#6E7A75;
  --te-ink:#00272C;        /* button background */
  --te-on-ink:#FFFFFF;
  --te-tint:#DFEAE5;
  --te-footer:#F1F4F3;
  --te-footer-text:#6E7A75;
  --te-radius:14px;
  --te-rail:270px;
}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--te-bg);color:var(--te-text);
  font-family:'Inter',system-ui,-apple-system,"Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;
  display:flex;flex-direction:column;min-height:100vh;
}
@media (min-width:1181px){
  html,body{height:100%;overflow:hidden}   /* everything fits one screen */
}
:is(button,select,input,a,[tabindex]):focus-visible{outline:2px solid var(--te-text);outline-offset:2px}

/* ---- top bar ---- */
.te-topbar{display:flex;align-items:center;gap:12px;padding:10px 20px 4px;max-width:1560px;width:100%;margin:0 auto;flex:none}
.te-heading{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.te-heading h1{margin:0;font-size:19px;font-weight:600;letter-spacing:-.01em;line-height:1.2}
.te-heading p{margin:0;font-size:12px;color:var(--te-muted)}
.te-back{width:34px;height:34px}
.te-back{
  display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;
  border-radius:50%;background:var(--te-surface);color:var(--te-text);text-decoration:none;
  transition:background .15s ease;
}
.te-back:hover{background:var(--te-tint)}
.te-back svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

/* ---- layout ---- */
.te-app{
  flex:1;min-height:0;display:grid;
  grid-template-columns:var(--te-rail) minmax(0,1fr) var(--te-rail);
  gap:14px;align-items:stretch;padding:10px 20px 14px;max-width:1560px;width:100%;margin:0 auto;
}
.te-rail{
  display:flex;flex-direction:column;gap:12px;min-height:0;overflow-y:auto;
  scrollbar-gutter:stable;            /* reserve the track so panels never resize */
  scrollbar-width:thin;scrollbar-color:#C8D2CE transparent;
}
@supports not (scrollbar-gutter: stable){ .te-rail{padding-right:6px} }
.te-rail::-webkit-scrollbar{width:6px}
.te-rail::-webkit-scrollbar-thumb{background:#C8D2CE;border-radius:99px}
.te-panel{background:var(--te-surface);border-radius:var(--te-radius);padding:13px 14px;flex:none}
.te-panel__head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.te-panel__title{margin:0;font-size:11px;font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--te-muted)}
.te-panel__body{display:flex;flex-direction:column;gap:8px}
.te-hint{margin:0;font-size:12px;line-height:1.5;color:var(--te-muted)}
.te-sub{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--te-muted)}

/* ---- controls (borderless) ---- */
.te-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  padding:10px 16px;border:0;border-radius:999px;background:var(--te-soft);color:var(--te-text);
  font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background .15s ease;
}
.te-btn:hover{background:var(--te-tint)}
.te-btn--ink{background:var(--te-ink);color:var(--te-on-ink);font-weight:600}
.te-btn--ink:hover{background:#013C44}
.te-btn--block{width:100%}
.te-btn--quiet{background:transparent;color:var(--te-muted)}
.te-btn--quiet:hover{background:var(--te-soft);color:var(--te-text)}

.te-icon-btn{
  display:inline-flex;align-items:center;justify-content:center;width:30px;height:26px;padding:0;
  border:0;border-radius:8px;background:var(--te-soft);color:var(--te-text);cursor:pointer;transition:background .15s ease;
}
.te-icon-btn:hover{background:var(--te-tint)}
.te-icon-btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

.te-select,.te-input{
  width:100%;padding:10px 12px;border:0;border-radius:10px;background:var(--te-soft);
  color:var(--te-text);font:inherit;font-size:13px;
}
.te-select{
  padding-right:32px;appearance:none;cursor:pointer;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E7A75' stroke-width='2.4' stroke-linecap='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat:no-repeat;background-position:right 10px center;background-size:14px;
}
.te-field{display:flex;flex-direction:column;gap:6px}

/* ---- colours ---- */
.te-color-row{display:flex;align-items:center;gap:8px}
.te-swatch{
  position:relative;flex:1;height:44px;border-radius:10px;display:flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:600;cursor:pointer;color:#101513;box-shadow:inset 0 0 0 1px rgba(16,21,19,.08);
}
.te-swatch[data-dark="1"]{color:#fff}
.te-swatch input[type="color"]{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer;border:0;padding:0}
.te-chevrons{display:flex;flex-direction:column;gap:5px}
.te-dots{display:flex;flex-wrap:wrap;gap:6px}
.te-dot{width:20px;height:20px;border-radius:50%;border:0;cursor:pointer;padding:0;box-shadow:inset 0 0 0 1px rgba(16,21,19,.12)}
.te-dot[aria-pressed="true"]{box-shadow:inset 0 0 0 1px rgba(16,21,19,.12),0 0 0 2px var(--te-surface),0 0 0 4px var(--te-text)}

/* ---- font picker ---- */
.te-fontpicker{position:relative}
.te-fontbtn{
  width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;
  padding:10px 12px;border:0;border-radius:10px;background:var(--te-soft);color:var(--te-text);
  font:inherit;font-size:14px;cursor:pointer;text-align:left;
}
.te-fontbtn svg{width:14px;height:14px;flex:none;fill:none;stroke:var(--te-muted);stroke-width:2.4;stroke-linecap:round}
.te-fontpanel{
  position:fixed;z-index:60;                    /* fixed, so the rail's overflow can't clip it */
  background:var(--te-surface);border-radius:12px;box-shadow:0 14px 38px rgba(16,21,19,.20);
  padding:10px;display:flex;flex-direction:column;gap:8px;
}
.te-fontpanel[hidden]{display:none}
.te-fontlist{max-height:260px;overflow-y:auto;scrollbar-gutter:stable;display:flex;flex-direction:column;gap:2px;overscroll-behavior:contain}
.te-fontitem{
  padding:8px 10px;border:0;border-radius:8px;background:transparent;color:var(--te-text);
  font-size:17px;line-height:1.25;text-align:left;cursor:pointer;width:100%;
}
.te-fontitem:hover{background:var(--te-soft)}
.te-fontitem[aria-selected="true"]{background:var(--te-tint)}
.te-fontitem small{display:block;font:400 10px/1.4 'Inter',sans-serif;letter-spacing:.08em;text-transform:uppercase;color:var(--te-muted)}

/* ---- canvas column ---- */
.te-stagewrap{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0}
.te-toolbar{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:wrap}
.te-toolbar__group{display:flex;align-items:center;gap:8px}
.te-tag{font-size:12px;color:var(--te-muted);letter-spacing:.06em}

.te-stagebox{flex:1;min-height:0;display:flex;align-items:stretch;justify-content:center}
.te-stage{
  position:relative;height:100%;width:auto;max-width:100%;aspect-ratio:16/9;
  background:#fff;border-radius:var(--te-radius);overflow:hidden;display:grid;place-items:center;
  container-type:size;   /* lets the timer scale to the canvas, not the viewport */
}
.te-stage:fullscreen{height:100vh;width:100vw;border-radius:0;aspect-ratio:auto;max-width:none}
.te-stage:fullscreen .te-clip__handle{display:none}
.te-stage.is-dropping{outline:2px dashed var(--te-text);outline-offset:-10px}

.te-timer{
  position:relative;z-index:2;display:flex;align-items:center;justify-content:center;
  gap:.1em;user-select:none;line-height:1;
  pointer-events:none;      /* clicks pass through to clipart sitting behind it */
  font-size:clamp(34px,7vw,96px);            /* fallback for old browsers */
  max-width:100%;
}
@supports (container-type:size){
  .te-timer{font-size:min(19cqw, 38cqh)}     /* fits portrait and landscape alike */
}
.te-seg{
  min-width:1.32em;padding:.1em .06em;text-align:center;
  font-size:1em;line-height:1;font-variant-numeric:tabular-nums;
}
.te-colon{font-size:.68em;line-height:1;opacity:.35}

/* ---- clipart ---- */
.te-clip{position:absolute;transform:translate(-50%,-50%);transform-origin:center;cursor:grab;touch-action:none;z-index:1;pointer-events:auto}
.te-clip[data-layer="front"]{z-index:3}
.te-clip[hidden]{display:none}
.te-clip img{display:block;width:100%;height:auto;pointer-events:none;border-radius:2px}
.te-frame{position:absolute;inset:-3px;opacity:0;pointer-events:none;transition:opacity .12s ease}
.te-clip.is-selected .te-frame{opacity:1}
.te-frame::before{content:"";position:absolute;inset:0;border:1.5px solid var(--te-ink);border-radius:4px}
.te-frame i{
  position:absolute;width:11px;height:11px;border-radius:50%;background:#fff;
  border:1.5px solid var(--te-ink);pointer-events:auto;
}
.te-frame i[data-h="nw"]{left:-6px;top:-6px;cursor:nwse-resize}
.te-frame i[data-h="ne"]{right:-6px;top:-6px;cursor:nesw-resize}
.te-frame i[data-h="se"]{right:-6px;bottom:-6px;cursor:nwse-resize}
.te-frame i[data-h="sw"]{left:-6px;bottom:-6px;cursor:nesw-resize}
.te-cb-rotgrip{
  display:inline-flex;align-items:center;gap:4px;flex:none;padding:4px 7px 4px 5px;
  border:0;border-radius:999px;background:transparent;color:var(--te-text);
  font:inherit;cursor:grab;touch-action:none;transition:background .14s ease;
}
.te-cb-rotgrip:hover{background:var(--te-soft)}
.te-cb-rotgrip.is-turning{background:var(--te-tint);cursor:grabbing}
.te-cb-rotgrip svg{width:14px;height:14px;flex:none;fill:none;stroke:var(--te-muted);stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.te-cb-rotgrip.is-turning svg,.te-cb-rot.is-turned{stroke:var(--te-text)}
.te-clip.is-dragging{cursor:grabbing}
.te-clipbar{
  position:absolute;left:0;top:0;z-index:8;transform:translate(-50%,-100%);
  display:flex;align-items:center;gap:5px;padding:5px 7px;
  background:rgba(255,255,255,.96);backdrop-filter:blur(8px);
  border-radius:999px;box-shadow:0 6px 22px rgba(16,21,19,.18);
  white-space:nowrap;pointer-events:auto;max-width:96%;overflow:hidden;
  transition:opacity .12s ease;
}
.te-clipbar[data-placed="0"]{opacity:0}
.te-cb-btn{
  display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex:none;
  border:0;border-radius:50%;background:transparent;color:var(--te-text);cursor:pointer;transition:background .14s ease;
}
.te-cb-btn:hover{background:var(--te-soft)}
.te-cb-btn svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.te-cb-btn--danger:hover{background:#FBE6E4;color:#C0392B}

.te-cb-sep{width:1px;height:16px;background:#E0E6E3;flex:none;margin:0 2px}
.te-cb-size{
  min-width:38px;text-align:center;font-size:11px;font-weight:600;color:var(--te-text);
  font-variant-numeric:tabular-nums;flex:none;cursor:default;
}
.te-cb-rot{min-width:32px;text-align:center;font-size:11px;font-weight:600;color:var(--te-muted);font-variant-numeric:tabular-nums}
.te-cb-rot.is-turned{color:var(--te-text)}

.te-cb-times{display:inline-flex;align-items:center;gap:4px;flex:none}
.te-cb-times input{
  width:52px;padding:5px 4px;border:0;border-radius:7px;background:var(--te-soft);
  font:inherit;font-size:12px;text-align:center;font-variant-numeric:tabular-nums;color:var(--te-text);
}
.te-cb-times input:disabled{opacity:.35}
.te-cb-arrow{width:13px;height:13px;fill:none;stroke:#9AA6A1;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

.te-cb-note{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.te-clipbar[hidden]{display:none}
.te-clipbar__name{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--te-muted);padding-right:2px}

/* ---- gif browser ---- */
.te-gifgrid{
  display:grid;grid-template-columns:repeat(3,1fr);gap:6px;
  max-height:142px;overflow-y:auto;scrollbar-gutter:stable;align-content:start;
  scrollbar-width:thin;scrollbar-color:#C8D2CE transparent;
}
.te-gifgrid::-webkit-scrollbar{width:6px}
.te-gifgrid::-webkit-scrollbar-thumb{background:#C8D2CE;border-radius:99px}
.te-giftile{
  position:relative;display:block;height:62px;border-radius:9px;overflow:hidden;cursor:grab;
  background:var(--te-soft);border:0;padding:0;
}
.te-giftile img{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}
.te-giftile:hover{outline:2px solid var(--te-text);outline-offset:-2px}
.te-gifend{height:1px}
.te-gifmsg{grid-column:1/-1;font-size:12px;color:var(--te-muted);padding:8px 2px}

/* ---- timeline ---- */
.te-switch{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--te-muted);cursor:pointer;margin-right:auto}
.te-switch input{accent-color:#101513;width:14px;height:14px;margin:0}
.te-tltimes{display:flex;align-items:center;gap:6px}
.te-tltimes input{
  width:100%;padding:5px 6px;border:0;border-radius:7px;background:var(--te-surface);
  font:inherit;font-size:12px;text-align:center;font-variant-numeric:tabular-nums;color:var(--te-text);
}
.te-tltimes input:disabled{opacity:.4}
.te-tltimes span{font-size:11px;color:var(--te-muted)}
.te-tlbar{display:block;position:relative;height:5px;border-radius:99px;background:#D8E0DC;overflow:hidden}
.te-tlbar i{position:absolute;top:0;bottom:0;background:var(--te-text);border-radius:99px}
.te-tlnote{font-size:11px;color:var(--te-muted);line-height:1.35}

/* ---- export ---- */
/* ---- export ---- */
.te-export{display:flex;flex-direction:column;gap:8px;padding:12px}
.te-export__row{display:flex;gap:8px}
.te-pick{flex:1;min-width:0;position:relative}
.te-pick__btn{
  width:100%;display:flex;align-items:center;gap:6px;padding:9px 9px;border:0;border-radius:10px;
  background:var(--te-soft);color:var(--te-text);font:inherit;font-size:13px;cursor:pointer;text-align:left;
  transition:background .14s ease;
}
.te-pick__btn:hover{background:var(--te-tint)}
.te-pick__ico{width:14px;height:14px;flex:none;fill:none;stroke:var(--te-muted);stroke-width:1.8;stroke-linejoin:round}
.te-pick__val{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.te-pick__chev{width:13px;height:13px;flex:none;fill:none;stroke:var(--te-muted);stroke-width:2.4;stroke-linecap:round;transition:rotate .16s ease}
.te-pick__btn[aria-expanded="true"] .te-pick__chev{rotate:180deg}
.te-pick__btn[aria-expanded="true"]{background:var(--te-tint)}

.te-pick__menu{
  position:fixed;z-index:60;min-width:150px;padding:5px;
  background:var(--te-surface);border-radius:12px;box-shadow:0 14px 38px rgba(16,21,19,.20);
  display:flex;flex-direction:column;gap:1px;max-height:260px;overflow-y:auto;overscroll-behavior:contain;
}
.te-pick__menu[hidden]{display:none}
.te-pick__opt{
  display:flex;align-items:center;gap:9px;width:100%;padding:8px 9px;border:0;border-radius:8px;
  background:transparent;color:var(--te-text);font:inherit;font-size:13px;cursor:pointer;text-align:left;
}
.te-pick__opt:hover{background:var(--te-soft)}
.te-pick__opt[aria-selected="true"]{background:var(--te-tint);font-weight:600}
.te-pick__label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.te-pick__meta{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--te-muted)}
.te-pick__box{flex:none;border:1.5px solid var(--te-muted);border-radius:2px}
.te-pick__box--dash{width:20px;height:14px;border-style:dashed}
.te-export__go{gap:8px;padding:10px 14px}
.te-export__go svg{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.te-export__go b{
  margin-left:auto;font-weight:500;font-size:11px;opacity:.62;font-variant-numeric:tabular-nums;
  white-space:nowrap;
}
.te-custom{display:flex;align-items:center;gap:8px}
.te-custom[hidden]{display:none}
.te-custom .te-input{text-align:center}

/* ---- music ---- */
.te-tracks{display:flex;flex-direction:column;gap:5px}
.te-track{display:flex;align-items:center;gap:10px;padding:7px 11px;border:0;border-radius:10px;background:var(--te-soft);cursor:pointer;font:inherit;font-size:13px;color:var(--te-text)}
.te-track[aria-pressed="true"]{background:var(--te-tint);font-weight:600}
.te-track__dot{width:8px;height:8px;border-radius:50%;background:#C8D2CE;flex:none}
.te-track__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.te-track[aria-pressed="true"] .te-track__dot{background:var(--te-text)}
.te-file{position:relative;overflow:hidden}
.te-file input[type="file"]{position:absolute;inset:0;opacity:0;cursor:pointer;font-size:200px}

/* ---- toast ---- */
/* ---- toasts (ported from the Vue notification component) ---- */
.toast-wrapper{
  position:fixed;bottom:30px;left:0;right:0;
  display:flex;justify-content:center;z-index:10000;pointer-events:none;
}
.notification{
  position:relative;display:flex;align-items:center;gap:10px;padding:10px 14px;
  border-radius:6px;font-size:13px;font-weight:400;line-height:1.4;
  box-shadow:0 4px 24px rgba(0,0,0,.2);
  min-width:250px;max-width:480px;pointer-events:auto;overflow:hidden;
}
.notification.success{background:#16a34a;color:#fff}
.notification.error{background:#dc2626;color:#fff}
.notification.info{background:#2563eb;color:#fff}
.notification.upload{background:#1f2937;color:#fff}

.progress-sweep{
  position:absolute;top:0;left:0;bottom:0;background:rgba(0,0,0,.15);
  pointer-events:none;transition:width .03s linear;
}
.notification-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative;z-index:1}
.notification-icon svg{display:block}
.notification-icon .spinner{animation:te-spin 1s linear infinite}
@keyframes te-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}

.notification-content{flex:1;display:flex;flex-direction:column;gap:6px;position:relative;z-index:1;min-width:0}
.notification-text{line-height:1.4}

.upload-progress{display:flex;align-items:center;gap:10px}
.upload-progress-bar{flex:1;height:4px;background:rgba(255,255,255,.2);border-radius:2px;overflow:hidden}
.upload-progress-fill{height:100%;background:#4ade80;border-radius:2px;transition:width .15s ease}
.upload-progress-text{font-size:12px;color:rgba(255,255,255,.8);min-width:36px;text-align:right}

.notification-close{
  background:rgba(0,0,0,.12);border:0;color:inherit;font-size:13px;font-weight:400;cursor:pointer;
  padding:6px 12px;margin-left:8px;border-radius:4px;transition:background .15s ease;position:relative;z-index:1;
}
.notification-close:hover{background:rgba(0,0,0,.2)}

.notification.slide-in{animation:te-slideIn .3s ease forwards}
.notification.slide-out{animation:te-slideOut .3s ease forwards}
@keyframes te-slideIn{from{transform:translateY(80px);opacity:0}to{transform:translateY(0);opacity:1}}
@keyframes te-slideOut{from{transform:translateY(0);opacity:1}to{transform:translateY(80px);opacity:0}}

/* ---- footer ---- */
.te-footer{background:var(--te-footer);color:var(--te-footer-text);margin-top:auto;flex:none;box-shadow:inset 0 1px 0 #E2E7E5}
.container{max-width:1600px;margin:0 auto;padding-inline:32px}
.footer-base{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;padding-block:14px;font-size:13px}
.footer-legal{display:flex;gap:26px}
.footer-legal a{color:var(--te-text);text-decoration:none;font-size:13px}
.footer-legal a:hover{color:var(--te-text);text-decoration:underline}

/* ---- locked while the timer runs ---- */
.te-rail.is-locked{opacity:.5;pointer-events:none;filter:saturate(.6)}
.te-lockmsg{
  display:none;align-items:center;gap:6px;font-size:12px;color:var(--te-muted);
  padding:0 2px;
}
body.is-running .te-lockmsg{display:flex}

/* ---- responsive ---- */
@media (max-width:1180px){
  .te-topbar{flex-wrap:wrap}
  .te-toolbar{margin-left:0;width:100%}
  .te-app{grid-template-columns:1fr;padding:12px 14px 32px;height:auto}
  .te-rail{flex-direction:row;flex-wrap:wrap;overflow:visible}
  .te-stagebox{min-height:52vh}
  .te-stage{height:52vh}
  .te-rail .te-panel{flex:1 1 300px}
  .te-stagewrap{order:-1;position:static}
}
@media (max-width:640px){
  .te-topbar{padding:12px 14px 0;gap:10px}
  .te-heading h1{font-size:18px}
  .te-heading p{display:none}
  .te-rail .te-panel{flex:1 1 100%}
  .te-gifgrid{grid-template-columns:repeat(4,1fr)}
  .container{padding-inline:18px}
  .footer-base{justify-content:flex-start}
}
@media (prefers-reduced-motion:reduce){ *{transition-duration:.01ms !important} }