:root {
  --studio-night: #11110f;
  --studio-night-soft: #1a1a17;
  --studio-ink: #171714;
  --studio-paper: #f4f1eb;
  --studio-paper-strong: #fffdf8;
  --studio-muted: #77736c;
  --studio-line: rgba(23, 23, 20, 0.11);
  --studio-red: #d6324f;
  --studio-green: #20947f;
  --studio-amber: #c9822a;
  --studio-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

body {
  min-width: 320px;
  background: var(--studio-night);
  color: var(--studio-ink);
}

button,
a,
select,
textarea,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(71, 160, 141, 0.32);
  outline-offset: 2px;
}

.app-shell {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  padding: 0;
  background: var(--studio-night);
}

.app-shell.controls-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.stage-column {
  position: relative;
  grid-template-rows: 72px minmax(0, 1fr) 82px;
  gap: 0;
  min-height: 100vh;
  padding: 0 24px;
  overflow: hidden;
  isolation: isolate;
}

.stage-column::before {
  position: absolute;
  inset: 56px 12% 90px;
  z-index: -1;
  content: "";
  background: radial-gradient(ellipse at 50% 38%, rgba(255, 244, 222, 0.1), transparent 64%);
  pointer-events: none;
}

.brand-row {
  min-height: 72px;
  gap: 11px;
  color: #fffdf8;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.brand-mark span {
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 0;
  background: #fffdf8;
  clip-path: polygon(50% 0, 59% 38%, 100% 50%, 59% 62%, 50% 100%, 41% 62%, 0 50%, 41% 38%);
}

.brand-mark span::after {
  display: none;
}

h1 {
  font-family: "Avenir Next", "PingFang SC", ui-sans-serif, system-ui, sans-serif;
  font-size: 21px;
  font-weight: 780;
  letter-spacing: -0.6px;
}

.brand-row p {
  margin-top: 2px;
  color: rgba(255, 253, 248, 0.52);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 2.4px;
}

.session-badge {
  min-height: 31px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 253, 248, 0.72);
  font-size: 12px;
  font-weight: 650;
}

.session-badge span {
  width: 6px;
  height: 6px;
  background: #55bea8;
  box-shadow: 0 0 0 4px rgba(85, 190, 168, 0.09);
}

.account-chip {
  min-height: 31px;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.055);
  color: #fffdf8;
  box-shadow: none;
  font-size: 12px;
  font-weight: 680;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.account-chip:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-1px);
}

.preview-wrap {
  position: relative;
  min-height: 0;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.09), transparent 34%),
    linear-gradient(145deg, #292925 0%, #1e1e1b 54%, #181816 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 32px 80px rgba(0, 0, 0, 0.3);
}

.preview-wrap::before,
.preview-wrap::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.preview-wrap::before {
  inset: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 18px;
}

.preview-wrap::after {
  right: 22px;
  bottom: 18px;
  width: 34px;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: -7px -7px 0 -0.25px rgba(255, 255, 255, 0.12);
}

#recordCanvas {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: #242420;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(0, 0, 0, 0.28);
}

.permission-panel {
  z-index: 3;
  gap: 10px;
  width: min(390px, calc(100% - 48px));
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--studio-ink);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  text-align: left;
  backdrop-filter: blur(24px) saturate(120%);
}

.permission-panel::before {
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 50%, #fffdf8 0 18%, transparent 20%),
    var(--studio-ink);
  content: "";
  box-shadow: 0 8px 20px rgba(23, 23, 20, 0.17);
}

.permission-panel h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
}

.permission-panel p {
  margin-bottom: 8px;
  color: #716d66;
}

.primary-action,
.secondary-action,
.download-link,
.ghost-action {
  border-radius: 12px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled),
.download-link:hover,
.ghost-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-action {
  min-height: 46px;
  background: var(--studio-ink);
  box-shadow: 0 12px 28px rgba(23, 23, 20, 0.18);
}

.transport {
  grid-template-columns: auto auto minmax(120px, 1fr) auto;
  gap: 10px;
  min-height: 82px;
  padding: 13px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fffdf8;
  box-shadow: none;
}

.transport > div {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: start;
  gap: 10px;
  min-width: 0;
  padding-left: 4px;
}

.transport strong {
  font-size: 13px;
  font-weight: 680;
}

