:root {
  --video-corner-radius: 34px;
  --playback-footer-height: 132px;
  --navbar-height: 62px;
  --custom-output-font-size: 32px;
  --custom-output-font-family: "Inclusive Sans", Arial, sans-serif;
  --bg: #f4f8f7;
  --card: #f4f8f7;
  --text: #181818;
  --muted: #5f5f5f;
  --line: #c8c8c8;
  --med-green: #E4F2F0;
  --accent: #17a592;
  --accent-2: #118576;
  --danger: #b42318;
  --ok: #067647;
  --selected-highlight-color: #e4f2f0;
  --selected-bookmark-color: #17a592;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inclusive Sans", Arial, sans-serif;
  font-optical-sizing: auto;
  color: var(--text);
  background: #f4f8f7;
  height: 100vh;
  overflow: hidden;
}

html {
  height: 100%;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-navbar {
  height: var(--navbar-height);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;

  a {
    display: flex;
    align-items: center;
  }

  img {
    height: 40px;
  }


}

body.hide-app-header .app-navbar {
  display: none;
}

.container {
  width: 100vw;
  max-width: none;
  height: calc(100vh - var(--navbar-height));
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  justify-content: stretch;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.hide-app-header .container {
  height: 100vh;
  min-height: 100vh;
}

.card {
  background: var(--card);
  /* border: 1px solid var(--line); */
  /* border-radius: 0; */
  padding: 1.5rem;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
}

h1 {
  margin-top: 0;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
}

.subtitle {
  margin: 0 0 1.25rem;
  color: var(--muted);
  text-align: center;
}

#upload-section {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/**
  * LANDING PAGE
  */

.landing-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 4rem;
  gap: 2rem;
}

.landing-copy {
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;

  h1, p {
    text-align: left;
    margin-bottom: 0px;
    margin-top: 0px;
  }

  h1 {
    font-size: 2.4rem;
    font-weight: 500;
  }

  p {
    font-size: 28px;
  }

  button {
    margin-top: 1rem;
    border-radius: 12px;
    background: var(--med-green);
    font-size: 20px;
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: center;

    border: 1px solid var(--line );

    background: var(--med-green);
  }

  button:hover {
    transition: 100ms ease;
    border: 1px solid var(--accent);
  }
}

.landing-image-wrap {
  width: 40%;
  height: 80vh;
  flex-shrink: 0;
  position: relative;
}

.landing-image {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain !important;
  object-position: 64% 50% !important;
}

#results-section {
  width: 100vw;
  height: 100%;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.drop-zone {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1.2rem;
  text-align: center;
  transition: border-color 120ms ease, background-color 120ms ease;
  background: #fcfcfc;
  margin-top: 1rem;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: #f8fbff;
}

.text-input-wrap {
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  background: #f2f2f2;
  padding: 1.4rem 1.25rem;
  margin-top: 1rem;
}

.manual-text-input {
  display: block;
  width: min(520px, 100%);
  min-height: 140px;
  margin: 0 auto;
  border: none;
  border-radius: 8px;
  background: #dddddd;
  padding: 0.75rem 0.8rem;
  resize: vertical;
  font-size: 1rem;
  line-height: 1.4;
  color: #232323;
}

.manual-text-input:focus {
  outline: 1px solid #9f9f9f;
}

input[type="file"] {
  display: none;
}

.actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  /* display: inline-block; */
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  color: var(--text);
  text-decoration: none;
  /* background: var(--background); */
  cursor: pointer;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:enabled {
  background: var(--accent-2);
}

.btn:disabled,
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin-top: 1rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.25rem;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--ok);
}

.output {
  margin: 0;
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 1rem 0.7rem;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
  font-family: inherit;
  font-size: 1.02rem;
  line-height: 1.75;
  z-index: 1;
  position: relative;

  font-size: 3em;
  font-weight: bolder;
  -webkit-text-stroke: 2px black;
  color: white;
}

.bg-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  object-fit: cover;
  pointer-events: none;
}

.subtitle-overlay {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(90%, 780px);
  padding: 1.5rem 1.5rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: var(--custom-output-font-size);
  font-family: var(--custom-output-font-family);
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
  white-space: pre-wrap;
}

