/* The app's UI on the web: the caption, the flight, the settings panel, the menu bar.
   Sizes and colours from typealoud/overlay/overlay.swift and typealoud/app/Settings.swift
   (Look); dark appearance, the way the app looks on a dark Mac. */

:root {
  --dc-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", Inter, "Segoe UI", system-ui, sans-serif;
  --dc-text: #fff;
  /* Look: cards faintly filled with hairline edges */
  --sp-card-fill: rgba(255, 255, 255, .085);
  --sp-card-border: rgba(255, 255, 255, .07);
  --sp-divider: rgba(255, 255, 255, .07);
  --sp-hover: rgba(255, 255, 255, .06);
  --sp-detail: rgba(255, 255, 255, .7);
  --sp-backing: rgba(18, 18, 20, .55);
  --sp-accent: #0a84ff;
  --sp-green: rgb(51, 199, 107);
  --sp-orange: rgb(250, 133, 31);
  --sp-gray: #8e8e93;
}

/* ---------------------------------------------------------------- Liquid Glass */

/* macOS 26's glass bends and tints what is behind it; on the web: a blur that keeps the colour,
   a faint fill, and a bright rim that catches the light at the top-left and bottom-right. */
.dc-glass {
  position: relative;
  background: rgba(255, 255, 255, .035);
  -webkit-backdrop-filter: blur(16px) brightness(1.12);
  backdrop-filter: blur(16px) brightness(1.12);
  box-shadow:
    inset 0 0 0 .5px rgba(255, 255, 255, .08),
    inset 0 1px 1px rgba(255, 255, 255, .1),
    0 10px 30px rgba(0, 0, 0, .32),
    0 1px 4px rgba(0, 0, 0, .22);
}
.dc-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .11) 45%, rgba(255, 255, 255, .08) 70%, rgba(255, 255, 255, .14));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the caption */

.dc-anchor {                     /* the caption's bottom-centre point; it grows up and sideways */
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 5;
}
.dc-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  min-width: 200px;
  border-radius: 22px;
  color: var(--dc-text);
  font: 500 18px/1.2 var(--dc-font);
  box-sizing: border-box;
  opacity: 0;
  overflow: visible;
  user-select: none;
}
.dc-caption.still { opacity: 1; }
.dc-wave { display: block; width: 100%; min-width: 320px; height: 46px; }
.dc-words { position: relative; overflow: hidden; max-width: 620px; }
.dc-words.overflowing {          /* the top line fades out as it scrolls away */
  -webkit-mask: linear-gradient(transparent, #000 24%);
  mask: linear-gradient(transparent, #000 24%);
}
.dc-words-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 5px;
  row-gap: 4px;
  max-width: 620px;
}
.dc-words-inner.cjk { column-gap: .5px; }
.dc-word { display: inline-block; transform-origin: 50% 100%; transition: opacity .24s ease-out; white-space: pre; }
.dc-word.tentative { opacity: .4; }
.dc-caption.dissolving .dc-words { opacity: 0; transition: opacity .38s cubic-bezier(.42, 0, 1, 1); }
.dc-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: rgba(255, 255, 255, .9);
  stroke-width: 1.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .35));
}
.dc-ring path { opacity: 0; }
.dc-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  display: grid;
  place-items: center;
  cursor: default;
}
.dc-close svg { width: 9px; height: 9px; fill: none; stroke: rgba(235, 235, 245, .6); stroke-width: 1.9; stroke-linecap: round; }
.dc-grip {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: rgba(255, 255, 255, .18);
  stroke-width: 1.2;
  stroke-linecap: round;
}
.dc-caption:hover .dc-grip { stroke: rgba(255, 255, 255, .45); }

/* minimised: a round bubble with only the waveform */
.dc-caption.ball { width: 58px !important; height: 58px !important; min-width: 0; padding: 0; border-radius: 50%; justify-content: center; }
.dc-caption.ball .dc-wave { width: 34.8px; min-width: 0; height: 24.4px; }
.dc-caption.ball .dc-words, .dc-caption.ball .dc-grip { display: none; }
.dc-caption.ball .dc-close { top: -6px; right: -6px; transform: scale(.8); opacity: 0; transition: opacity .15s; }
.dc-caption.ball:hover .dc-close { opacity: 1; }

/* ---------------------------------------------------------------- the flight */