.transport span {
  margin: 0;
  color: rgba(255, 253, 248, 0.46);
  font-family: "SFMono-Regular", "SF Mono", Consolas, monospace;
  font-size: 12px;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.record-action-button {
  min-width: 130px;
  padding: 0 18px;
  border: 0;
  background: #d6324f;
  box-shadow: 0 10px 26px rgba(214, 50, 79, 0.25);
}

.record-action-button:hover:not(:disabled) {
  background: #e03b58;
  transform: translateY(-1px);
}

.record-action-button.recording {
  background: #1f1a18;
  color: #fffdf8;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.11),
    0 10px 28px rgba(0, 0, 0, 0.24);
}

.pause-button {
  background: rgba(255, 255, 255, 0.075);
  box-shadow: none;
}

.pause-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

#pauseGlyph::before,
#pauseGlyph::after {
  background: #fffdf8;
}

#pauseButton.paused #pauseGlyph::before {
  border-left-color: #fffdf8;
}

.download-link {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: #fffdf8;
  font-size: 12px;
  font-weight: 650;
}

.control-column {
  gap: 0;
  max-height: 100vh;
  padding: 0 22px 30px;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--studio-paper);
  color: var(--studio-ink);
  scrollbar-color: rgba(23, 23, 20, 0.22) transparent;
  scrollbar-width: thin;
}

.control-column::-webkit-scrollbar {
  width: 6px;
}

.control-column::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(23, 23, 20, 0.18);
}

.control-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  min-height: 72px;
  margin: 0 -22px;
  padding: 0 22px;
  border-bottom: 1px solid var(--studio-line);
  background: rgba(244, 241, 235, 0.9);
  backdrop-filter: blur(18px);
}

.control-heading span {
  display: block;
  margin-bottom: 3px;
  color: #918b82;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 1.7px;
}

.control-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.3px;
}

.control-toggle {
  top: 88px;
  right: 340px;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: #242420;
  color: rgba(255, 253, 248, 0.86);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.control-toggle:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
}

.control-toggle-icon {
  width: 100%;
  height: 100%;
  background: transparent;
  transition: transform 280ms var(--studio-ease);
}

.control-toggle-text {
  display: none;
}

.control-toggle-icon svg,
.outline-chevron svg {
  width: 16px;
  height: 16px;
  overflow: visible;
}

.control-toggle-icon path,
.control-toggle-icon rect,
.outline-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.controls-collapsed .control-toggle {
  top: 16px;
  right: 18px;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: #242420;
  color: rgba(255, 253, 248, 0.86);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.controls-collapsed .account-chip {
  margin-right: 52px;
}

.controls-collapsed .control-toggle-icon {
  transform: rotate(180deg);
}

.outline-notification-dot {
  border-color: var(--studio-night);
  background: #f0a945;
}

.panel {
  gap: 13px;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid var(--studio-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.panel h2 {
  font-size: 14px;
  font-weight: 730;
  letter-spacing: -0.1px;
}

.segmented {
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(23, 23, 20, 0.07);
  border-radius: 12px;
  background: #e6e2da;
}

.segmented button {
  min-height: 39px;
  border-radius: 9px;
  color: #77726a;
  font-weight: 650;
}

.segmented button.active {
  background: var(--studio-paper-strong);
  color: var(--studio-ink);
  box-shadow:
    0 2px 8px rgba(23, 23, 20, 0.08),
    inset 0 0 0 1px rgba(23, 23, 20, 0.035);
}

.format-toggle .active::before,
.mode-toggle .active::before {
  width: 5px;
  height: 5px;
  margin-bottom: 1px;
  border-radius: 50%;
  background: var(--studio-green);
  content: "";
}

.segmented button span {
  font-size: 10px;
}

.segmented button strong {
  font-size: 15px;
}

.ratio-transition {
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.92);
}

.field-label,
.switch-row label {
  color: #4f4b45;
  font-size: 12px;
  font-weight: 650;
}

textarea,
input,
select {
  border-color: rgba(23, 23, 20, 0.12);
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--studio-ink);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

textarea:hover,
input:hover,
select:hover {
  border-color: rgba(23, 23, 20, 0.22);
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(32, 148, 127, 0.58);
  background: var(--studio-paper-strong);
  box-shadow: 0 0 0 3px rgba(32, 148, 127, 0.08);
}

textarea {
  min-height: 86px;
  padding: 12px 13px;
}

select,
input {
  min-height: 40px;
}

.secondary-action {
  min-height: 42px;
  background: var(--studio-ink);
  box-shadow: none;
}

.secondary-action:hover:not(:disabled) {
  background: #2a2a25;
}

.secondary-action:disabled {
  border: 1px solid rgba(23, 23, 20, 0.08);
  background: #e6e2da;
  color: #969087;
}

.ghost-action {
  border-color: rgba(23, 23, 20, 0.12);
  background: rgba(255, 253, 248, 0.6);
  color: var(--studio-ink);
}

.checkbox-row {
  font-size: 12px;
  font-weight: 650;
}

.checkbox-row input {
  accent-color: var(--studio-green);
}

.status-line,
#speechStatus {
  color: var(--studio-muted);
  font-size: 12px;
}

.content-outline-state,
.speech-indicator,
.memory-indicator {
  border-radius: 999px;
}

.outline-title-button {
  border-color: var(--studio-line);
}

.outline-chevron {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(23, 23, 20, 0.1);
  border-radius: 50%;
  color: #6d6860;
  font-size: 0;
  transition:
    transform 220ms var(--studio-ease),
    background 160ms ease;
}

.outline-title-button:hover .outline-chevron {
  background: rgba(23, 23, 20, 0.05);
}

.outline-title-button[aria-expanded="true"] .outline-chevron {
  transform: rotate(90deg);
}

.outline-pending-button {
  border-radius: 10px;
}

.transcript-box,
.recording-item,
.demo-link-box {
  border-color: rgba(23, 23, 20, 0.1);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.58);
}

