:root {
  --blue: #0878ff;
  --blue-dark: #065fd1;
  --blue-soft: #eef6ff;
  --navy: #06133c;
  --ink: #071633;
  --muted: #667085;
  --border: #e4eaf3;
  --surface: #ffffff;
  --bg: #f5f8fc;
  --danger: #d92d20;
  --success: #12b76a;
  --orange: #ff6500;
  --orange-red: #ff2f22;
  --green: #70b90b;
  --teal: #05b8c7;
  --gold: #ff9d00;
  --sidebar-width: 260px;
  --header-height: 128px;
  --shadow: 0 10px 30px rgba(6, 19, 60, 0.08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.app {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: 0 0 auto;
  width: 100%;
  min-height: var(--header-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(8, 120, 255, 0.04);
}
.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue) 0 28%, var(--teal) 28% 46%, var(--green) 46% 62%, var(--gold) 62% 74%, var(--orange) 74% 88%, var(--orange-red) 88% 100%);
}

.header-start,
.header-end {
  display: flex;
  align-items: center;
  min-width: 0;
}
.header-start { justify-self: start; gap: 8px; }
.header-end { justify-self: end; }

.header-logo {
  display: flex;
  align-items: center;
  height: 104px;
  max-width: 480px;
  text-decoration: none;
}
.header-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 460px;
  max-height: 96px;
  object-fit: contain;
  object-position: left center;
}

.page-context {
  min-width: 0;
  text-align: center;
  justify-self: center;
}
.page-context h1,
.page-context .page-kicker {
  margin: 0;
  color: var(--navy);
  font-size: 32px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.02em;
}
.page-context p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
}

.app-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  padding: 18px 14px 16px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: auto;
}
.main-nav { display: grid; gap: 6px; }
.nav-primary,
.nav-section { display: grid; gap: 6px; }
.nav-section {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.nav-section-label {
  margin: 0 0 2px;
  padding: 0 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.3;
  pointer-events: none;
  user-select: none;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #344054;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 650;
  text-decoration: none;
}
.nav-item:hover { background: var(--blue-soft); }
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}
.nav-icon { width: 22px; text-align: center; font-size: 18px; }
.nav-item[data-view="home"] .nav-icon { color: var(--blue); }
.nav-item[data-view="record"] .nav-icon { color: var(--orange-red); }
.nav-item[data-view="library"] .nav-icon { color: var(--teal); }
.nav-item[data-view="settings"] .nav-icon { color: var(--green); }
.nav-section-ai .nav-item .nav-icon { color: var(--orange); }
.sidebar-footer { margin-top: auto; padding: 16px 10px 4px; color: var(--muted); line-height: 1.45; }
.sidebar-footer small { display: block; margin-top: 10px; }
.credit-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.credit-block strong {
  display: block;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}
.credit-block span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.privacy-badge {
  display: inline-flex;
  padding: 6px 9px;
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.main-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
}

