/* Streak - Telegram Mini App. iOS-native visual language:
   grouped insets, large titles, SF system type, soft depth, spring motion. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter",
          system-ui, "Segoe UI", Roboto, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* light */
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card-2: #F2F2F7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.72);
  --label-3: rgba(60, 60, 67, 0.45);
  --sep: rgba(60, 60, 67, 0.14);
  --accent: #E8490F;          /* Cliptica Broadcast Orange: fills, ring */
  --accent-2: #FF7A4D;
  --accent-text: #C23A08;     /* 5.1:1 on white */
  --accent-wash: rgba(232, 73, 15, 0.1);
  --green: #1F8A55;           /* text-safe on white */
  --green-fill: #33B87A;
  --green-wash: rgba(51, 184, 122, 0.14);
  --red: #D70015;
  --red-wash: rgba(255, 59, 48, 0.12);
  --blue: #0A63D6;
  --blue-wash: rgba(10, 132, 255, 0.12);
  --ring-track: rgba(232, 73, 15, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 -8px 40px rgba(0, 0, 0, 0.18);
  --bar: rgba(249, 249, 249, 0.82);
  --scrim: rgba(0, 0, 0, 0.42);

  --r-card: 20px;
  --r-row: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 260ms;
  --gutter: 16px;
  --safe-top: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --content-top: var(--tg-content-safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1C1C1E;
  --card-2: #2C2C2E;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.36);
  --label: #FFFFFF;
  --label-2: rgba(235, 235, 245, 0.7);
  --label-3: rgba(235, 235, 245, 0.42);
  --sep: rgba(84, 84, 88, 0.6);
  --accent: #FF5A1F;
  --accent-2: #FF8A5C;
  --accent-text: #FF8A5C;     /* 7:1 on #1C1C1E */
  --accent-wash: rgba(255, 90, 31, 0.16);
  --green: #4ADE95;
  --green-fill: #34C77B;
  --green-wash: rgba(52, 199, 123, 0.18);
  --red: #FF6961;
  --red-wash: rgba(255, 69, 58, 0.18);
  --blue: #64B5FF;
  --blue-wash: rgba(10, 132, 255, 0.2);
  --ring-track: rgba(255, 90, 31, 0.2);
  --shadow: none;
  --shadow-lg: 0 -8px 40px rgba(0, 0, 0, 0.6);
  --bar: rgba(22, 22, 24, 0.78);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
textarea, input { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.xs { width: 13px; height: 13px; stroke-width: 2.6; }
svg.brand { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* ---------------------------------------------------------------- layout */
#app { padding: calc(var(--safe-top) + var(--content-top) + 8px) 0
                calc(var(--safe-bottom) + 96px); max-width: 640px; margin: 0 auto; }
.view { padding: 0 var(--gutter); animation: viewIn 360ms var(--ease-out) both; }
.view[hidden] { display: none; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.large-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
               padding: 8px 4px 14px; }
.large-title h1 { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
.large-title .sub { color: var(--label-2); font-size: 15px; margin-top: 4px; }
.eyebrow { color: var(--label-2); font-size: 13px; font-weight: 600; text-transform: uppercase;
           letter-spacing: 0.04em; margin: 26px 4px 8px; }

.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow);
        padding: 18px; }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }

/* ---------------------------------------------------------------- hero ring */
.hero { display: flex; flex-direction: column; align-items: center; padding: 26px 18px 22px; }
.ring { position: relative; width: 216px; height: 216px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring .track { stroke: var(--ring-track); }
.ring .prog { transition: stroke-dashoffset 1100ms var(--ease-out); filter: drop-shadow(0 0 6px rgba(232, 73, 15, 0.28)); }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column;
                align-items: center; justify-content: center; }
.ring .flame { color: var(--accent); margin-bottom: 2px; }
.ring .flame svg { width: 28px; height: 28px; stroke: var(--accent); stroke-width: 2.2; fill: none; }
.ring .count { font-family: var(--font-round); font-size: 64px; line-height: 1; font-weight: 700;
               letter-spacing: -0.04em; }
.ring .unit { color: var(--label-2); font-size: 15px; font-weight: 500; margin-top: 4px; }
.hero .meta { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
        border-radius: 999px; background: var(--fill); color: var(--label-2); font-size: 14px;
        font-weight: 500; white-space: nowrap; }
.chip.accent { background: var(--accent-wash); color: var(--accent-text); }

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 18px; padding: 14px 12px 12px; box-shadow: var(--shadow);
        min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.tile .k { color: var(--label-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.tile .v { font-family: var(--font-round); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.tile .f { color: var(--label-3); font-size: 12px; font-weight: 500; }
.tile.warn .v { color: var(--red); }
.tile.ok .k svg { color: var(--green-fill); }
.flakes { display: flex; gap: 4px; margin-top: 4px; }
.flakes svg { width: 24px; height: 24px; color: var(--blue); }
.flakes svg.off { color: var(--fill-2); }

/* ---------------------------------------------------------------- post card */
.post { display: flex; gap: 14px; }
.thumb { position: relative; display: block; width: 78px; aspect-ratio: 9 / 16; flex: none; border-radius: 12px;
         overflow: hidden; background: var(--fill); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
               background: linear-gradient(transparent 55%, rgba(0, 0, 0, 0.35)); }
.thumb .play svg { width: 26px; height: 26px; fill: rgba(255, 255, 255, 0.95); stroke: none;
                   filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.4)); }
.post .body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.post .when { color: var(--accent-text); font-size: 13px; font-weight: 600; display: flex;
              align-items: center; gap: 5px; }
.post .title { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 4px 0 10px;
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.plats { display: flex; flex-direction: column; gap: 7px; margin-top: auto; }
.plat { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.plat .name { flex: 1; }
.plat a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px;
          border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status.pending { background: var(--fill); color: var(--label-2); }
.status.success, .status.manual { background: var(--green-wash); color: var(--green); }
.status.failed { background: var(--red-wash); color: var(--red); }
.status.retry { background: var(--accent-wash); color: var(--accent-text); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.btn { height: 50px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
       gap: 8px; font-size: 17px; font-weight: 600; background: var(--fill); color: var(--label);
       transition: transform 160ms var(--ease), opacity 160ms var(--ease), background 200ms; touch-action: manipulation; }
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.tinted { background: var(--accent-wash); color: var(--accent-text); }
.btn.danger { background: var(--red-wash); color: var(--red); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn:focus-visible, .tab:focus-visible, .row:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; display: inline-grid; place-items: center;
            background: var(--fill); color: var(--label); transition: transform 160ms var(--ease); }
.icon-btn:active { transform: scale(0.92); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-card); }
.banner.red { background: var(--red-wash); color: var(--label); }
.banner.red svg { color: var(--red); }
.banner.green { background: var(--green-wash); }
.banner.green svg { color: var(--green-fill); }
.banner b { display: block; font-size: 16px; margin-bottom: 2px; }
.banner p { margin: 0; color: var(--label-2); font-size: 15px; }

/* ---------------------------------------------------------------- queue list */
.list { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px;
       height: 92px; background: var(--card); transition: transform 220ms var(--ease), box-shadow 220ms, background 200ms;
       touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 104px; right: 0; height: 0.5px; background: var(--sep); }
.row:active { background: var(--card-2); }
.row .idx { width: 22px; text-align: center; color: var(--label-3); font-size: 15px; font-weight: 600; }
.row .thumb { width: 42px; border-radius: 8px; }
.row .txt { flex: 1; min-width: 0; }
.row .t { font-size: 16px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
          -webkit-box-orient: vertical; overflow: hidden; }
.row .s { color: var(--label-2); font-size: 13.5px; margin-top: 3px; display: flex; gap: 8px; align-items: center;
          flex-wrap: nowrap; white-space: nowrap; overflow: hidden; min-width: 0; }
.row .s .tag { min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; }
.row.tall .s { white-space: normal; }
.row .day { color: var(--accent-text); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px;
       background: var(--fill); color: var(--label-2); font-size: 12px; font-weight: 600; }
.handle { width: 44px; height: 60px; display: grid; place-items: center; color: var(--label-3); touch-action: none; cursor: grab; }
.row.dragging { z-index: 5; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22); transform: scale(1.02); transition: box-shadow 220ms, transform 0ms; border-radius: 14px; }
.row.dragging::before { display: none; }
.list.sorting .row:not(.dragging) { transition: transform 220ms var(--ease); }

.skeleton { position: relative; overflow: hidden; background: var(--fill); border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
                   background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
                   animation: shimmer 1.4s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty { text-align: center; padding: 48px 24px; color: var(--label-2); }
.empty .big { width: 64px; height: 64px; border-radius: 32px; display: grid; place-items: center;
              margin: 0 auto 14px; background: var(--accent-wash); color: var(--accent); }
.empty b { display: block; color: var(--label); font-size: 20px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head .m { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cal-head .nav { display: flex; gap: 8px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 0; }
.cal .wd { text-align: center; color: var(--label-3); font-size: 12px; font-weight: 600; padding-bottom: 4px; }
.cal .d { display: grid; place-items: center; height: 42px; }
.dot { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
       font-size: 14px; font-weight: 600; color: var(--label-3); }
.dot.complete { background: conic-gradient(var(--accent-2), var(--accent)); color: #fff; }
.dot.complete::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.dot.complete span { position: relative; z-index: 1; color: var(--label); }
.dot.frozen { background: var(--blue-wash); color: var(--blue); }
.dot.missed { background: var(--red-wash); color: var(--red); }
.dot.open { box-shadow: inset 0 0 0 1.5px var(--sep); color: var(--label-2); }
.dot.today { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-text); }
.dot.upcoming, .dot.none { color: var(--label-3); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; color: var(--label-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--label-2); font-size: 13px; font-weight: 600; }
.stat .v { font-family: var(--font-round); font-size: 32px; font-weight: 700; letter-spacing: -0.03em; margin-top: 2px; }
.stat .v small { font-size: 15px; color: var(--label-3); font-weight: 600; margin-left: 2px; }
.platrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.platrow .stat { display: flex; flex-direction: column; gap: 8px; }
.platrow .v { font-size: 24px; }

.badges { display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 10px; margin: 0 -4px;
          scroll-snap-type: x mandatory; scrollbar-width: none; }
.badges::-webkit-scrollbar { display: none; }
.badge { scroll-snap-align: start; flex: none; width: 82px; text-align: center; }
.badge .disc { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center;
               font-family: var(--font-round); font-weight: 800; font-size: 24px; letter-spacing: -0.03em; }
.badge.on .disc { color: #fff; background: radial-gradient(circle at 30% 25%, var(--accent-2), var(--accent) 70%);
                  box-shadow: 0 6px 18px rgba(232, 73, 15, 0.35); }
.badge.off .disc { color: var(--label-3); background: var(--fill); }
.badge .cap { font-size: 12px; color: var(--label-2); font-weight: 600; }

/* ---------------------------------------------------------------- tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
          padding: 6px 8px calc(var(--safe-bottom) + 6px); background: var(--bar);
          -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
          border-top: 0.5px solid var(--sep); }
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tab { flex: 1; min-height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center;
       gap: 3px; color: var(--label-3); font-size: 11px; font-weight: 600; transition: color 200ms, transform 160ms var(--ease); }
.tab:active { transform: scale(0.94); }
.tab[aria-selected="true"] { color: var(--accent-text); }
.tab svg { width: 25px; height: 25px; }

/* ---------------------------------------------------------------- sheet */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0;
         transition: opacity 280ms var(--ease); }
.scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto;
         background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
         transform: translateY(100%); transition: transform 420ms var(--ease-out);
         padding: 8px var(--gutter) calc(var(--safe-bottom) + 24px); max-width: 640px; margin: 0 auto;
         overscroll-behavior: contain; }
.sheet.open { transform: none; }
.sheet.closing { transition-duration: 260ms; transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 2px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.player { width: min(48vw, 200px); aspect-ratio: 9 / 16; margin: 0 auto 16px; border-radius: 18px; overflow: hidden;
          background: #000; box-shadow: var(--shadow); }
.player video { width: 100%; height: 100%; object-fit: cover; display: block; }
.field { background: var(--card); border-radius: var(--r-row); padding: 12px 14px; }
.field + .field { margin-top: 10px; }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 8px;
               font-size: 13px; font-weight: 600; color: var(--label-2); margin-bottom: 6px; }
.field label span { display: inline-flex; align-items: center; gap: 6px; }
.field .count { font-weight: 500; color: var(--label-3); }
.field .count.over { color: var(--red); }
.field textarea { width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 16px;
                  line-height: 1.4; min-height: 24px; padding: 0; }
.field:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.sheet-actions { display: grid; gap: 10px; margin-top: 18px; }
.sheet-actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------------------------------------------------------------- toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 84px); z-index: 60;
         transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
         display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 16px;
         background: rgba(30, 30, 32, 0.94); color: #fff; font-size: 15px; font-weight: 500;
         box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); transition: transform 300ms var(--ease-out), opacity 220ms;
         max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: var(--accent-2); font-weight: 700; padding: 6px 8px; margin: -6px -6px -6px 0; }

.fade-in { animation: fadeUp 420ms var(--ease-out) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 360px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .platrow { grid-template-columns: 1fr; }
  .ring { width: 190px; height: 190px; }
  .ring .count { font-size: 56px; }
}

/* ================================================================ v6: sections, styles */

/* rings row on Today */
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ring-card { display: flex; flex-direction: column; align-items: center; padding: 14px 10px;
             text-decoration: none; color: inherit; transition: transform 160ms var(--ease); }
.card.ring-card + .card.ring-card { margin-top: 0; }
.ring-card:active { transform: scale(0.97); }
.rc-label { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
[lang="ar"] { font-family: "SF Arabic", "Geeza Pro", "Noto Sans Arabic", var(--font); letter-spacing: 0; }
.ring.sm { width: 132px; height: 132px; }
.ring.sm .count { font-size: 40px; }
.ring.sm .unit { font-size: 12px; margin-top: 2px; }
.ring.sm .flame svg { width: 18px; height: 18px; }
.rc-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 8px;
           color: var(--label-2); font-size: 12.5px; font-weight: 600; text-align: center; }
.rc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rings + .banner { margin-top: 12px; }

/* per-section block on Today */
.sec-block { margin-top: 26px; scroll-margin-top: calc(var(--safe-top) + 12px); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 10px; }
.sec-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sec-head .sub { color: var(--label-2); font-size: 14px; font-weight: 500; }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.mini { background: var(--card); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow);
        display: flex; flex-direction: column; gap: 2px; min-height: 76px; }
.mini .k { color: var(--label-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.mini b { font-family: var(--font-round); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.mini small { color: var(--label-3); font-size: 11.5px; font-weight: 500; }
.mini.warn b { color: var(--red); }
.mini .flakes { margin: 3px 0 1px; }
.mini .flakes svg { width: 20px; height: 20px; }

/* iOS segmented control */
.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); padding: 2px;
       border-radius: 10px; background: var(--fill); margin: 0 0 14px; isolation: isolate; }
.seg-thumb { position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px;
             width: calc((100% - 4px) / var(--n)); border-radius: 8px; background: var(--card);
             box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
             transform: translateX(calc(var(--i) * 100%)); transition: transform 320ms var(--ease-out); }
:root[data-theme="dark"] .seg-thumb { background: #636366; }
.seg button { min-height: 36px; font-size: 15px; font-weight: 600; color: var(--label); border-radius: 8px;
              display: inline-flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation; }
.seg button[aria-selected="false"] { color: var(--label-2); }
.mini-seg { margin: 0; width: 96px; flex: none; }
.mini-seg button { min-height: 32px; }

/* queue extras */
.row.tall { height: auto; min-height: 92px; padding-top: 12px; padding-bottom: 12px; }
.pick { display: flex; gap: 8px; margin-top: 10px; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.tag.accent { background: var(--accent-wash); color: var(--accent-text); }
.tag.red { background: var(--red-wash); color: var(--red); }
.hint { color: var(--label-3); font-size: 13px; margin: 10px 4px 0; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sheet: rendering veil + style carousel */
.player.rendering { position: relative; }
.player.rendering img { width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(0.6); }
.player .veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
                justify-content: center; gap: 10px; color: #fff; font-size: 14px; font-weight: 600; }
.player .veil svg { width: 30px; height: 30px; }
.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
            margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.sw { flex: none; width: 104px; scroll-snap-align: center; display: flex; flex-direction: column; gap: 6px;
      align-items: center; transition: transform 160ms var(--ease); }
.sw:active { transform: scale(0.96); }
.sw-img { width: 104px; height: 78px; border-radius: 12px; overflow: hidden; background: var(--fill);
          transition: box-shadow 200ms var(--ease); }
.sw-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 76%; display: block; }
.sw.on .sw-img { box-shadow: 0 0 0 3px var(--accent); }
.sw-name { font-size: 12px; font-weight: 600; color: var(--label-2); text-align: center; line-height: 1.2; }
.sw.on .sw-name { color: var(--accent-text); }

/* Styles tab */
.mode { padding: 14px 16px; margin-bottom: 14px; }
.mode-row { display: flex; align-items: center; gap: 14px; }
.mode-row > div:first-child { flex: 1; min-width: 0; }
.mode b { font-size: 16px; }
.mode p { margin: 2px 0 0; color: var(--label-2); font-size: 14px; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.style-card { position: relative; animation: fadeUp 420ms var(--ease-out) both; }
.sc-main { display: flex; flex-direction: column; width: 100%; text-align: left; border-radius: 18px;
           background: var(--card); box-shadow: var(--shadow); padding: 6px 6px 12px;
           transition: transform 160ms var(--ease), box-shadow 220ms; }
.sc-main:active { transform: scale(0.97); }
.style-card.picked .sc-main { box-shadow: 0 0 0 2.5px var(--accent), var(--shadow); }
.sc-img { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: 13px; overflow: hidden; background: var(--fill); }
.sc-img:not(.ok)::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent); animation: shimmer 1.4s infinite; }
.sc-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 78%; display: block;
              opacity: 0; transition: opacity 260ms; }
.sc-img.ok img { opacity: 1; }
.sc-name { font-size: 15px; font-weight: 700; margin: 10px 6px 0; letter-spacing: -0.01em; }
.sc-fam { font-size: 12.5px; color: var(--label-2); margin: 1px 6px 0; }
.star { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center;
        color: #fff; background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        transition: transform 200ms var(--ease), background 200ms; }
.star:active { transform: scale(0.88); }
.star svg { width: 22px; height: 22px; }
.star.on { background: var(--accent); }
.star.on svg { fill: #fff; }
.sc-badge { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 14px;
            display: grid; place-items: center; background: var(--accent); color: #fff; }

.platrow { grid-template-columns: repeat(var(--cols, 3), 1fr); }

/* weekly batch card */
.card.batch { margin-top: 12px; }
.batch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.batch-head b { font-size: 17px; }
.batch-head p { margin: 2px 0 0; color: var(--label-2); font-size: 13.5px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr 40px; align-items: center; gap: 10px; margin-top: 8px; }
.bar-row .bl { font-size: 14px; font-weight: 600; }
.bar-row .bn { font-size: 14px; font-weight: 600; color: var(--label-2); text-align: right; }
.bar { height: 10px; border-radius: 5px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent-2), var(--accent));
         transform-origin: left; animation: grow 700ms var(--ease-out) both; }
.bar i.full { background: var(--green-fill); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.batch-foot { margin-top: 12px; color: var(--label-2); font-size: 13px; display: flex; align-items: center; gap: 5px; }
.batch-foot svg { color: var(--accent); }

/* burned-in caption word editor */
.field.words textarea { font-size: 17px; line-height: 1.5; }
.save-words { width: 100%; margin-top: 10px; }

@media (max-width: 360px) {
  .ring.sm { width: 112px; height: 112px; }
  .ring.sm .count { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
                           transition-duration: 1ms !important; }
}