.subtitle-overlay.hidden {
  display: none;
}

.background-toggle {
  justify-content: center;
  margin-top: 0.5rem;
}

#bg-toggle-btn {
  background: white;
  border-color: #999;
}

#bg-toggle-btn:hover:enabled {
  background: #e0e0e0;
}

/* Video background ON state */
.output-wrap.bg-on .bg-video {
  display: block;
}

.output-wrap.bg-on .output {
  display: none;
}

.output-wrap.bg-on .subtitle-overlay {
  display: block;
}

.output-wrap.bg-on {
  aspect-ratio: 9 / 16;
  width: min(400px, 90vw);
  height: auto;
  margin: auto;
  position: relative;
  border-radius: var(--video-corner-radius);
  overflow: hidden;
}

/* Video background OFF state */
.output-wrap.bg-off .bg-video {
  display: none;
}

.output-wrap.bg-off .output {
  background: #f4f8f7;
}

.output-wrap.bg-off {
  width: 1160px;
  max-width: 97%;
  height: 68vh;
  aspect-ratio: auto;
}

/* Optional: Change text display when video is hidden */
.output-wrap.bg-off .output {
  font-family: inherit;
  font-size: 32px;
  font-weight: normal;
  -webkit-text-stroke: 0px black;
  color: black;
}

.source-box {
  width: min(640px, 90%);
  margin: 1.35rem auto 0;
  border: none;
  border-radius: 0;
  padding: 0;
  background: #f4f8f7;
}

.status-panel {
  width: min(640px, 90%);
  margin: 0.7rem auto 0;
  border: 1px solid #d5dbe1;
  border-radius: 0;
  padding: 0.85rem 1rem;
  background: #f4f8f7;
}

.status-panel.status-panel-centered {
  position: fixed;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  z-index: 20;
}

.results-content-area {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0.45rem;
  padding-top: 0.45rem;
}

.results-content-left {
  width: 100%;
  position: relative;
}

.output-back-btn {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid #d7dddd;
  border-radius: 50%;
  background: #eaf1ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.output-back-btn svg {
  width: 20px;
  height: 20px;
}

#results-section.tomomize-disabled:not(.setup-mode) .results-content-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  padding-top: 0;
}

#results-section.tomomize-disabled:not(.setup-mode) .results-content-left {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.tomomize-disabled:not(.setup-mode) .output-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.mode-play:not(.customize-open):not(.setup-mode) .results-content-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  padding-top: 0;
}

#results-section.mode-play:not(.customize-open):not(.setup-mode) .results-content-left {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
  background: #f4f8f7;
  padding: 20px 0.75rem 20px;
}

#results-section.mode-play:not(.customize-open):not(.setup-mode) .output-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.mode-play:not(.customize-open):not(.setup-mode) .output-wrap.bg-on {
  aspect-ratio: 9 / 16;
  width: min(
    700px,
    calc((100dvh - var(--navbar-height) - var(--playback-footer-height)) * 9 / 16),
    calc(100vw - 1.5rem)
  );
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
  margin: 0 auto 0.5rem;
}

#results-section.mode-play.customize-open .output-wrap.bg-on {
  aspect-ratio: 9 / 16;
  width: min(
    700px,
    calc((100dvh - var(--navbar-height) - var(--playback-footer-height)) * 9 / 16),
    calc(100vw - 1.5rem)
  );
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
  margin: 0 auto 0.5rem;
}

.status-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.loading-circle {
  width: 22px;
  height: 22px;
  border: 3px solid #b8d4ef;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-line {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
}

.status-line:last-child {
  margin-bottom: 0;
}

.status-detail {
  color: var(--muted);
}

.source-badge {
  margin: 0;
  color: #666;
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.output-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.output-note-error {
  color: var(--danger);
}

.output-body p {
  font-size: var(--custom-output-font-size);
  font-family: var(--custom-output-font-family);
  margin: 0 0 1.15rem;
}

.output-body p:last-child {
  margin-bottom: 0;
}

#results-section.mode-listen .output-body .lyric-sentence {
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease;
  color: #2b2b2b;
  opacity: 0.45;
  line-height: 190%;
  display: flex;
  align-items: center;
  gap: 10px;
}