.view { display: none; padding: 18px 22px 24px; max-width: 1280px; }
.view.active { display: block; }
#view-home.view.active { padding: 10px 20px 12px; max-width: none; }
#view-record.view.active {
  display: flex;
  flex-direction: column;
  max-width: none;
  height: 100%;
  padding: 12px 16px 14px;
  overflow: hidden;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.mode-card {
  min-height: 118px;
  max-height: 140px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  box-shadow: 0 6px 18px rgba(6, 19, 60, .05);
  border-radius: 14px;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
}
.mode-card:nth-child(2) { border-top-color: var(--orange); }
.mode-card:nth-child(3) { border-top-color: var(--green); }
.mode-card:hover { border-color: #c5d8fb; transform: translateY(-1px); }
.mode-card.selected {
  border-color: var(--blue);
  background: #f9fbff;
  box-shadow: 0 10px 24px rgba(8, 120, 255, .10);
}
.mode-card:nth-child(2).selected { border-color: var(--orange); background: #fffaf6; }
.mode-card:nth-child(3).selected { border-color: var(--green); background: #f8fff3; }
.mode-icon { font-size: 22px; color: var(--blue); }
.mode-card:nth-child(2) .mode-icon { color: var(--orange); }
.mode-card:nth-child(3) .mode-icon { color: var(--green); }
.mode-card strong { font-size: 16px; }
.mode-card span:last-child { color: var(--muted); line-height: 1.35; font-size: 12px; }

.quick-settings-card {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(140px, 1.4fr) minmax(120px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.quick-setting, .field-group { display: grid; gap: 8px; }
.quick-setting { gap: 4px; }
.quick-setting label, .field-group label { color: #344054; font-weight: 700; font-size: 12px; }
select, input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}
#view-home select { min-height: 42px; }
select:focus, input[type="text"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(8, 120, 255, .12);
}
.switch-setting { min-width: 120px; display: grid; gap: 4px; justify-items: start; }
.switch-setting label { font-size: 12px; font-weight: 700; color: #344054; }
.switch {
  width: 48px;
  height: 27px;
  border: 0;
  border-radius: 999px;
  background: #d0d5dd;
  padding: 3px;
  position: relative;
  transition: .2s ease;
}
.switch span {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  display: block;
  transition: .2s ease;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .25);
}
.switch.on { background: var(--blue); }
.switch.on span { transform: translateX(21px); }
#quickWebcam.on, #webcamToggle.on { background: var(--orange); }
#micToggle.on { background: var(--green); }

.start-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 6px;
}
.start-meta p { margin: 0; color: var(--muted); font-size: 13px; }
.privacy-note { margin: 4px 0 0; color: #98a2b3; font-size: 11px; line-height: 1.35; }
.support-chip {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 12px;
}
.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, .12);
}

.primary-button, .secondary-button, .danger-button, .record-button, .icon-button {
  border-radius: 11px;
  min-height: 44px;
  border: 1px solid transparent;
  font-weight: 750;
}
.primary-button {
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
}
.header-end .primary-button {
  min-height: 54px;
  padding: 0 22px;
  font-size: 16px;
}
.primary-button:hover { background: var(--blue-dark); }
.secondary-button {
  background: #fff;
  color: #344054;
  border-color: #d0d5dd;
  padding: 0 16px;
}
.secondary-button:hover { background: #f9fafb; }
.danger-button {
  background: #fff;
  color: var(--danger);
  border-color: #fecdca;
  padding: 0 16px;
}
.danger-button:hover { background: #fff5f4; }
.record-button {
  min-height: 46px;
  padding: 0 20px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 18px rgba(8, 120, 255, .22);
}
.record-button:hover { background: var(--blue-dark); }
.record-button span { color: #fff; margin-right: 8px; }
.large { min-height: 48px; }
.icon-button {
  width: 44px;
  background: transparent;
  color: #344054;
  font-size: 22px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.info-grid article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  min-height: 110px;
  max-height: 140px;
}
.info-grid article:nth-child(1) { border-top: 3px solid var(--green); }
.info-grid article:nth-child(2) { border-top: 3px solid var(--teal); }
.info-grid article:nth-child(3) { border-top: 3px solid var(--orange); }
.info-grid h3 { margin: 0 0 4px; font-size: 14px; }
.info-grid p { margin: 0; color: var(--muted); line-height: 1.35; font-size: 12px; }

.home-promo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 10px;
  margin-top: 10px;
  align-items: stretch;
}
.home-demo-card,
.home-banner-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(6, 19, 60, .05);
  min-height: 168px;
  max-height: 210px;
  overflow: hidden;
}
.home-demo-card {
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.home-demo-card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--navy);
}
.home-demo-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.home-demo-watch {
  align-self: flex-start;
  text-decoration: none;
}
.home-banner-card {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-banner-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 194px;
  object-fit: contain;
  object-position: center;
}

.recorder-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: stretch;
}
.preview-card, .settings-card, .settings-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(6, 19, 60, .04);
}
.preview-card {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  transition: box-shadow .4s ease, border-color .4s ease;
}
/* html.is-recording / .is-paused are already toggled by app.js on every
   recording state change but previously had no styling anywhere — this
   gives the preview a subtle "recording frame" glow so the active state
   reads clearly at a glance, not just from the small badge. */
html.is-recording .preview-card {
  border-color: rgba(255, 47, 34, .35);
  box-shadow: 0 0 0 1px rgba(255, 47, 34, .18), 0 10px 30px rgba(255, 47, 34, .12);
}
html.is-paused .preview-card {
  border-color: rgba(255, 157, 0, .4);
  box-shadow: 0 0 0 1px rgba(255, 157, 0, .18), 0 10px 30px rgba(255, 157, 0, .1);
}
@media (prefers-reduced-motion: reduce) {
  .preview-card { transition: none; }
}
.recording-topline { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex: 0 0 auto; }
.capture-hint,
.capture-warning {
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.capture-hint {
  background: var(--blue-soft);
  color: #173f8d;
  border: 1px solid rgba(8, 120, 255, .14);
}
.capture-warning {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid rgba(255, 101, 0, .28);
}
.capture-warning strong { display: block; margin-bottom: 2px; }
.capture-hint[hidden],
.capture-warning[hidden] { display: none !important; }
.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f2f4f7;
  color: #475467;
  font-size: 13px;
}
.recording-badge span { width: 9px; height: 9px; border-radius: 50%; background: #98a2b3; }
.recording-badge.live { background: #fff1f0; color: #b42318; }
.recording-badge.live span {
  background: var(--orange-red);
  box-shadow: 0 0 0 4px rgba(255, 47, 34, .12);
  animation: pulse 1.2s infinite;
}
.recording-badge.paused { background: #fffaeb; color: #b54708; }
.recording-badge.paused span { background: var(--gold); }
@keyframes pulse { 50% { opacity: .4; } }
.timer { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 800; }
.storage-status { margin-left: auto; color: var(--muted); font-size: 13px; }

.preview-stage {
  position: relative;
  flex: 1 1 auto;
  width: min(100%, calc((100vh - var(--header-height) - 9.75rem) * 16 / 9));
  max-height: calc(100vh - var(--header-height) - 9.75rem);
  min-height: 180px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border-radius: 12px;
  background: #0b0f18;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.preview-stage video#screenPreview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #090d15;
}
.camera-preview {
  display: none;
  position: absolute;
  right: 3.5%;
  bottom: 5%;
  width: 22%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, .92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  z-index: 3;
  touch-action: none;
  cursor: grab;
}
.camera-preview:active { cursor: grabbing; }
.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  color: #d0d5dd;
  text-align: center;
  padding: 30px;
}
.preview-placeholder h2 { margin: 10px 0 3px; color: #fff; }
.preview-placeholder p { margin: 0; }
.large-record-icon { color: var(--orange-red); font-size: 48px; }
.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: clamp(56px, 10vw, 140px);
  font-weight: 900;
  z-index: 9;
}
.countdown[hidden] { display: none !important; }
.record-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  flex: 0 0 auto;
}
.record-controls .large { min-height: 42px; }
.settings-card {
  padding: 12px 14px 14px;
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 28px);
  overflow-y: auto;
}
.settings-card h2 { margin: 0 0 10px; color: var(--navy); font-size: 16px; }
.settings-card .field-group { margin-bottom: 10px; }
.settings-card select { min-height: 36px; }
.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  background: #f2f4f7;
  border-radius: 10px;
}
.segmented button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  min-height: 38px;
  color: #475467;
  font-size: 12px;
  font-weight: 750;
}
.segmented button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(16, 24, 40, .12);
}
.setting-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #f2f4f7;
}
.setting-line strong { display: block; font-size: 13px; }
.setting-line small { display: block; margin-top: 2px; color: var(--muted); line-height: 1.3; font-size: 11px; }
.tip-box {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: #173f8d;
  border: 1px solid rgba(8, 120, 255, .12);
}
.tip-box p { margin: 4px 0 0; line-height: 1.4; font-size: 12px; }

