:root {
  color-scheme: dark;
  --bg: #10120e;
  --rail: #171a14;
  --panel: #1e2219;
  --line: #31362a;
  --text: #f3f0e4;
  --muted: #a39e8d;
  --live: #d6f25a;
  --live-ink: #1a2208;
  --danger: #e38b73;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.card, .live-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--live);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lede, .hint {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

input[type="text"] {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12150f;
}

input[type="text"]:focus {
  outline: 2px solid var(--live);
  border-color: transparent;
}

.primary, .ghost, .nav-item {
  border: 0;
  border-radius: 999px;
}

.primary {
  width: 100%;
  padding: 12px 16px;
  background: var(--live);
  color: var(--live-ink);
  font-weight: 650;
}

.primary:disabled, .switch:disabled {
  opacity: 0.55;
  cursor: wait;
}

.error {
  min-height: 1.2em;
  margin: 14px 0 0;
  color: var(--danger);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand {
  padding: 6px 10px 12px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  background: #262b20;
  color: var(--text);
}

.nav-item.is-current {
  box-shadow: inset 0 0 0 1px var(--live);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5c6156;
}

.dot.on { background: var(--live); }

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 0 8px;
}

.who {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.ghost {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
}

.workspace {
  padding: 40px 36px;
}

.panel {
  max-width: 680px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #191d15;
}

.switch {
  width: 64px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: #3a4033;
  position: relative;
}

.switch[aria-checked="true"] { background: var(--live); }

.switch span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f7f4ea;
  transition: transform 160ms ease;
}

.switch[aria-checked="true"] span { transform: translateX(28px); }

.url-box {
  display: grid;
  gap: 10px;
}

.url-box[hidden] {
  display: none;
}

.url-box input {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
}

.url-box .ghost {
  justify-self: start;
}

.library {
  margin-top: 28px;
}

.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.library h2,
.upload-window h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.upload-btn {
  width: auto;
  padding: 10px 18px;
}

dialog.upload-window {
  width: min(520px, calc(100vw - 32px));
  margin: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog.upload-window::backdrop {
  background: rgba(0, 0, 0, 0.66);
}

.window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.drop {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 8px 0 4px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #191d15;
  color: var(--muted);
  text-align: center;
}

.drop.is-over,
.drop:focus-within {
  border-color: var(--live);
  color: var(--text);
}

.drop.is-busy { opacity: 0.7; }

.picker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.files,
.public-files {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.files li,
.public-files li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.files .name,
.public-files a {
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--text);
}

.files time,
.public-files time,
.files .size,
.public-files span,
.files .empty {
  color: var(--muted);
  white-space: nowrap;
}

.files .ghost {
  padding: 6px 10px;
}

.live-card.files-card {
  width: min(1080px, calc(100vw - 64px));
}

.pin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #191d15;
}

.pin-card .hint { margin: 0; }

.pin-code {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 28px;
  letter-spacing: 0.18em;
}

.pin-entry {
  width: 100%;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #12150f;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 28px;
  letter-spacing: 0.28em;
  text-align: center;
}

.public-upload { margin-top: 18px; }

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

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-foot { margin-top: 0; }
  .workspace { padding: 24px 16px 40px; }
}
