:root {
  --slate: #353F44;
  --sky: #1FB6EE;
  --sky-deep: #0093C8;
  --paper: #EEF2F4;
  --stage: #FFFFFF;
  --text: #353F44;
  --muted: #64737B;
  --line: #D5DDE1;
  --button-text: #FFFFFF;
  --focus: #0093C8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2B3438;
    --stage: #1C2326;
    --text: #F2F5F6;
    --muted: #A9B6BC;
    --line: #46525A;
    --sky-deep: #1FB6EE;
    --button-text: #10181C;
    --focus: #1FB6EE;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font: 400 16px/1.55 "Sora", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---- top bar ---- */
.bar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-left));
  background: var(--slate); color: #FFFFFF;
}
.brand { display: inline-flex; color: #FFFFFF; }
.glyph { width: 40px; height: 23px; display: block; }
.sharer { margin: 0; flex: 1; font-size: 14px; color: #C9D3D8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sharer strong { color: #FFFFFF; font-weight: 600; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--sky-deep); color: var(--button-text);
  font: 600 15px/1 inherit; font-family: inherit; text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.bar .button { background: var(--sky); color: #10181C; }
.button:hover { filter: brightness(1.06); }
.link {
  border: 0; background: none; padding: 8px 6px; cursor: pointer;
  font: 500 15px/1 inherit; font-family: inherit; color: var(--muted);
}
.link:hover { color: var(--text); }

/* ---- content ---- */
.main {
  max-width: 1200px; margin: 0 auto;
  padding: 28px 16px calc(120px + env(safe-area-inset-bottom));
}
.title {
  margin: 0; max-width: 60ch;
  font-size: clamp(22px, 3.2vw, 32px); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.details {
  display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0 24px;
  padding: 0; list-style: none; color: var(--muted); font-size: 14px;
}
.stage {
  background: var(--stage); border-radius: 14px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 0 var(--line);
}

.stage img { display: block; max-width: 100%; max-height: 78vh; height: auto; cursor: zoom-in; }
.stage.zoomed { overflow: auto; justify-content: flex-start; align-items: flex-start; max-height: 85vh; }
.stage.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.stage video { display: block; width: 100%; max-height: 78vh; background: #000; }
.stage audio { width: min(100%, 560px); margin: 48px 24px; }
.stage iframe { display: block; width: 100%; height: 82vh; border: 0; background: #FFFFFF; }
.stage pre {
  margin: 0; width: 100%; max-height: 78vh; overflow: auto; padding: 20px 24px;
  font: 13.5px/1.6 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* The one loud thing: the file type inside the logo's chevrons. */
.filecard { flex-direction: column; gap: 28px; padding: clamp(48px, 9vw, 104px) 24px; text-align: center; }
.ext {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 22px);
  font-weight: 700; font-size: clamp(48px, 11vw, 120px); line-height: 1; letter-spacing: -0.02em;
  color: var(--sky-deep);
}
.ext svg { height: 0.78em; width: auto; flex: none; color: var(--text); }
.filecard p { margin: 0; color: var(--muted); max-width: 44ch; }

/* ---- messages (expired, owner) ---- */
.message { max-width: 520px; margin: 12vh auto 0; text-align: left; }
.message h1 { margin: 0 0 10px; font-size: 26px; line-height: 1.25; font-weight: 600; }
.message p { margin: 0 0 20px; color: var(--muted); }
.message .glyph { width: 56px; height: 32px; color: var(--text); margin-bottom: 24px; }

/* ---- loading ---- */
.loading { height: 50vh; display: grid; place-items: center; }
.loading span {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--sky-deep);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- who's viewing ---- */
.who {
  position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 560px; margin: 0;
  padding: 14px 16px; border-radius: 14px;
  background: var(--slate); color: #FFFFFF;
  box-shadow: 0 10px 30px rgba(20, 28, 32, 0.28);
  animation: rise 0.28s ease-out;
}
.who label { display: block; font-size: 14px; color: #C9D3D8; margin-bottom: 10px; }
.who label span { color: #FFFFFF; font-weight: 600; }
.who-row { display: flex; gap: 8px; align-items: center; }
.who input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid #56636A; background: #2B3438; color: #FFFFFF; font: inherit; font-size: 15px;
}
.who input::placeholder { color: #8D9BA2; }
.who .button { background: var(--sky); color: #10181C; }
.who .link { color: #C9D3D8; }
.who .link:hover { color: #FFFFFF; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

@media (max-width: 560px) {
  .bar { gap: 12px; }
  .sharer { font-size: 13px; }
  .bar .button { padding: 0 14px; }
  .main { padding-top: 20px; }
  .stage { border-radius: 10px; }
  .who-row { flex-wrap: wrap; }
  .who input { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .loading span { animation-duration: 2.4s; }
  .who { animation: none; }
}

/* Password form (SPEC §1.15) */
.pw-form { margin-top: 20px; width: min(360px, 100%); }
.pw-form .who-row { display: flex; gap: 8px; }
.pw-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line, #C9D3D8); background: var(--stage, #FFFFFF); color: var(--text); font: inherit; font-size: 16px;
}
.pw-form input:focus { outline: 2px solid var(--sky); outline-offset: 1px; }
.pw-error { min-height: 1.4em; margin: 10px 0 0; color: #C2410C; font-size: 14px; }
@media (prefers-color-scheme: dark) { .pw-error { color: #FB923C; } }