.section-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--navy); }
.section-heading p { margin: 4px 0 0; color: var(--muted); }
.empty-state {
  background: #fff;
  border: 1px dashed #cfd6e4;
  min-height: 280px;
  border-radius: 16px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
}
.empty-state h3 { margin: 12px 0 4px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }
.empty-icon { font-size: 46px; color: #98a2b3; }
.library-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 200px 200px;
  gap: 14px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.recordings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.recording-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.recording-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy), var(--blue) 55%, var(--teal));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 44px;
}
.recording-card-body { padding: 16px; }
.recording-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recording-meta { color: var(--muted); font-size: 12px; line-height: 1.6; }
.card-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; }
.card-actions button { min-height: 36px; padding: 0 11px; font-size: 12px; }

.settings-page-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.settings-panel { padding: 22px; }
.settings-panel h2 { margin: 0 0 18px; color: var(--navy); }
.settings-panel .field-group { margin-bottom: 16px; }
.storage-meter { height: 10px; background: #f2f4f7; border-radius: 999px; overflow: hidden; }
.storage-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--green));
  transition: width .25s ease;
}
.compat-list { margin: 0 0 16px; padding-left: 20px; color: #344054; }
.compat-list li { margin: 8px 0; }
.settings-note { color: var(--muted); line-height: 1.55; }

.complete-dialog, .message-dialog {
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0;
  width: min(850px, calc(100% - 28px));
}
.message-dialog { width: min(470px, calc(100% - 28px)); padding: 24px; }
dialog::backdrop { background: rgba(15, 23, 42, .58); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: start; padding: 22px 24px 12px; }
.dialog-header h2 { margin: 4px 0 0; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: 12px; letter-spacing: .14em; margin: 0; }
.complete-dialog > video {
  width: calc(100% - 48px);
  margin: 0 24px;
  background: #000;
  border-radius: 12px;
  max-height: 58vh;
}
.complete-meta { padding: 12px 24px 0; color: var(--muted); font-size: 13px; }
.rename-row { padding: 16px 24px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 18px 24px 24px; }
.message-dialog h2 { margin-top: 0; }
.message-dialog p { color: var(--muted); line-height: 1.55; }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  :root { --header-height: 108px; }
  .header-logo { height: 86px; max-width: 360px; }
  .header-logo img { max-width: 340px; max-height: 80px; }
  .page-context h1,
  .page-context .page-kicker { font-size: 26px; }
  .page-context p { font-size: 15px; }
  .quick-settings-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recorder-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-card {
    order: 0;
    max-height: min(42vh, calc(100vh - var(--header-height) - 28px));
  }
  .preview-stage {
    width: min(100%, calc((100vh - var(--header-height) - 16rem) * 16 / 9));
    max-height: calc(100vh - var(--header-height) - 16rem);
  }
  .settings-page-grid { grid-template-columns: 1fr 1fr; }
  .library-toolbar { grid-template-columns: 1fr 1fr; }
  .home-promo { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}
@media (max-width: 900px) {
  :root { --header-height: 80px; }
  .app-header {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 8px 12px;
  }
  .header-logo { height: 62px; max-width: 240px; }
  .header-logo img { max-width: 230px; max-height: 56px; }
  .page-context h1,
  .page-context .page-kicker { font-size: 20px; }
  .page-context p { display: none; }
  .header-end .primary-button { min-height: 44px; font-size: 14px; }
}

@media (max-width: 820px) {
  .app-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    min-height: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; place-items: center; }
  .page-context { display: none; }
  .header-end .primary-button {
    font-size: 0;
    width: 46px;
    padding: 0;
  }
  .header-end .primary-button::after {
    content: "+";
    font-size: 24px;
  }
  .view { padding: 16px 14px 28px; }
  html, body { overflow: auto; height: auto; }
  .app { height: auto; min-height: 100%; overflow: visible; }
  #view-record.view.active { height: auto; overflow: visible; }
  .mode-grid, .info-grid, .settings-page-grid, .library-toolbar, .quick-settings-card, .home-promo {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-demo-card,
  .home-banner-card {
    max-height: none;
    min-height: 0;
  }
  .home-demo-frame { min-height: 140px; }
  .home-banner-card img { max-height: 180px; }
  .start-row { align-items: flex-start; flex-direction: column; }
  .record-controls { flex-wrap: wrap; }
  .record-controls button { flex: 1 1 130px; }
  .storage-status { display: none; }
}

@media (max-width: 520px) {
  :root { --header-height: 64px; }
  .header-logo { max-width: 168px; height: 48px; }
  .header-logo img { max-width: 168px; max-height: 40px; }
}

.app-header {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.header-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}
.header-mid .page-context { justify-self: center; }
.header-mid .page-context h1,
.header-mid .page-context .page-kicker { font-size: 22px; }
.header-mid .page-context p { font-size: 13px; }
.header-end { gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.app-header .public-nav a { font-size: 14px; padding: 6px 10px; }
.sidebar-public { display: none; margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-public a {
  display: block;
  padding: 10px 14px;
  color: #344054;
  text-decoration: none;
  font-weight: 700;
  border-radius: 10px;
}
.sidebar-public a:hover, .sidebar-public a:focus-visible { background: var(--blue-soft); color: var(--blue); }
.home-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.home-legal a { color: var(--blue); text-decoration: none; }
.home-legal a:hover, .home-legal a:focus-visible { text-decoration: underline; }

html[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 var(--blue); }
html[dir="rtl"] .header-logo,
html[dir="rtl"] .header-logo img {
  transform: none;
}
html[dir="rtl"] .header-logo img { object-position: right center; }
html[dir="rtl"] .preview-stage,
html[dir="rtl"] video,
html[dir="rtl"] .camera-preview,
html[dir="rtl"] .complete-dialog video {
  direction: ltr;
  unicode-bidi: isolate;
}

@media (max-width: 1100px) {
  .app-header .public-nav { display: none; }
  .sidebar-public { display: grid; gap: 2px; }
  .header-mid .page-context h1,
  .header-mid .page-context .page-kicker { font-size: 20px; }
}

@media (max-width: 820px) {
  html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(105%);
    border-right: 0;
    border-left: 1px solid var(--border);
  }
  html[dir="rtl"] .sidebar.open { transform: translateX(0); }
}

.pro-details {
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}
.pro-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}
.live-meters { display: grid; gap: 8px; margin-top: 12px; }
.level-meter { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.level-meter.is-muted b { width: 0 !important; }
.live-mic-mute { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.live-mic-mute-status { margin: 0; font-size: 13px; font-weight: 800; color: var(--navy); }
.live-mic-mute.is-muted .live-mic-mute-status { color: #b42318; }
.live-mic-mute #liveMicMuteBtn { min-height: 44px; min-width: 168px; }
.level-track {
  height: 8px;
  border-radius: 99px;
  background: #e4eaf3;
  overflow: hidden;
}
.level-track b {
  display: block;
  height: 100%;
  width: 0;
  background: #12b76a;
}
.complete-extras { margin-top: 14px; }
.complete-pro-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.card-actions-pro { margin-top: 8px; }
.marker-chip {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6ff;
  font-size: 12px;
  font-weight: 700;
}
.camera-preview.is-mirror { transform: scaleX(-1); }
.camera-preview.is-rounded { border-radius: 18px; }
.camera-preview.is-rect { border-radius: 4px; }

.cap-note[hidden] { display: none !important; }
.cap-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}
.mode-card.is-unavailable {
  opacity: .72;
}
.mode-unavail-note {
  display: block;
  margin-top: 6px;
  color: #b54708;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}
.mobile-cap-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.mobile-cap-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 650;
}
.fvr-mobile-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: min(90vh, 640px);
  overflow: auto;
}
.fvr-mobile-dialog .dialog-actions {
  flex-wrap: wrap;
}
.fvr-mobile-dialog .dialog-actions button {
  min-height: 44px;
}

@media (max-width: 820px) {
  html, body { overflow-x: hidden; }
  .app-body { padding-bottom: 64px; }
  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 0;
    height: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(6, 19, 60, 0.10);
    z-index: 35;
  }
  .sidebar.open { transform: none; }
  .sidebar .sidebar-footer { display: none; }
  .sidebar .main-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar .nav-primary,
  .sidebar .nav-section-settings {
    display: contents;
  }
  .sidebar .nav-section-label,
  .sidebar .nav-section-ai {
    display: none;
  }
  .sidebar .nav-item {
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    padding: 6px 4px;
  }
  .sidebar .sidebar-public {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 72px;
    top: auto;
    width: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    box-shadow: var(--shadow);
    max-height: min(60vh, 420px);
    overflow: auto;
  }
  .sidebar.open .sidebar-public { display: grid; }
  .header-end .lang-wrap { min-width: 0; }
  .lang-menu {
    max-height: min(70vh, 480px);
    overflow: auto;
    right: 0;
    left: auto;
  }
  .record-button, #homeStartBtn, .primary-button, .mode-card, .switch {
    min-height: 44px;
  }
  .mode-card { min-height: 88px; }
}