.dc-flock, .dc-dots { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.dc-frost {
  position: absolute;
  z-index: 4;
  border-radius: 8px;
  pointer-events: none;
  -webkit-mask: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent), linear-gradient(transparent, #000 8px, #000 calc(100% - 8px), transparent);
  -webkit-mask-composite: source-in;
  mask: linear-gradient(90deg, transparent, #000 8px, #000 calc(100% - 8px), transparent), linear-gradient(transparent, #000 8px, #000 calc(100% - 8px), transparent);
  mask-composite: intersect;
}

/* ---------------------------------------------------------------- a Mac, for the demos */

.mac {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  font-family: var(--dc-font);
  color: #fff;
  isolation: isolate;
  /* the app's preview stage (PreviewStage.stageBackground): black, with a soft white light from the
     top centre, white 0.16 fading out (endRadius 260 on its ~412-pt stage ≈ the farthest corner) */
  background: radial-gradient(circle at 50% 0, rgb(41, 41, 41), transparent), #000;
}
.mac-menubar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  font-size: 13px;
  background: rgba(20, 20, 28, .3);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  z-index: 3;
}
.mac-menubar b { font-weight: 600; }
.mac-menubar .grow { flex: 1; }
.mac-menubar .glyph { width: 20px; height: 18px; display: block; color: #fff; }
.mac-menubar .glyph.off { opacity: .4; }
.mac-menubar .menu-item { display: flex; align-items: center; height: 22px; padding: 0 6px; border-radius: 5px; }
.mac-menubar .menu-item.open { background: rgba(255, 255, 255, .18); }

.mac-window {
  position: absolute;
  border-radius: 12px;
  background: rgba(30, 30, 34, .94);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 22px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
  z-index: 1;
}
.mac-titlebar { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 14px; color: rgba(255, 255, 255, .6); font-size: 13px; font-weight: 600; }
.mac-titlebar i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.mac-titlebar i:nth-child(1) { background: #ff5f57; }
.mac-titlebar i:nth-child(2) { background: #febc2e; }
.mac-titlebar i:nth-child(3) { background: #28c840; }
.mac-titlebar span { flex: 1; text-align: center; margin-right: 52px; }
.mac-doc { padding: 10px 26px 22px; font: 400 15px/22px var(--dc-font); color: #ececf1; }
.mac-doc h3 { margin: 0 0 8px; font-size: 20px; line-height: 26px; font-weight: 700; }
.mac-doc p { margin: 0 0 10px; }
.field .ghost { visibility: hidden; }
.caret {
  display: inline-block;
  width: 2px;
  height: 18px;
  margin-left: 1px;
  vertical-align: -3px;
  background: var(--sp-accent);
  border-radius: 1px;
  animation: caret 1.06s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.mac-term { background: rgba(18, 18, 20, .96); }
.mac-term .mac-doc { font: 400 13px/18px ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #d6d6dc; }
.mac-term .caret { width: 7.8px; height: 16px; vertical-align: -3px; background: rgba(214, 214, 220, .75); border-radius: 0; }
.prompt { color: #7ee787; }

/* ---------------------------------------------------------------- the settings panel */

.dc-popover {
  position: relative;
  border-radius: 16px;
  background: rgba(36, 36, 42, .5);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  backdrop-filter: blur(40px) saturate(1.8);
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .14), inset 0 1px 1px rgba(255, 255, 255, .12), 0 24px 70px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
}
.sp-panel {
  width: 440px;
  color: #fff;
  font: 400 13px/1.25 var(--dc-font);
  overflow: visible;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
.sp-panel > :first-child { border-radius: 16px 16px 0 0; }
.sp-panel::after {               /* laid under the whole panel so a busy wallpaper doesn't show through */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--sp-backing);
  z-index: -1;
}
.sp-panel button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: default; text-align: inherit; }
.sp-grow { flex: 1; }

.sp-header { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.sp-head-row { display: flex; align-items: center; gap: 12px; }
.sp-mark { display: block; width: 42px; height: 42px; transition: filter .2s, opacity .2s; }
.sp-mark.off { filter: saturate(0); opacity: .5; }
.sp-name-col { display: flex; flex-direction: column; gap: 3px; }
.sp-name { font-size: 15px; font-weight: 600; }
.sp-status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--sp-detail); }
.sp-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--sp-green); }
.sp-status i.gray { background: var(--sp-gray); }
.sp-hint { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--sp-detail); transition: opacity .2s; }
.sp-hint.off { opacity: .45; }
.sp-keys { display: inline-flex; gap: 4px; color: #fff; }
.sp-panel kbd, .kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 5px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18);
  font: 500 11.5px/1 var(--dc-font);
  color: #fff;
}
.sp-panel kbd.wide, .kbd.wide { padding: 0 11px; }

/* PreviewStage: black, with a soft lighter patch behind the captions so their glass has something to show */
.sp-stage {
  display: flex;
  gap: 14px;
  padding: 14px 14px 8px;
  border-radius: 12px;
  background: radial-gradient(260px 260px at 50% 0, rgb(41, 41, 41), transparent), #000;
  box-shadow: inset 0 0 0 .5px var(--sp-card-border);
  transition: filter .2s, opacity .2s;
}
.sp-stage.off { filter: saturate(0); opacity: .6; }
.sp-choice { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; opacity: .45; transition: opacity .2s; }
.sp-choice.on { opacity: 1; }
.sp-choice.ball { flex: 0 1 110px; }
.sp-art { height: 92px; display: flex; align-items: center; justify-content: center; }
.sp-mini { width: 230px; padding: 10px 12px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 14px; }
.sp-mini-ball { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; }
.sp-mini-wave { width: 206px; height: 18px; display: block; }
.sp-mini-words { width: 206px; height: 34px; display: block; }
.sp-mini-ballwave { width: 35px; height: 24px; display: block; }
.sp-choice-label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .6); }
.sp-choice.on .sp-choice-label { color: #fff; }

.sp-tabs { display: flex; gap: 2px; padding: 0 14px; }
.sp-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 0 !important;
  border-radius: 10px;
  color: var(--sp-detail) !important;
  box-shadow: inset 0 0 0 .5px transparent;
}
.sp-tab:hover { background: var(--sp-hover) !important; }
.sp-tab.on { background: var(--sp-card-fill) !important; box-shadow: inset 0 0 0 .5px var(--sp-card-border); color: #fff !important; }
.sp-tab-icon { width: 24px; height: 24px; display: grid; place-items: center; }
.sp-tab-name { font-size: 11.5px; white-space: nowrap; }
.sp-tab.on .sp-tab-name { font-weight: 600; }

.sp-content { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; min-height: 186px; }
.sp-card-wrap { display: flex; flex-direction: column; gap: 6px; }
.sp-card-title { font-size: 12px; font-weight: 600; color: var(--sp-detail); padding-left: 4px; }
.sp-card { border-radius: 12px; background: var(--sp-card-fill); box-shadow: inset 0 0 0 .5px var(--sp-card-border); }
.sp-divide { height: .5px; margin-left: 44px; background: var(--sp-divider); }
.sp-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; }
.sp-tile { width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; color: var(--sp-detail); flex: none; }
.sp-row-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sp-row-top { display: flex; align-items: center; gap: 12px; min-height: 22px; }
.sp-row-title { font-size: 13.5px; font-weight: 500; }
.sp-detail { font-size: 12px; line-height: 1.35; color: var(--sp-detail); padding-right: 4px; }
.sp-value { font-size: 12.5px; color: var(--sp-detail); }
.sp-chev { color: rgba(255, 255, 255, .3); display: grid; margin-left: -6px; }
.sp-row-button { display: block; width: 100%; }
.sp-allowed { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; color: var(--sp-green); --on-accent: #1d1d22; }
.sp-check { color: var(--sp-accent); display: grid; }
.sp-recorder { display: inline-flex; }

.sp-switch {
  position: relative;
  flex: none;
  width: 38px !important;
  height: 22px;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, .16) !important;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .2);
  transition: background .18s;
}
.sp-switch i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .06);
  transition: transform .18s ease-out;
}
.sp-switch.on { background: var(--sp-accent) !important; }
.sp-switch.on i { transform: translateX(16px); }
.sp-switch.small { width: 32px !important; height: 18px; border-radius: 9px !important; }
.sp-switch.small i { width: 14px; height: 14px; }
.sp-switch.small.on i { transform: translateX(14px); }

