:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #68746e;
  --line: #d8ded9;
  --surface: #ffffff;
  --page: #f4f7f3;
  --accent: #0f7b58;
  --accent-strong: #09593f;
  --focus: #3267d6;
  --warning: #a75b00;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

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

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.secondary:hover {
  border-color: #b5beb7;
  background: #f7faf7;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.account,
.controls,
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #17201b;
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
}

h2 {
  font-size: 24px;
}

.brand p,
.auth-panel p,
.message,
.status-chip,
.account {
  color: var(--muted);
  font-size: 14px;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 28px 36px;
}

.auth-view {
  min-height: calc(100vh - 130px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 28px;
  display: grid;
  gap: 18px;
}

.google-button {
  min-height: 42px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 24px;
  align-items: start;
}

.camera-area,
.record-form {
  min-width: 0;
}

.video-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101511;
  aspect-ratio: 16 / 9;
}

#liveVideo,
#playbackVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #101511;
}

.playback-shell {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101511;
  aspect-ratio: 16 / 9;
}

.recording-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(180, 35, 24, 0.95);
  color: #fff;
}

.recording-badge span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #fff;
}

.controls {
  flex-wrap: wrap;
  margin-top: 14px;
}

.status-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
}

.record-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #344139;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #c8d0ca;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

input,
select {
  min-height: 42px;
  padding: 8px 11px;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(50, 103, 214, 0.16);
}

.measure-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-actions {
  align-items: center;
  flex-wrap: wrap;
  min-height: 44px;
}

.message[data-tone='error'] {
  color: var(--danger);
}

.status-chip[data-tone='error'] {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger);
}

.message[data-tone='warning'] {
  color: var(--warning);
}

.status-chip[data-tone='warning'] {
  border-color: rgba(167, 91, 0, 0.35);
  color: var(--warning);
}

.message[data-tone='ok'] {
  color: var(--accent-strong);
}

.status-chip[data-tone='ok'] {
  border-color: rgba(15, 123, 88, 0.35);
  color: var(--accent-strong);
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .record-form {
    order: -1;
  }
}

@media (max-width: 560px) {
  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .account {
    width: 100%;
    justify-content: space-between;
  }

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

  button {
    width: 100%;
  }

  .status-chip,
  .message {
    width: 100%;
  }
}
