:root {
  --bg: #f4f0e8;
  --surface: #fffaf2;
  --ink: #173a33;
  --muted: #63736b;
  --primary: #236a5d;
  --primary-dark: #143f37;
  --danger: #b84436;
  --border: #dccfc0;
  --shadow: 0 18px 48px rgba(47, 42, 34, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(184, 68, 54, 0.45);
  outline-offset: 3px;
}

.pc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
}

.auth-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 7vw, 3rem);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
}

.alert {
  padding: 10px 12px;
  background: #fff0ed;
  border: 1px solid rgba(184, 68, 54, 0.32);
  border-radius: 8px;
  color: var(--danger);
  font-weight: 800;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.session-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.kicker,
.label,
.note,
.empty {
  color: var(--muted);
}

.kicker {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.pc-live {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.pc-live-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111715;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
}

.status-row > div {
  min-height: 76px;
  padding: 14px;
  background: #f8efe3;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.button,
.icon-button,
.control-button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
}

.button {
  padding: 0 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 44px;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

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

.url-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.url-list a {
  display: block;
  min-height: 44px;
  padding: 11px 12px;
  overflow-wrap: anywhere;
  background: #f8efe3;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary-dark);
  font-weight: 800;
}

.session-list {
  display: grid;
  gap: 8px;
}

.session-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 12px;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.session-item.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(35, 106, 93, 0.14);
}

.session-item span,
.output {
  color: var(--muted);
}

.output {
  min-height: 24px;
  overflow-wrap: anywhere;
}

.mobile-shell {
  background: #050706;
  color: white;
  overscroll-behavior: none;
}

.camera-recorder {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #050706;
  isolation: isolate;
}

.camera-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050706;
}

.camera-recorder::before,
.camera-recorder::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
}

.camera-recorder::before {
  top: 0;
  height: 34%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0));
}

.camera-recorder::after {
  bottom: 0;
  height: 42%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
}

.camera-topbar,
.camera-message,
.camera-controls {
  position: absolute;
  z-index: 2;
}

.camera-topbar {
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 14px 0;
}

.camera-status,
.camera-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.camera-status,
.camera-badges > span {
  min-height: 38px;
  padding: 0 12px;
  background: rgba(9, 13, 12, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  font-weight: 800;
}

.camera-badges > span {
  display: inline-flex;
  align-items: center;
  max-width: min(45vw, 260px);
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#recordingTime {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.recording-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
}

.recording-dot.is-recording {
  background: #ff3b30;
  box-shadow: 0 0 0 6px rgba(255, 59, 48, 0.18);
}

.camera-icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(9, 13, 12, 0.56);
  color: white;
  backdrop-filter: blur(10px);
}

.close-icon,
.close-icon::before,
.close-icon::after {
  display: block;
}

.close-icon {
  position: relative;
  width: 18px;
  height: 18px;
}

.close-icon::before,
.close-icon::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 2px;
  width: 14px;
  height: 2px;
  background: currentColor;
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.camera-message {
  left: 14px;
  right: 14px;
  bottom: calc(136px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  background: rgba(9, 13, 12, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.86rem;
  text-align: center;
}

.camera-message strong,
.camera-message span {
  min-width: 0;
}

.camera-message strong::after {
  content: ":";
}

.camera-message span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-controls {
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: 64px 64px 92px 64px;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 22px);
  min-height: 126px;
  padding: 16px 14px 20px;
}

.camera-tool-button,
.camera-record-button {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
}

.camera-tool-button {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 24, 23, 0.62);
  backdrop-filter: blur(10px);
}

.camera-tool-button:disabled {
  opacity: 0.34;
}

.camera-record-button {
  width: 84px;
  height: 84px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  background: transparent;
}

.camera-record-button span {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  background: #f04438;
  box-shadow: 0 12px 34px rgba(240, 68, 56, 0.42);
}

.camera-record-button.is-recording span {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.rewind-tool span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 900;
}

.pause-tool span {
  position: relative;
  width: 22px;
  height: 24px;
}

.pause-tool span::before,
.pause-tool span::after {
  content: "";
  position: absolute;
  top: 0;
  width: 7px;
  height: 24px;
  border-radius: 3px;
  background: currentColor;
}

.pause-tool span::before {
  left: 2px;
}

.pause-tool span::after {
  right: 2px;
}

.pause-tool.is-paused span {
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid currentColor;
}

.pause-tool.is-paused span::before,
.pause-tool.is-paused span::after {
  display: none;
}

.stop-tool span {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: currentColor;
}

@media (max-width: 760px) {
  .pc-layout {
    grid-template-columns: 1fr;
  }

  .status-row {
    grid-template-columns: 1fr;
  }
}
