:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f2ee;
  color: #171717;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(1120px, 100%);
  background: #ffffff;
  border: 1px solid #ded9d0;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(20, 20, 20, 0.08);
  padding: 24px;
}

.blocked {
  max-width: 720px;
}

.blocked p:last-child {
  color: #584f45;
  font-size: 18px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  color: #796f62;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.04;
}

.status {
  min-width: 118px;
  text-align: center;
  border: 1px solid #d5cfc4;
  border-radius: 999px;
  padding: 8px 12px;
  color: #584f45;
  background: #fbfaf7;
  font-weight: 700;
  font-size: 14px;
}

.status.recording {
  color: #8b1e2d;
  background: #fff0f2;
  border-color: #f1b9c2;
}

.recorder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: stretch;
}

.credit {
  margin-top: 18px;
  color: #796f62;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.preview-wrap {
  position: relative;
  min-height: 390px;
  background: #191919;
  border-radius: 8px;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  min-height: 390px;
  display: block;
  object-fit: contain;
  background: #111;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: #f6f0e8;
  padding: 24px;
}

.placeholder span {
  color: #d8d0c5;
}

.hidden {
  display: none !important;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ded9d0;
  border-radius: 8px;
  font-weight: 700;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.meter {
  padding: 12px;
  border: 1px solid #ded9d0;
  border-radius: 8px;
  background: #fbfaf7;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 9px;
  color: #584f45;
  font-size: 14px;
}

.meter-label strong {
  color: #171717;
}

.meter-track {
  height: 12px;
  overflow: hidden;
  background: #ded9d0;
  border-radius: 999px;
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1e6b61;
  transition: width 80ms linear;
}

.hint {
  padding: 12px;
  border-left: 4px solid #1e6b61;
  background: #eef8f5;
  color: #23433e;
  line-height: 1.45;
  font-size: 14px;
}

button,
.download {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  background: #1e6b61;
  color: #ffffff;
}

button:hover,
.download:hover {
  filter: brightness(0.95);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.download.disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.secondary {
  background: #272727;
}

.danger {
  background: #9b2537;
}

.mic-stop {
  background: #6f4d18;
}

.mic-stop.muted {
  background: #1e6b61;
}

.download {
  display: grid;
  place-items: center;
  background: #245db2;
}

.result {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #ded9d0;
  border-radius: 8px;
  color: #584f45;
  background: #fbfaf7;
  font-size: 14px;
  line-height: 1.35;
}

.source-picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 18, 18, 0.58);
}

.source-dialog {
  width: min(920px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.source-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.source-head h2 {
  margin: 0;
  font-size: 24px;
}

.source-close {
  width: 42px;
  min-height: 42px;
  padding: 0;
  background: #272727;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.source-card {
  min-height: 0;
  padding: 8px;
  border: 1px solid #ded9d0;
  background: #fbfaf7;
  color: #171717;
  text-align: left;
}

.source-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 6px;
  background: #111;
  margin-bottom: 8px;
}

.source-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 780px) {
  .app {
    padding: 12px;
    place-items: start center;
  }

  .panel {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .recorder {
    grid-template-columns: 1fr;
  }

  .preview-wrap,
  video {
    min-height: 240px;
  }
}