#results-section.mode-listen .output-body .lyric-sentence .sentence-text {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  background: transparent;
}

#results-section.mode-listen .output-body .sentence-bookmark-btn {
  position: static;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

#results-section.mode-listen .output-body .sentence-bookmark-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

#results-section.mode-listen .output-body .sentence-bookmark-btn svg path {
  fill: none;
  stroke: var(--selected-bookmark-color);
  stroke-width: 3;
}

#results-section.mode-listen .output-body .lyric-sentence:hover .sentence-bookmark-btn,
#results-section.mode-listen .output-body .sentence-bookmark-btn:hover,
#results-section.mode-listen .output-body .sentence-bookmark-btn.is-bookmarked {
  opacity: 1;
  pointer-events: auto;
}

#results-section.mode-listen .output-body .sentence-bookmark-btn.is-bookmarked {
  opacity: 0;
  pointer-events: none;
}

#results-section.mode-listen .output-body .sentence-bookmark-btn.is-bookmarked svg path {
  fill: var(--selected-bookmark-color);
}

#results-section.mode-listen .output-body .lyric-sentence.is-bookmarked {
  background: transparent;
}

#results-section.mode-listen .output-body .lyric-sentence.is-bookmarked .sentence-text {
  background: var(--selected-highlight-color);
}

#results-section.mode-book .output-body p {
  line-height: 190%;
}

#results-section.mode-listen .output-body {
  width: 850px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#results-section.mode-book .output-body {
  width: 850px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

#results-section.mode-listen.customize-open .output-body {
  width: 850px;
  max-width: 100%;
}

#results-section.mode-listen .output-body .lyric-sentence.is-past {
  opacity: 0.72;
  color: #222;
}

#results-section.mode-listen .output-body .lyric-sentence.is-active {
  opacity: 1;
  color: #000;
  font-weight: 700;
  transform: none;
}

#results-section.mode-listen #output {
  padding: 80px 140px 1rem;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: auto;
  -ms-overflow-style: auto;
}

#results-section.mode-book #output {
  padding: 80px 140px 1rem;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: auto;
  -ms-overflow-style: auto;
}

#results-section.mode-listen:not(.customize-open) #output {
  padding-left: 280px;
  padding-right: 280px;
}

#results-section.mode-book:not(.customize-open) #output {
  padding-left: 280px;
  padding-right: 280px;
}

#results-section.mode-listen.customize-open #output {
  padding-top: 80px;
  padding-left: 140px;
  padding-right: 140px;
}

#results-section.mode-book.customize-open #output {
  padding-top: 80px;
  padding-left: 140px;
  padding-right: 140px;
}

#results-section.mode-listen.customize-open .results-content-area {
  justify-content: center;
  padding-right: 350px;
}

#results-section.mode-listen.customize-open .source-box,
#results-section.mode-listen.customize-open .status-panel,
#results-section.mode-listen.customize-open .output-wrap {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

#results-section.mode-listen .results-content-left {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.mode-book .results-content-left {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.mode-listen .results-content-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  padding-top: 0;
}

#results-section.mode-book .results-content-area {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  padding-top: 0;
}

#results-section.mode-listen .output-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

#results-section.mode-book .output-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
}

#results-section.mode-listen #output::-webkit-scrollbar,
#results-section.mode-book #output::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.tts-controls {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 1rem;
}

.meta-footer {
  margin-top: auto;
  padding: 0;
  background: #f4f8f7;
  position: sticky;
  bottom: 0;
  z-index: 30;
}

.meta-context-row {
  min-height: 62px;
  background: #f4f8f7;
  border: 1px solid #d6d6d6;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
}

.meta-context-text {
  margin: 0;
  color: #111;
  font-size: 1.06rem;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  justify-self: start;
}

.meta-title {
  font-weight: 500;
}

.meta-author-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.meta-by,
.meta-author {
  color: #252525;
  font-size: 0.8rem;
  font-weight: 400;
}

/**
  * Playback controls
  */

.footer-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  flex: 0 0 auto;
}

