:root {
  --ink: #101416;
  --ink-soft: #30383b;
  --paper: #f4f3ef;
  --surface: #ffffff;
  --line: #d8dad7;
  --line-dark: #343b3d;
  --muted: #687174;
  --accent: #d4f238;
  --accent-dark: #263000;
  --danger: #b42318;
  --danger-bg: #fff0ed;
  --focus: #1667a8;
  --radius: 6px;
  --shadow: 0 18px 50px rgba(16, 20, 22, 0.12);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell { min-height: 100vh; }

.topbar {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 243, 239, 0.96);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-logo { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 50%; }
.brand-logo--large { width: 80px; height: 80px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 19px; letter-spacing: 0.12em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 11px; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 18px; }
.operator { color: var(--muted); font-size: 14px; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-button:hover { background: #e8e8e3; }
.icon-button--bordered { border: 1px solid var(--line-dark); background: var(--surface); }
.icon-button:disabled { cursor: not-allowed; opacity: 0.45; }
.icon-button svg { width: 19px; height: 19px; }

.screen { min-height: calc(100vh - 76px); }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  background: var(--paper);
}

.login-panel {
  width: min(660px, 100%);
  margin: auto;
  padding: 56px clamp(24px, 6vw, 80px);
}

.login-brand { margin-bottom: clamp(54px, 9vh, 92px); }
.login-heading { margin-bottom: 32px; }
.eyebrow {
  margin: 0 0 9px;
  color: #4e595c;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 4vw, 50px); line-height: 1.06; letter-spacing: 0; }
.login-heading > p:last-child, .page-heading > div > p:last-child { color: var(--muted); margin-bottom: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.field--full { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 0 13px;
  border: 1px solid #b9bfbd;
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  font-weight: 400;
}
.field input, .field select { height: 48px; }
.field textarea { min-height: 90px; padding-block: 11px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #788083; }
.field input[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.password-control { display: flex; position: relative; }
.password-control input { padding-right: 50px; }
.password-toggle {
  width: 46px;
  border: 0;
  background: transparent;
  position: absolute;
  inset: 1px 1px 1px auto;
  cursor: pointer;
}
.password-toggle svg { width: 18px; }

.form-alert, .viewer-alert {
  margin-top: 20px;
  padding: 11px 13px;
  border-left: 4px solid var(--danger);
  background: var(--danger-bg);
  color: #7a251b;
  font-size: 14px;
}

.button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  cursor: pointer;
}
.button svg { width: 18px; height: 18px; }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button--wide { width: 100%; margin-top: 26px; }
.button--primary { color: var(--accent-dark); background: var(--accent); border-color: var(--accent); }
.button--primary:hover:not(:disabled) { background: #c1df23; border-color: #c1df23; }
.button--secondary { color: var(--surface); background: var(--ink-soft); border-color: var(--ink-soft); }
.button--secondary:hover:not(:disabled) { background: var(--ink); }
.button--quiet { min-height: 40px; padding: 0 12px; background: transparent; border-color: var(--line); }
.button--quiet:hover { background: #e8e8e3; }

.login-context {
  min-height: 100vh;
  padding: clamp(34px, 5vw, 68px);
  color: white;
  background: #13191b;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.signal-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image: linear-gradient(#556064 1px, transparent 1px), linear-gradient(90deg, #556064 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
.signal-grid::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 31%;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(212, 242, 56, 0.65);
}
.context-copy, .system-status { position: relative; }
.context-copy { max-width: 440px; margin-bottom: 76px; }
.context-number { color: var(--accent); font-size: clamp(100px, 15vw, 190px); font-weight: 900; line-height: 0.8; }
.context-copy p { margin: 28px 0 0; color: #d5d9d7; font-size: clamp(19px, 2vw, 28px); line-height: 1.3; }
.system-status { display: flex; align-items: center; gap: 10px; color: #aeb6b7; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.system-status span, .viewer-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(212, 242, 56, 0.14); }

.dashboard-screen { padding: clamp(42px, 6vw, 80px) clamp(20px, 5vw, 80px) 80px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 40px; }
.page-heading h1 { margin-bottom: 9px; }
.availability-key { display: flex; gap: 22px; padding-bottom: 7px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.availability-key span { display: flex; align-items: center; gap: 7px; }
.dashboard-tools { display: flex; align-items: center; gap: 24px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9da4a3; }
.status-dot--available { background: #6f8511; }

.session-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.session-card {
  min-height: 220px;
  padding: 25px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  text-align: left;
  display: flex;
  flex-direction: column;
  position: relative;
}
button.session-card { cursor: pointer; }
button.session-card:hover { z-index: 1; background: var(--surface); box-shadow: 0 0 0 2px var(--ink) inset; }
.session-card--disabled { color: #757d7f; }
.session-number { margin-bottom: 28px; color: #70797b; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.session-card h2 { margin-bottom: 8px; color: var(--ink); font-size: 21px; line-height: 1.2; }
.session-card--disabled h2 { color: #656d6f; }
.session-description { margin-bottom: 24px; color: var(--muted); font-size: 14px; }
.session-meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.status-label--available { color: #536508; }
.launch-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.launch-label svg { width: 17px; }
.session-card--available::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }

.empty-state { max-width: 560px; padding: 64px 20px; text-align: center; margin: auto; }
.empty-state svg { width: 38px; height: 38px; color: var(--muted); }
.empty-state h2 { margin: 16px 0 7px; }
.empty-state p { color: var(--muted); }

.editor-screen { padding: 32px clamp(20px, 5vw, 80px) 80px; }
.editor-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.editor-heading h1 { margin: 0; }
.admin-access { border-top: 1px solid var(--line); padding: 64px 0; }
.admin-access-inner { max-width: 420px; }
.admin-access h2 { margin-bottom: 20px; font-size: 24px; }
.admin-access form .button { margin-top: 22px; }
.editor-toolbar { min-height: 66px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editor-toolbar-actions { display: flex; gap: 10px; }
.editor-save-state { color: var(--muted); font-size: 13px; font-weight: 700; }
.editor-save-state--dirty { color: #8a5700; }
.editor-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 620px; }
.editor-session-list { border-right: 1px solid var(--line); }
.editor-session-option { width: 100%; min-height: 62px; padding: 10px 15px; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left; cursor: pointer; }
.editor-session-option:hover { background: #e9eae5; }
.editor-session-option[aria-current="true"] { background: var(--surface); box-shadow: inset 4px 0 var(--accent); }
.editor-session-option strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.editor-session-option small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.editor-session-option .status-dot { flex: none; }
.editor-detail { padding: 28px clamp(20px, 4vw, 54px) 54px; }
.editor-detail-heading h2 { margin-bottom: 28px; font-size: 26px; }
.editor-fields { max-width: 860px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.editor-field-spacer { min-height: 1px; }
.editor-password-section { max-width: 860px; margin-top: 38px; padding-top: 20px; border-top: 1px solid var(--line); }
.editor-password-section summary { font-size: 14px; font-weight: 800; cursor: pointer; }
.editor-password-section form { margin-top: 22px; }
.editor-password-section form .button { margin-top: 20px; }

.viewer-screen { padding: 28px clamp(16px, 3vw, 48px) 48px; background: #e9e9e5; }
.viewer-heading { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; margin-bottom: 24px; }
.viewer-heading > div:nth-child(2) { text-align: center; }
.viewer-heading h1 { margin: 0; font-size: clamp(24px, 3vw, 36px); }
.viewer-heading .eyebrow { margin-bottom: 5px; }
.viewer-heading .button { justify-self: start; }
.viewer-status { justify-self: end; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.viewer-status--ready span { background: #6f8511; }
.viewer-status--error span { background: var(--danger); box-shadow: none; }

.playback-toolbar {
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid #c6c9c7;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
}
.playback-note { margin: 0 8px 0 auto; color: var(--muted); font-size: 13px; }
.viewer-alert { margin: 14px 0 0; }

.player-layout { margin-top: 18px; }
.player-layout--presentation { max-width: 1480px; margin-inline: auto; }
.player-panel { min-width: 0; background: #181d1f; box-shadow: var(--shadow); }
.player-panel header { min-height: 50px; padding: 0 17px; border-bottom: 1px solid #394043; color: white; display: flex; align-items: center; justify-content: space-between; }
.player-panel header span { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 800; }
.player-panel header svg { width: 17px; color: var(--accent); }
.player-panel header small { color: #99a2a4; text-transform: uppercase; letter-spacing: 0.1em; }
.video-frame { width: 100%; background: #090c0d; position: relative; overflow: hidden; }
.video-frame--vertical { aspect-ratio: 9 / 16; max-height: calc(100vh - 270px); margin-inline: auto; }
.video-frame--horizontal { aspect-ratio: 16 / 9; }
.video-frame iframe { width: 100%; height: 100%; border: 0; position: absolute; inset: 0; z-index: 2; }
.player-loading { position: absolute; inset: 0; z-index: 1; color: #a8afb1; display: grid; place-content: center; justify-items: center; gap: 13px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.player-loading span { width: 24px; height: 24px; border: 2px solid #566064; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.holobox-body { min-height: 100vh; color: white; background: #090c0d; }
.holobox-screen { min-height: 100vh; background: #090c0d; display: flex; flex-direction: column; }
.holobox-header {
  min-height: 66px;
  padding: 10px 22px;
  border-bottom: 1px solid #30383a;
  background: #171d1f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.holobox-logo { width: 44px; height: 44px; flex: none; object-fit: contain; border-radius: 50%; }
.holobox-heading { min-width: 0; flex: 1; }
.holobox-label { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.holobox-heading h1 { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
.holobox-actions { display: flex; align-items: center; gap: 16px; }
.holobox-status { color: #b5bec0; font-size: 12px; white-space: nowrap; text-transform: uppercase; }
.holobox-fullscreen { color: white; }
.holobox-fullscreen:hover { background: #343d40; }
.holobox-stage { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; }
.holobox-video { width: min(100vw, calc((100vh - 66px) * 9 / 16)); max-height: calc(100vh - 66px); }
.holobox-error { max-width: 500px; padding: 24px; color: #fff; text-align: center; }
.holobox-screen:fullscreen .holobox-header { position: absolute; inset: 0 0 auto; z-index: 3; border: 0; background: rgba(23, 29, 31, 0.88); }
.holobox-screen:fullscreen .holobox-video { width: min(100vw, calc(100vh * 9 / 16)); max-height: 100vh; }

noscript { display: block; padding: 30px; color: white; background: var(--danger); text-align: center; }

@media (max-width: 1050px) {
  .session-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-context { display: none; }
  .login-panel { padding-top: 38px; }
  .login-brand { margin-bottom: 52px; }
  .viewer-heading { grid-template-columns: 1fr auto; }
  .viewer-heading > div:nth-child(2) { grid-row: 2; grid-column: 1 / -1; text-align: left; }
  .viewer-status { grid-column: 2; grid-row: 1; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-session-list { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; }
  .editor-session-option { flex: 0 0 170px; border-bottom: 0; border-right: 1px solid var(--line); }
  .editor-session-option[aria-current="true"] { box-shadow: inset 0 -4px var(--accent); }
}

@media (max-width: 620px) {
  .topbar { height: 66px; }
  .brand-copy small, .operator { display: none; }
  .dashboard-screen { padding-top: 34px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 28px; }
  .dashboard-tools { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .session-grid { grid-template-columns: 1fr; }
  .session-card { min-height: 190px; }
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .field--full { grid-column: auto; }
  .login-panel { padding-inline: 22px; }
  .playback-toolbar { flex-wrap: wrap; }
  .playback-toolbar .button:not(#open-holobox-button) { flex: 1 1 0; padding-inline: 8px; gap: 6px; white-space: nowrap; font-size: 14px; }
  #open-holobox-button { flex-basis: 100%; }
  .playback-note { width: 100%; margin: 2px 4px 0; }
  .viewer-heading { gap: 12px; }
  .viewer-status { font-size: 0; }
  .viewer-status span { display: block; }
  .editor-heading { align-items: flex-start; flex-direction: column; }
  .editor-toolbar { padding-block: 12px; align-items: flex-start; flex-direction: column; }
  .editor-toolbar-actions { width: 100%; flex-wrap: wrap; }
  .editor-toolbar-actions .button { flex: 1; padding-inline: 8px; font-size: 13px; }
  #editor-download-button { flex-basis: 100%; }
  .editor-detail { padding-inline: 0; }
  .editor-fields { grid-template-columns: 1fr; }
  .editor-field-spacer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