.auth-dialog {
  border-radius: 22px;
  background: rgba(255, 253, 248, 0.97);
}

.auth-mark {
  border-radius: 12px;
  background: var(--studio-ink);
}

.auth-close-button {
  background: rgba(23, 23, 20, 0.055);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) 332px;
  }

  .control-toggle {
    right: 312px;
  }

  .stage-column {
    padding: 0 16px;
  }

  .preview-wrap {
    padding: 16px;
  }
}

@media (max-width: 980px) {
  .app-shell,
  .app-shell.controls-collapsed {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 100vh;
    background: var(--studio-night);
  }

  .stage-column {
    min-height: 100vh;
    padding: 0 14px;
  }

  .control-column {
    max-height: none;
    padding: 0 20px 38px;
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .control-heading {
    margin: 0 -20px;
    padding: 0 20px;
    border-radius: 24px 24px 0 0;
  }

  .controls-collapsed .control-column {
    display: none;
  }

  .control-toggle,
  .controls-collapsed .control-toggle {
    position: fixed;
    top: 18px;
    right: 14px;
  }

  .preview-wrap {
    min-height: min(720px, calc(100vh - 154px));
  }
}

@media (max-width: 560px) {
  .stage-column {
    grid-template-rows: 62px minmax(0, 1fr) auto;
    padding: 0 10px;
  }

  .brand-row {
    min-height: 62px;
    align-items: center;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  h1 {
    font-size: 18px;
  }

  .account-chip {
    margin-left: auto;
    margin-right: 45px;
    padding: 0 10px;
  }

  .control-toggle,
  .controls-collapsed .control-toggle {
    top: 13px;
    right: 10px;
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .control-toggle-icon {
    background: transparent;
  }

  .preview-wrap {
    min-height: min(650px, calc(100vh - 145px));
    padding: 10px;
    border-radius: 20px;
  }

  .preview-wrap::before {
    inset: 7px;
    border-radius: 15px;
  }

  #recordCanvas {
    border-radius: 14px;
  }

  .permission-panel {
    width: calc(100% - 28px);
    padding: 20px;
    border-radius: 17px;
  }

  .permission-panel h2 {
    font-size: 20px;
  }

  .transport {
    grid-template-columns: auto auto minmax(0, 1fr);
    min-height: 72px;
    padding: 11px 2px;
  }

  .transport > div {
    grid-template-columns: 1fr;
    gap: 2px;
    padding-left: 2px;
  }

  .record-action-button {
    min-width: 118px;
    padding: 0 14px;
  }

  .download-link {
    grid-column: 1 / -1;
  }

  .control-column {
    padding-bottom: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .control-column,
  .control-toggle,
  .control-toggle-icon,
  .outline-chevron,
  #recordCanvas {
    transition: none;
  }
}
