:root {
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: #f3f7f4;
  background: #17221c;
  font-synthesis: none;
  --surface: #202e26;
  --surface-soft: #2a3a30;
  --text: #f3f7f4;
  --muted: #c4d0c9;
  --accent: #a8d4b9;
  --danger: #ed8f86;
  --border: rgba(255, 255, 255, 0.18);
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100dvh; background: radial-gradient(circle at 80% 0%, #2c4637 0, transparent 38%), #17221c; }
button, input { font: inherit; }
button { border: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid #f2bd63; outline-offset: 3px; }
.hidden { display: none !important; }
.shell { min-height: 100dvh; }

.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(430px, 100%); display: grid; gap: 10px; padding: clamp(26px, 6vw, 44px); border: 1px solid var(--border); border-radius: 20px; background: rgba(32, 46, 38, 0.94); box-shadow: 0 24px 70px rgba(5, 12, 8, 0.32); }
.brand { margin: 0 0 18px; color: var(--accent); font-weight: 760; }
.login-panel h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.25rem); line-height: 1; letter-spacing: -0.05em; }
.intro { margin: 5px 0 18px; color: var(--muted); line-height: 1.5; }
.login-panel label { margin-top: 5px; font-weight: 720; }
.login-panel input { min-height: 52px; width: 100%; padding: 10px 13px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px; background: #17221c; color: var(--text); font-size: 1rem; }
.form-error { min-height: 1.4em; margin: 3px 0; color: #ffc2bc; }
.primary, .quiet, .call-action { cursor: pointer; font-weight: 760; }
.primary { min-height: 54px; border-radius: 12px; background: var(--accent); color: #102017; }
.primary:active, .quiet:active, .call-action:active { transform: translateY(1px); }
.admin-link { justify-self: center; margin-top: 8px; color: var(--muted); font-weight: 700; text-underline-offset: 4px; }

.call-view { min-height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px clamp(18px, 4vw, 42px); border-bottom: 1px solid var(--border); background: rgba(23, 34, 28, 0.88); }
.topbar > div { display: grid; gap: 2px; }
.topbar strong { font-size: 1.08rem; }
.topbar span { color: var(--muted); font-size: 0.84rem; }
.topbar span.online { color: var(--accent); }
.quiet { min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); }
.stage { min-height: 0; padding: clamp(14px, 3vw, 28px); }
.message-view, .video-view { width: min(1100px, 100%); height: 100%; min-height: 300px; margin: 0 auto; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: rgba(32, 46, 38, 0.86); }
.message-view { display: grid; place-items: center; align-content: center; gap: 12px; padding: 28px; text-align: center; }
.camera-mark { width: 104px; height: 104px; position: relative; border: 2px solid var(--accent); border-radius: 50%; background: rgba(168, 212, 185, 0.1); }
.camera-mark::before { content: ""; position: absolute; left: 25px; top: 33px; width: 39px; height: 30px; border: 4px solid var(--accent); border-radius: 7px; }
.camera-mark::after { content: ""; position: absolute; left: 64px; top: 41px; border: 11px solid transparent; border-right: 0; border-left: 16px solid var(--accent); }
.message-view h1 { margin: 7px 0 0; font-size: clamp(2.1rem, 7vw, 4.5rem); letter-spacing: -0.055em; }
.message-view p { max-width: 42ch; margin: 0; color: var(--muted); font-size: clamp(1rem, 3vw, 1.25rem); line-height: 1.5; }
.video-view { position: relative; background: #0c120e; }
.video-view > #remote-video { width: 100%; height: 100%; object-fit: cover; }
#local-video { position: absolute; right: 16px; bottom: 16px; width: min(25%, 240px); aspect-ratio: 10 / 13; object-fit: cover; border: 2px solid rgba(255, 255, 255, 0.76); border-radius: 14px; background: #17221c; transform: scaleX(-1); }
.video-status { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; background: rgba(12, 18, 14, 0.78); text-align: center; }
.video-status strong { font-size: clamp(1.7rem, 5vw, 3rem); }
.video-status span { color: var(--muted); }
.actions { min-height: 96px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(23, 34, 28, 0.94); }
.call-action { min-width: 160px; min-height: 58px; padding: 12px 22px; border-radius: 14px; font-size: 1.03rem; }
.call-action.accept { background: var(--accent); color: #102017; }
.call-action.decline { background: var(--danger); color: #30100e; }
.call-action.secondary { border: 1px solid var(--border); background: var(--surface-soft); color: var(--text); }
.call-action:disabled { background: #718078; color: #d7ded9; cursor: not-allowed; }

.admin-view { min-height: 100dvh; }
.admin-content { width: min(1050px, calc(100% - 36px)); margin: 0 auto; padding: clamp(30px, 6vw, 64px) 0 80px; }
.admin-heading { max-width: 700px; margin-bottom: 36px; }
.admin-heading h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 4.5rem); line-height: 1; letter-spacing: -0.055em; }
.admin-heading p, .section-heading p { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.admin-message { min-height: 1.5em; margin: -18px 0 18px; color: var(--accent); font-weight: 700; }
.admin-section { margin-top: 22px; padding: clamp(22px, 4vw, 34px); border: 1px solid var(--border); border-radius: 20px; background: rgba(32, 46, 38, 0.9); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-size: 1.65rem; letter-spacing: -0.03em; }
.account-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 14px; margin-bottom: 24px; }
.account-form > div { display: grid; gap: 7px; }
.account-form label { font-weight: 700; }
.account-form input { width: 100%; min-height: 50px; padding: 10px 13px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 12px; background: #17221c; color: var(--text); }
.account-form .primary { padding: 10px 20px; white-space: nowrap; }
.management-list { display: grid; gap: 10px; }
.management-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 16px; border-radius: 14px; background: var(--surface-soft); }
.management-row > div:first-child { display: grid; gap: 3px; }
.management-row strong { font-size: 1.08rem; }
.management-row span, .management-row small { color: var(--muted); }
.management-row small { font-size: 0.78rem; }
.row-actions { display: flex; align-items: center; gap: 10px; }
.approve-button, .danger-quiet { min-height: 44px; padding: 8px 14px; border-radius: 11px; cursor: pointer; font-weight: 750; white-space: nowrap; }
.approve-button { background: var(--accent); color: #102017; }
.danger-quiet { border: 1px solid rgba(237, 143, 134, 0.55); background: transparent; color: #ffc2bc; }
.empty-setting { padding: 24px; border-radius: 14px; background: var(--surface-soft); color: var(--muted); text-align: center; }

@media (max-width: 640px) {
  .topbar { min-height: 64px; }
  .stage { padding: 10px; }
  .message-view, .video-view { min-height: 260px; border-radius: 16px; }
  .actions { min-height: 88px; }
  .call-action { flex: 1; min-width: 0; }
  #local-video { width: 30%; right: 10px; bottom: 10px; }
  .admin-content { width: min(100% - 24px, 1050px); padding-top: 30px; }
  .account-form { grid-template-columns: 1fr; }
  .section-heading, .management-row { align-items: stretch; flex-direction: column; }
  .row-actions { width: 100%; }
  .row-actions > button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