.footer-player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 360px;
}

.footer-player-center.footer-player-center-inactive {
  visibility: hidden;
  pointer-events: none;
}

.footer-progress-wrap {
  display: flex;
  /* align-items: center; */
  justify-content: center;
  width: 340px;
  padding-top: 12px;
  padding-bottom: 8px;
}

.footer-progress {
  width: 100%;
  /* height: 16px; */
  margin: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}

.footer-progress::-webkit-slider-runnable-track {
  height: 4px;
  /* background: #1b1b1b; */
  background: var(--accent);
  border-radius: 999px;
}

.footer-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #111;
  margin-top: -4px;
}

.footer-progress::-moz-range-track {
  height: 1rem;
  background: #1b1b1b;
  border-radius: 999px;
}

.footer-progress::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #111;
}

.footer-control-btn {
  border: none;
  background: transparent;
  color: #181818;
  height: 30px;
  border-radius: 8px;
  font-size: 0.88rem;
  padding: 0.2rem 0.32rem;
  outline: none;
  box-shadow: none;
}

.footer-control-btn {
  min-width: 38px;
}

.footer-play-btn {
  min-width: 44px;
  font-weight: 600;
}

.transport-icon {
  display: block;
  width: 16px;
  height: 16px;
}

.footer-control-btn:hover {
  background: #fafafa;
}

.footer-control-btn:focus,
.footer-control-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.footer-speed-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.2rem;
  border-radius: 8px;
}

.footer-speed-value {
  min-width: 34px;
  text-align: center;
  font-size: 0.86rem;
  color: #1f1f1f;
}

.footer-speed-buttons {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
}

.footer-speed-step-btn {
  width: 18px;
  height: 14px;
  border: none;
  border-radius: 4px;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.footer-speed-step-btn:hover:enabled {
  background: #fafafa;
}

.footer-speed-step-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.footer-speed-step-btn:focus,
.footer-speed-step-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.ui-divider-svg {
  width: 2px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
  margin: 0 0.12rem;
}

.footer-quick-actions {
  justify-self: end;
  padding-left: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.quick-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.quick-icon-btn {
  border: none;
  background: transparent;
  color: #232323;
  width: 34px;
  height: 32px;
  border-radius: 6px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.quick-icon-btn:hover {
  background: #f2f2f2;
}

.quick-icon-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quick-icon-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.quick-icon-bookmark {
  width: 15px;
  height: 20px;
  display: block;
}

.mode-dot {
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.quick-icon-btn.mode-active .mode-dot {
  opacity: 1;
  visibility: visible;
}

.quick-icon-btn.mode-active .quick-icon-svg path {
  stroke: #17a592;
}

.quick-icon-btn.mode-active .quick-icon-bookmark path {
  stroke: #17a592;
}

.quick-icon-btn.mode-active .mode-dot circle {
  fill: #17a592;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tts-launch {
  margin-top: 0.7rem;
  justify-content: center;
}

.file-actions {
  display: none;
}

.file-actions .btn {
  border: none;
  background: transparent;
  padding: 0;
  color: #262626;
  text-decoration: underline;
}

.output-wrap {
  width: 1160px;
  max-width: 97%;
  margin: 0.2rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
  overflow: hidden;
  height: 68vh;
}

.customize-panel {
  width: 350px;
  min-height: 100vh;
  height: 100vh;
  border: 1px solid #d6d6d6;
  box-shadow: -10px 0 24px rgba(0, 0, 0, 0.08);
  background: #f4f8f7;
  padding: 0 0.9rem 1rem;
  margin-top: 0.35rem;
  flex: 0 0 350px;
  transform: none;
  transition: none;
  will-change: auto;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  margin-top: 0;
  border-right: none;
  overflow: auto;
  z-index: 25;
}

.customize-panel.minimized {
  width: 52px;
  min-width: 52px;
  padding: 0;
  overflow: hidden;
}

.customize-panel.minimized .customize-header,
.customize-panel.minimized .customize-controls {
  display: none;
}

.customize-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.95rem;
  padding-bottom: 0;
  padding-left: 0.08rem;
}

.customize-icon-svg {
  width: 26px;
  height: 26px;
  display: block;
  flex: 0 0 auto;
}

.customize-close-btn {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.customize-open-btn {
  display: none;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.customize-open-btn svg {
  width: 26px;
  height: 26px;
}

.customize-panel.minimized .customize-open-btn {
  display: inline-flex;
}

.customize-title {
  font-size: 20px;
  font-weight: 400;
  color: #222;
}

.customize-controls {
  margin-top: 0.75rem;
  display: grid;
  gap: 1rem;
}

.play-mode-only {
  display: none;
}

#results-section.mode-play .play-mode-only {
  display: block;
}

.watch-mode-only,
.podcast-mode-only,
.reading-mode-only {
  display: none;
}

#results-section.mode-play .watch-mode-only {
  display: block;
}

#results-section.mode-play .customize-controls {
  display: flex;
  flex-direction: column;
}

#results-section .customize-panel.minimized .customize-controls,
#results-section .customize-panel.minimized .customize-header {
  display: none;
}

#results-section.mode-play .customize-controls > section[aria-label="Background selection"] {
  order: 1;
}