@media (max-width: 820px) {
  html[dir="rtl"] .sidebar {
    left: 0;
    right: 0;
    transform: none;
    border-left: 0;
    border-right: 0;
  }
  html[dir="rtl"] .sidebar.open { transform: none; }
  html[dir="rtl"] .lang-menu { left: 0; right: auto; }
}

/* Claude mobile merge: last 820px block wins over earlier drawer / 100vh conflicts. */
button, select, input { font-size: 16px; }
.mode-grid.is-two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mode-grid.is-two-up .mode-card { max-height: none; }
.segmented.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.message-dialog,
.complete-dialog,
.fvr-mobile-dialog {
  max-height: min(90dvh, 640px);
}
.complete-dialog { width: min(820px, calc(100vw - 20px)); }
.dialog-actions { flex-wrap: wrap; }

@media (max-width: 820px) {
  html, body { overflow-x: hidden; height: auto; }
  .app { height: auto; min-height: 100%; overflow: visible; }
  .app-body {
    overflow: visible;
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .main-content { height: auto; overflow: visible; }
  #view-record.view.active { height: auto; overflow: visible; }
  .preview-stage {
    width: 100%;
    max-width: 100%;
    max-height: none;
    min-height: 200px;
  }
  .settings-card { max-height: none; }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    transform: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 35;
  }
  .sidebar.open { transform: none; }
  .sidebar .main-nav {
    padding: 4px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left));
  }
  .sidebar .sidebar-public {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    max-height: min(60dvh, 420px);
  }
  .mode-grid.is-two-up { grid-template-columns: minmax(0, 1fr); }
  .record-button, #homeStartBtn, .primary-button, .mode-card, .switch, select, #liveMicMuteBtn {
    min-height: 46px;
  }
  html[dir="rtl"] .sidebar { left: 0; right: 0; transform: none; }
}
html:not(.ai-shorts-public) [data-ai-shorts-public] { display: none !important; }
html:not(.ai-shorts-user) [data-ai-shorts-user] { display: none !important; }



/* Preserved from the faktvideorec approved tree (home page demo-image frame) */
.home-demo-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 108px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #f4f8ff 0%, #eef3fb 100%);
  border: 1px solid #e4eaf3;
}
.home-demo-frame img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.home-demo-frame img.is-missing {
  display: none;
}
.home-demo-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #667085;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  padding: 12px;
}
.home-demo-frame img.is-missing ~ .home-demo-placeholder {
  display: grid;
}
@media (max-width: 820px) {
  .home-demo-frame { min-height: 140px; }
}