.sp-seg { display: inline-flex; flex: none; padding: 2px; gap: 2px; border-radius: 8px; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .06); }
.sp-seg button { padding: 2px 12px !important; border-radius: 6px; font-size: 12.5px !important; line-height: 17px; color: rgba(255, 255, 255, .85) !important; }
.sp-seg button.on { background: rgba(255, 255, 255, .24) !important; color: #fff !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.sp-popup, .sp-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 22px;
  padding: 0 7px 0 10px !important;
  border-radius: 11px;
  background: rgba(255, 255, 255, .1) !important;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .08), 0 .5px 1px rgba(0, 0, 0, .2);
  font-size: 12.5px !important;
  white-space: nowrap;
}
.sp-popup .ic { color: rgba(255, 255, 255, .6); }
.sp-button { height: 20px; padding: 0 10px !important; font-size: 11.5px !important; }
.sp-back { display: flex; align-items: center; gap: 5px; padding: 0 4px !important; font-size: 12.5px !important; color: var(--sp-detail) !important; }
.sp-back b { color: #fff; font-size: 13.5px; font-weight: 600; }
.sp-footer { display: flex; gap: 16px; padding: 11px 14px; box-shadow: inset 0 .5px 0 var(--sp-divider); }
.sp-footer button { font-size: 12.5px !important; color: var(--sp-detail) !important; }
.sp-footer button:hover { color: #fff !important; }

.sp-menu {
  position: absolute;
  z-index: 20;
  min-width: 170px;
  max-height: 300px;
  overflow: auto;
  padding: 5px;
  border-radius: 10px;
  background: rgba(40, 40, 46, .82);
  display: flex;
  flex-direction: column;
}
.sp-menu button { display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px !important; border-radius: 5px; font-size: 13px !important; white-space: nowrap; }
.sp-menu button:hover { background: var(--sp-accent) !important; }
.sp-menu-check { width: 16px; display: grid; place-items: center; }