#results-section.mode-play .customize-controls > section[aria-label="Voice selection"] {
  order: 2;
}

#results-section.mode-play .customize-controls > section[aria-label="Presentation modes"] {
  order: 3;
}

#results-section.mode-play .customize-controls > section[aria-label="Text controls"] {
  order: 4;
}

#results-section.mode-play .customize-controls > #output-actions {
  order: 5;
}

#results-section.mode-listen .podcast-mode-only {
  display: block;
}

#results-section.mode-book .reading-mode-only {
  display: block;
}

#results-section.mode-play .non-play-mode-only {
  display: none;
}

#results-section.mode-play .podcast-only-row {
  display: flex;
}

#results-section.mode-play .non-podcast-row {
  display: none;
}

#results-section.mode-play .output-body {
  display: none;
}

.customize-card {
  border: 1px solid #eeeeee;
  border-radius: 10px;
  background: #f4f8f7;
  padding: 0.75rem 0.75rem 0.82rem;
}

.customize-card-title {
  margin: 0 0 0.65rem;
  font-size: 14px;
  font-weight: 600;
  color: #111;
  margin-left: -0.04rem;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.background-thumb {
  width: 100%;
  aspect-ratio: 1.65 / 1;
  border-radius: 8px;
  border: 1px solid #c6c6c6;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 32%, rgba(186, 216, 255, 0.9) 0, rgba(186, 216, 255, 0) 33%),
    radial-gradient(circle at 65% 58%, rgba(121, 112, 231, 0.9) 0, rgba(121, 112, 231, 0) 39%),
    linear-gradient(135deg, #1c3f7d 0%, #4b5dd7 38%, #7647c5 72%, #7cb8e8 100%);
}

.background-thumb::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.2rem 0.35rem;
  font-size: 0.72rem;
  color: #fff;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
  text-align: left;
}

.background-thumb.is-active {
  border: 2px solid #17a592;
  box-shadow: none;
}

.background-thumb-upload {
  background: #f4f8f7;
  border-style: dashed;
}

.background-thumb-upload::before {
  content: "+";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  font-size: 1.4rem;
  color: #6a6a6a;
  line-height: 1;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.voice-btn {
  min-height: 30px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #f4f8f7;
  font-size: 14px;
  color: #2f2f2f;
  cursor: pointer;
}

.voice-btn.is-active {
  border-color: #000;
  border-width: 1px;
  background: #f4f8f7;
}

.customize-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.customize-field {
  display: grid;
  gap: 0.3rem;
}

.customize-label {
  font-size: 14px;
  color: #2f2f2f;
}

.customize-select {
  width: 100%;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  background: #f4f8f7;
  padding: 0.5rem 1.4rem 0.5rem 0.62rem;
  font-size: 14px;
  color: #1f1f1f;
}

#customize-size {
  width: 80px;
}

.customize-toggle-list {
  display: grid;
  gap: 0.42rem;
}

.podcast-only-row {
  display: none;
}

.customize-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  font-size: 14px;
  color: #222;
}

