/* On-device speech tools (/tools/audio-to-text/, /tools/subtitle-generator/ and their /ko/tools/
   pairs). Loaded after /css/clean-home.css, /tools/shared/audio-task.css and
   /tools/shared/text-qr-tools.css; only adds what those don't cover. */

.sp-intake { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sp-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sp-badges .at-badge { font-weight: 700; }
.sp-device { background: var(--et-purple-soft); color: #3D2A75; }
.at-tool .at-field select { width: 100%; }
.sp-player { width: 100%; margin-top: 4px; }
.sp-run { margin-top: 14px; }
/* The file/settings/result steps sit in #work, so they don't get audio-task.css's step divider. */
#work > .at-step:first-child { margin-top: 20px; padding-top: 18px; border-top: 1px solid #F1ECF9; }

/* Microphone recording */
.sp-rec {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px;
  padding: 12px 14px; border-radius: 14px; background: #FFF4F2; border: 1px solid #FFD9D4;
}
.sp-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--et-coral); flex: none; animation: sp-pulse 1.2s ease-in-out infinite; }
@keyframes sp-pulse { 50% { opacity: .35; } }
.sp-level { flex: 1 1 120px; min-width: 80px; height: 8px; border-radius: 999px; background: #F6E3E0; overflow: hidden; }
.sp-level span { display: block; height: 100%; width: 100%; background: var(--et-coral); transform-origin: left center; transform: scaleX(0.02); transition: transform .1s linear; }

/* Transcript */
.sp-result-bar { justify-content: space-between; }
.sp-transcript {
  margin-top: 10px; max-height: min(60vh, 560px); overflow: auto; padding: 14px 16px;
  border: 1.5px solid #E2D9F5; border-radius: 14px; background: #FCFAFF; line-height: 1.7; font-size: 16px;
  overflow-wrap: anywhere;
}
.sp-transcript:focus-visible { outline: 3px solid rgba(130, 87, 230, .45); outline-offset: 2px; }
.sp-transcript p { margin: 0 0 10px; }
.sp-transcript p:last-child { margin-bottom: 0; }
.sp-stamp {
  font: inherit; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--et-purple-dark);
  background: var(--et-purple-soft); border: 0; border-radius: 6px; padding: 1px 6px; cursor: pointer; vertical-align: 1px;
}
.sp-stamp:hover { background: #E9E1FA; }
.sp-stamp:focus-visible { outline: 3px solid rgba(130, 87, 230, .45); outline-offset: 1px; }
.sp-actions { margin-top: 12px; }

/* Subtitle generator ------------------------------------------------------------------ */

/* Hero: the promise, one button, and a phone drawing captions with the real renderer. */
.sg-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; max-width: none; align-items: center; }
@media (min-width: 860px) { .sg-hero { grid-template-columns: minmax(0, 1fr) 250px; gap: 40px; } }
.sg-hero h1 { margin-top: 14px; }
.sg-promise { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.sg-promise li {
  font-size: 12.5px; font-weight: 800; letter-spacing: .01em; color: var(--et-purple-dark);
  background: var(--et-purple-soft); border-radius: 999px; padding: 5px 11px;
}
.sg-promise li::before { content: "✓"; margin-right: 5px; color: var(--et-purple); }
.sg-hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 18px; }
.sg-hero-cta span { font-size: 13px; color: var(--et-mute); }
.at-btn.sg-hero-btn { min-height: 54px; padding: 12px 28px; font-size: 1.05rem; }
.sg-phone {
  justify-self: center; margin: 0; width: min(250px, 62vw); aspect-ratio: 9 / 16; border-radius: 34px;
  padding: 9px; background: #1F1733; box-shadow: 0 26px 60px rgba(31, 23, 51, .28), inset 0 0 0 2px #3A2F55;
}
.sg-phone-screen {
  position: relative; width: 100%; height: 100%; border-radius: 26px; overflow: hidden;
  /* A made-up sunset clip: sky, sun and two hills. */
  background:
    radial-gradient(140% 34% at 18% 100%, #2B1E4F 0 58%, rgba(43, 30, 79, 0) 59%),
    radial-gradient(150% 40% at 92% 100%, #47306F 0 58%, rgba(71, 48, 111, 0) 59%),
    radial-gradient(circle at 50% 46%, #FFE7B3 0 11%, rgba(255, 231, 179, .45) 12%, rgba(255, 231, 179, 0) 24%),
    linear-gradient(180deg, #FFB48C 0%, #F27F7F 36%, #9A5CC6 68%, #3B2A6B 100%);
}
.sg-phone canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (max-width: 859px) { .sg-phone { width: min(190px, 52vw); } }

/* Steps */
.sg-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 18px; padding: 0; counter-reset: none; }
.sg-steps li {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 700; color: var(--et-mute); background: #FAF8FE;
}
.sg-step-num {
  display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%;
  font-size: 12px; font-weight: 800; background: #EEE8FA; color: var(--et-purple-dark);
}
.sg-steps li.is-current { background: var(--et-purple-soft); color: var(--et-ink); box-shadow: inset 0 0 0 1.5px #D9CCF6; }
.sg-steps li.is-current .sg-step-num { background: var(--et-purple); color: #fff; }
.sg-steps li.is-done .sg-step-num { background: #2E9E6A; color: #fff; font-size: 0; }
.sg-steps li.is-done .sg-step-num::after { content: "✓"; font-size: 12px; }
@media (max-width: 560px) {
  .sg-steps { gap: 4px; }
  .sg-steps li { flex-direction: column; gap: 4px; padding: 7px 4px; font-size: 11px; text-align: center; line-height: 1.25; }
}

/* Restore a draft */
.sg-restore {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: #F2FBF6; border: 1px solid #CDEBDA; font-size: 14px;
}
.sg-restore p { margin: 0; font-weight: 600; }

/* Workspace: one column on phones (preview, style, make, captions, download); on wide screens the
   tool card spreads past the 960px shell and keeps the video, style and download panel in view. */
.sg-work { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.sg-side, .sg-main { display: contents; }
.sg-preview { order: 1; }
.sg-style { order: 2; }
.sg-make { order: 3; }
.sg-cuepanel { order: 4; }
.sg-download { order: 5; }
.sg-panel { min-width: 0; padding-top: 18px; margin-top: 18px; border-top: 1px solid #F1ECF9; }
.sg-preview { padding-top: 0; margin-top: 0; border-top: 0; }
.at-tool.has-video .sg-intake { display: none; }
@media (min-width: 1000px) {
  .at-tool.has-video { width: min(1240px, calc(100vw - 48px)); margin-left: calc(50% - min(620px, 50vw - 24px)); }
  .at-tool.has-video .sg-work { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); gap: 28px; align-items: start; }
  .at-tool.has-video .sg-side, .at-tool.has-video .sg-main { display: block; min-width: 0; }
  .at-tool.has-video .sg-side { position: sticky; top: 12px; }
  .at-tool.has-video .sg-main > .sg-panel:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
  .at-tool.has-video .sg-stage video { max-height: min(58vh, 620px); }
  .at-tool.has-video .sg-cues { max-height: calc(100vh - 230px); }
}

.sg-stage { position: relative; margin-top: 4px; border-radius: 14px; overflow: hidden; background: #111; }
.sg-stage video { display: block; width: 100%; max-height: 62vh; background: #111; }
/* The browser's own caption rendering, used only in full screen (app.mjs draws #capCanvas otherwise). */
.sg-stage video::cue { font-size: 1.05em; line-height: 1.35; background: rgba(0, 0, 0, .78); color: #fff; }
/* Placed by app.mjs over the letterboxed picture; clicks go through to the video. */
.sg-capcanvas { position: absolute; left: 0; top: 0; pointer-events: none; }

/* Style */
.sg-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .sg-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sg-chip {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; padding: 6px 6px 8px;
  border-radius: 14px; border: 1.5px solid #E7E1F4; background: #fff; font: inherit; cursor: pointer; color: var(--et-ink);
}
.sg-chip:hover { border-color: #CDBDF2; }
.sg-chip[aria-checked="true"] { border-color: var(--et-purple); box-shadow: 0 0 0 3px rgba(130, 87, 230, .18); }
.sg-chip-name { font-size: 12px; font-weight: 800; text-align: center; line-height: 1.2; }
.sg-chip-demo {
  display: flex; align-items: center; justify-content: center; gap: .28em; height: 46px; border-radius: 9px; overflow: hidden; white-space: nowrap;
  background: linear-gradient(160deg, #FF9A76, #9B6BC4 60%, #4B3A8C); color: #fff; font-weight: 800; font-size: 17px;
}
.sg-chip-demo--box i { font-style: normal; font-weight: 700; font-size: 15px; background: rgba(0, 0, 0, .78); padding: 3px 9px; border-radius: 6px; }
.sg-chip-demo--outline, .sg-chip-demo--highlight, .sg-chip-demo--pop {
  -webkit-text-stroke: 3px #000; paint-order: stroke fill;
}
.sg-chip-demo--highlight { font-size: 14px; }
.sg-chip-demo--highlight b { color: #FFE14D; font-weight: 800; }
.sg-chip-demo--pop b { -webkit-text-stroke: 0; background: #7C4DFF; padding: 1px 6px; border-radius: 6px; font-size: 16px; }
.sg-chip-demo--minimal { font-weight: 600; font-size: 13px; -webkit-text-stroke: 1.5px rgba(0, 0, 0, .75); paint-order: stroke fill; }
.sg-style-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 12px 16px; margin-top: 14px; align-items: end; }
.sg-style-row select { width: 100%; }
.sg-range { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.sg-range input[type="range"] { flex: 1 1 auto; min-width: 0; }
.sg-range output { min-width: 3.2em; font-variant-numeric: tabular-nums; color: var(--et-purple-dark); }

/* Download */
.at-btn.sg-mp4 { width: 100%; min-height: 54px; font-size: 1.02rem; }
.sg-download .at-progress { margin-top: 12px; }
.sg-burnrow:has(> :not([hidden])) { margin-top: 10px; }
.sg-subfiles { margin-top: 12px; }

/* Find & replace */
.sg-find {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px 10px; align-items: end;
  margin: 4px 0 10px; padding: 12px; border-radius: 14px; background: #FBF9FF; border: 1px solid #EEE7FA;
}
.sg-find input[type="text"] { width: 100%; }
.sg-find output { grid-column: 1 / -1; font-size: 13px; }
.sg-find output:empty { display: none; }
@media (max-width: 560px) { .sg-find { grid-template-columns: minmax(0, 1fr); } }

/* Completion card */
.sg-done {
  margin-top: 22px; padding: 20px clamp(16px, 3vw, 24px); border-radius: 18px;
  background: linear-gradient(135deg, #F5F0FF 0%, #FFF1EA 100%); border: 1px solid #E6DBFA;
}
.sg-done:focus { outline: none; }
.sg-done-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #2E9E6A; }
.at-tool .sg-done h2 { font-size: 1.35rem; margin: 4px 0 6px; }
.sg-done p { color: var(--et-mute); margin: 0 0 14px; font-size: 14.5px; }
.sg-next-title { font-size: .95rem; font-weight: 800; margin: 20px 0 10px; }
.sg-next { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .sg-next { grid-template-columns: minmax(0, 1fr); } }
.sg-next-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: #fff;
  border: 1px solid #EEE7FA; text-decoration: none; color: var(--et-ink); transition: transform .15s ease, box-shadow .15s ease;
}
.sg-next-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(130, 87, 230, .14); }
.sg-next-card strong { font-size: .98rem; }
.sg-next-card span { font-size: 13px; color: var(--et-mute); }
.sg-related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .sg-related-grid { grid-template-columns: minmax(0, 1fr); } }

.sg-layout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; margin-top: 14px; }
@media (max-width: 620px) { .sg-layout { grid-template-columns: minmax(0, 1fr); } }
.sg-layout .at-field input[type="number"], .sg-layout .at-field select { width: 100%; }
.sg-toolbar { margin-bottom: 10px; }
.sg-cues { list-style: none; display: grid; gap: 8px; margin: 0; padding: 0; max-height: min(70vh, 720px); overflow: auto; }
.sg-cue { background: #FBF9FF; border: 1px solid #EEE7FA; border-radius: 14px; padding: 10px 12px; min-width: 0; cursor: pointer; }
.sg-cue.is-active { border-color: var(--et-purple); box-shadow: 0 0 0 2px rgba(130, 87, 230, .2); background: #F7F2FF; }
.sg-cue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.sg-num { min-width: 1.8em; font-weight: 800; color: var(--et-purple-dark); font-variant-numeric: tabular-nums; }
.sg-play {
  width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid #E2D9F5; background: #fff; color: var(--et-purple-dark);
  font: inherit; font-size: 13px; cursor: pointer; flex: none;
}
.sg-play:hover { border-color: var(--et-purple); }
.at-tool input.sg-time {
  width: 7.6em; min-height: 36px; padding: 5px 8px; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600;
}
.at-tool input.sg-time[aria-invalid="true"] { border-color: #C2352B; background: #FFF4F2; }
.sg-arrow { color: var(--et-mute); }
.sg-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.sg-tools .at-btn--small { min-height: 34px; padding: 4px 10px; font-size: .8rem; }
.at-tool textarea.sg-text { margin-top: 8px; min-height: 44px; font-size: 15px; cursor: text; }
.sg-export { margin-top: 14px; }
@media (max-width: 520px) {
  .sg-cue { padding: 9px 10px; }
  .sg-cue-head { gap: 6px; }
  .sg-num { min-width: 1.1em; }
  .sg-play { width: 34px; height: 34px; }
  .sg-tools { margin-left: 0; width: 100%; }
  .at-tool input.sg-time { width: 5.9em; padding: 5px 6px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-rec-dot { animation: none; }
  .sg-next-card { transition: none; }
  .sg-next-card:hover { transform: none; }
}