.tomomize-switch {
  width: 24px;
  height: 14px;
  border-radius: 999px;
  border: none;
  background: #b7b7b7;
  position: relative;
  cursor: pointer;
}

.tomomize-switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f4f8f7;
  transform: translateY(-50%);
}

.tomomize-switch.is-on {
  background: #17a592;
}

.tomomize-switch.is-on::before {
  left: 11px;
}

.podcast-toggle-switch {
  width: 40px;
  height: 24px;
  border: none;
}

.podcast-toggle-switch::before {
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
}

.podcast-toggle-switch.is-on::before {
  left: 20px;
}

.customize-divider {
  border-top: 1px solid #d4d4d4;
  margin: 0.35rem 0 0.45rem;
}

.customize-label-color {
  margin: 0;
  font-weight: 700;
}

.customize-highlight-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.customize-highlight-swatch {
  width: 100%;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.customize-highlight-swatch.is-active {
  border: 1px solid #1f1f1f;
}

.customize-highlight-swatch-peach {
  background: #e4f2f0;
}

.customize-highlight-swatch-yellow {
  background: #f5e1db;
}

.customize-highlight-swatch-clear {
  background: #f6fcc5;
}

.customize-highlight-swatch-blue {
  background: #e4f2f7;
}

#results-section.customize-open .results-content-area {
  justify-content: flex-end;
  max-width: none;
  margin: 0;
  padding: 0 350px 0 0;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

#results-section.mode-play.customize-open .results-content-left {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
  background: #f4f8f7;
  padding: 20px 0.75rem 20px;
}

#results-section.mode-play.customize-open .results-content-area {
  justify-content: flex-end;
  padding-right: 350px;
}

#results-section.customize-open .source-box,
#results-section.customize-open .status-panel,
#results-section.mode-play.customize-open .output-wrap {
  width: min(900px, 100%);
  margin-left: auto;
  margin-right: auto;
}

#results-section.mode-play.customize-open .output-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}

#results-section.customize-open .customize-panel {
  min-height: 100vh;
  height: 100vh;
  padding-top: 0;
}

.output-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  background-color: white;
  z-index: 1;
}

.output-actions #regenerate-btn,
.output-actions .upload-again-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 1.8rem;
  border-radius: 18px;
  font-size: 0.98rem;
  line-height: 1;
}

.srt-options {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.srt-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
  color: #666;
  cursor: pointer;
}

.srt-option input[type="checkbox"] {
  margin: 0;
}

.customize-actions {
  margin-top: 0;
  padding-top: 0;
  display: grid;
  width: 100%;
  justify-content: start;
  align-items: start;
  justify-items: start;
  gap: 0.8rem;
  background: transparent;
}

#results-section .customize-actions .srt-options,
#results-section .customize-actions .upload-again-btn {
  display: none;
}

.customize-actions #regenerate-btn,
.customize-actions .upload-again-btn {
  min-height: 40px;
  border-radius: 10px;
  padding: 0 0.95rem;
  font-size: 14px;
  justify-content: flex-start;
  border: 1px solid #dbdbdb;
  background: #f4f8f7;
  color: #2b2b2b;
}

#regenerate-btn {
  font-size: 16px;
}

.upload-again-btn {
  text-decoration: none;
}

/* .window-titlebar {
  border-bottom: 1px solid #cfcfcf;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.window-title {
  font-size: 2rem;
  font-weight: 500;
} */

.profile-icon {
  width: 2rem;
  height: 2rem;
  border: 1px solid #777;
  border-radius: 100%;

  img {
    width: 100%;
    height: 100%;
    border-radius: 100%;
    display: block;
  }
}

.upload-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.upload-card {
  width: min(640px, 92%);
  border: 1px solid #c9c9c9;
  border-radius: 10px;
  padding: 2.4rem 2rem 1.7rem;
  background: var(--bg);
  transform: translateY(-22px);
}

.upload-card h1 {
  margin-bottom: 1rem;
  font-size: 2.1rem;
  font-weight: 500;
  border-bottom: 1px solid #cdcdcd;
  padding-bottom: 0.5rem;
}

.upload-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.upload-tab {
  border-radius: 8px;
  text-align: center;
  padding: 0.8rem 0.75rem;
  font-size: 1.45rem;
  font-weight: 600;
  background: #fff;
}

.upload-tab.active {
  background: #fefefe;
}

.length-panel {
  width: min(640px, 90%);
  margin: 1rem auto 0;
}

.metadata-panel {
  width: min(640px, 90%);
  margin: 1rem auto 0;
}

.metadata-card {
  border: 1px solid #c9c9c9;
  border-radius: 10px;
  padding: 1.25rem 1.15rem 1.1rem;
  background: var(--bg);
  width: min(640px, 92%);
  margin: auto;
}

.metadata-card h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid #cdcdcd;
  padding-bottom: 0.45rem;
}

.metadata-fields {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding-bottom: 0.9rem;
}

.metadata-fields label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f1f1f;
}

.metadata-fields input {
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #fff;
  padding: 0.58rem 0.65rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.metadata-card .actions {
  margin-top: 0.85rem;
  border-top: 1px solid #cdcdcd;
  padding-top: 0.9rem;
  justify-content: center;
}

.length-card {
  border: 1px solid #c9c9c9;
  border-radius: 10px;
  padding: 1.25rem 1.15rem 1.1rem;
  background: var(--bg);
  width: min(640px, 92%);
  margin: auto;
}

.length-card h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid #cdcdcd;
  padding-bottom: 0.45rem;
}

.upload-continue {
  margin-top: 0.95rem;
  border-top: 1px solid #cdcdcd;
  padding-top: 0.95rem;
  justify-content: center;
}

.output-length-row {
  margin-top: 1rem;
  padding-bottom: 0.9rem;
  flex-direction: column;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  position: relative;
}

.complexity-label-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.length-label {
  font-size: 1.05rem;
  font-weight: 400;
  color: #171717;
  line-height: 1.05;
}

.complexity-info-btn {
  border: none;
  background: transparent;
  width: 19px;
  height: 19px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #1e1e1e;
}

.complexity-info-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.complexity-info-btn:hover {
  opacity: 0.78;
}

.complexity-info-popup {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateY(calc(-100% - 0.55rem));
  z-index: 10;
  width: min(100%, 620px);
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  background: #fff;
  padding: 0.52rem 0.72rem 0.56rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.complexity-popup-title {
  margin: 0;
  text-align: center;
  font-size: 1.55rem;
  font-weight: 500;
  color: #191919;
}

.complexity-popup-list {
  margin: 0.34rem 0 0;
  padding-left: 1rem;
  font-size: 0.92rem;
  color: #161616;
  line-height: 1.38;
}

.complexity-popup-list li + li {
  margin-top: 0.1rem;
}

.length-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.length-option {
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #fff;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.length-option-label {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
}

.length-option-bones {
  display: inline-flex;
  align-items: center;
  gap: 0.08rem;
}

.bone-icon {
  width: 15px;
  height: 15px;
  color: #1e1e1e;
  display: block;
}

.length-option.active {
  border-color: #5d5d5d;
  background: #ececec;
}

.tone-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.tone-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.55rem;
}

.tone-option {
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #fff;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  width: 100%;
  grid-column: span 2;
}

.tone-option:nth-child(4) {
  grid-column: 2 / span 2;
}

.tone-option:nth-child(5) {
  grid-column: 4 / span 2;
}

.tone-option.active {
  border-color: #5d5d5d;
  background: #ececec;
}

.length-card .actions {
  margin-top: 0.85rem;
  border-top: 1px solid #cdcdcd;
  padding-top: 0.9rem;
  justify-content: center;
}

#results-section.setup-mode #metadata-panel,
#results-section.setup-mode #length-panel {
  width: min(640px, 92%);
  height: auto;
  margin: auto !important;
  padding: 0;
  display: block;
  transform: none;
}

#results-section.setup-mode {
  flex: 1 1 auto;
  min-height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

#results-section.setup-mode #results-content-area {
  display: none;
}

#results-section.setup-mode .metadata-card,
#results-section.setup-mode .length-card {
  width: 100%;
}

/** Utility Classes */

.hidden {
  display: none !important;
}

@media (min-width: 981px) {
  .output-wrap.bg-on {
    width: min(600px, 90vw);
  }
}

@media (max-width: 720px) {
  .container {
    width: 100vw;
    min-height: 100vh;
    padding-top: 0;
  }

  .card {
    padding: 1rem;
  }

  .tone-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tone-option,
  .tone-option:nth-child(4),
  .tone-option:nth-child(5) {
    grid-column: auto;
  }

  .upload-card,
  #results-section.setup-mode #metadata-panel,
  #results-section.setup-mode #length-panel {
    transform: none;
  }

  .output {
    max-height: none;
  }

  .meta-context-row {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .footer-player-center {
    width: 100%;
    align-items: flex-start;
    min-width: 0;
  }

  .footer-player-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .footer-progress-wrap {
    width: 100%;
  }

  .footer-quick-actions {
    width: 100%;
    border-left: none;
    border-top: 1px solid #d2d2d2;
    padding-left: 0;
    padding-top: 0.45rem;
    align-items: flex-start;
  }

  .meta-context-text {
    font-size: 0.98rem;
  }

  .meta-by,
  .meta-author {
    font-size: 0.9rem;
  }

  .length-label {
    font-size: 0.98rem;
  }

  .complexity-popup-title {
    font-size: 1.2rem;
  }

  .complexity-popup-list {
    font-size: 0.84rem;
  }

  .length-option-label {
    font-size: 0.95rem;
  }

  .results-content-area {
    display: block;
  }

  .customize-panel {
    width: min(640px, 92%);
    min-height: auto;
    margin: 0.85rem auto 0;
  }

  #results-section.customize-open .results-content-area {
    padding-right: 0;
  }

  #results-section.customize-open .customize-panel {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    border-right: 1px solid #d6d6d6;
    overflow: visible;
  }

  .login-card {
    transform: translateY(-12px);
  }

  .social-login-btn {
    height: 54px;
  }
}


@media (max-width: 980px) {
  :root {
    --navbar-height: 52px;
  }

  .app-navbar {
    height: 52px;
    margin-top: 0;
  }

  .container {
    width: 96vw;
    margin-bottom: 18px;
    min-height: auto;
  }

  #upload-section {
    min-height: auto;
    height: 100vh;
  }

  .landing-content {
    flex-direction: column;
    align-items: start;
    text-align: left;
    gap: 14px;
  }

  .landing-copy {
    align-items: start;
  }

  .landing-title,
  .landing-subtitle {
    text-align: center;
  }

  .landing-image-wrap {
    width: min(420px, 90vw);
    height: min(560px, 56vh);
  }
}

/* Login page */
.login-page {
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
}

#login-section {
  width: 100vw;
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.login-brand {
  color: inherit;
  text-decoration: none;
}

.login-stage {
  padding: 1.5rem;
}

.login-card {
  width: min(560px, 92%);
  transform: translateY(-18px);
}

.login-card h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2.4rem, 3.2vw, 3rem);
  font-weight: 600;
  text-align: center;
}

.login-actions {
  display: grid;
  gap: 0.9rem;
}

.social-login-btn {
  width: 100%;
  height: 58px;
  border: 1px solid #d3d3d3;
  border-radius: 12px;
  background: #f8f8f8;
  color: #111111;
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  cursor: pointer;
}

.social-login-btn:hover {
  background: #ffffff;
}

.social-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.google-logo {
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  background: conic-gradient(
    from -20deg,
    #4285f4 0 22%,
    #34a853 22% 50%,
    #fbbc05 50% 75%,
    #ea4335 75% 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.microsoft-logo {
  width: 26px;
  height: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
}

.microsoft-logo span:nth-child(1) { background: #f25022; }
.microsoft-logo span:nth-child(2) { background: #7fba00; }
.microsoft-logo span:nth-child(3) { background: #00a4ef; }
.microsoft-logo span:nth-child(4) { background: #ffb900; }

.login-status {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.95rem;
  color: #5a5a5a;
}

.login-status.pending {
  color: #1f547b;
}

.login-status.error {
  color: #b42318;
}
