:root {
  color-scheme: dark;
  --line: rgba(255, 255, 255, 0.16);
  --muted: #9a9a9a;
  --text: #f5f5f5;
}

* { box-sizing: border-box; }

html {
  background: #000;
  scroll-snap-type: y mandatory;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: #000;
  color: var(--text);
  font: 15px/1.4 ui-sans-serif, system-ui, -apple-system, "SF Pro Text", sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

body.viewing { overflow: hidden; }
body.viewing header,
body.viewing .dock { visibility: hidden; }

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

button {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

button:hover { background: #fff; color: #000; }
button.primary { background: #fff; color: #000; border-color: #fff; }
button.primary:hover { background: #e8e8e8; }
button:disabled { opacity: 0.35; cursor: default; background: transparent; color: #fff; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

header {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 22px 28px;
  background: linear-gradient(#000 20%, rgba(0, 0, 0, 0));
  pointer-events: none;
}

header > * { pointer-events: auto; }

.brand {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

.role, .wake { color: var(--muted); font-size: 13px; }
.wake {
  margin: 0;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wake.on { color: #c8e6b0; }
.spacer { flex: 1; }

main { min-height: 100dvh; }

.slide {
  height: 100dvh;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 64px 24px 32px;
  position: relative;
}

body.editor .slide { padding-bottom: 124px; }

.slide img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  background: #000;
  user-select: none;
  -webkit-user-drag: none;
}

.del {
  position: absolute;
  right: 22px;
  bottom: 28px;
  opacity: 0;
  pointer-events: none;
}

body.editor .del { bottom: 112px; }
body.editor .slide:hover .del,
body.editor .del:focus {
  opacity: 1;
  pointer-events: auto;
}

.empty {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  pointer-events: none;
}

[hidden] { display: none !important; }

.ipad {
  position: fixed;
  z-index: 7;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
  max-width: calc(100vw - 24px);
  margin: 0;
  padding: 12px 18px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: var(--muted);
}

.ipad a {
  color: #fff;
  font-size: 15px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.editor .ipad { bottom: 100px; }
body.viewing .ipad { visibility: hidden; }

.dock {
  position: fixed;
  z-index: 6;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.drop {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 64px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.78);
  cursor: pointer;
  text-align: center;
  padding: 10px 16px;
}

.drop.over,
.drop:focus-within { border-color: #fff; color: #fff; }

.linkish {
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.78);
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
}

.stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #000;
  user-select: none;
  -webkit-user-drag: none;
}

.stage.idle { cursor: none; }
.stage.idle .chrome { opacity: 0; }

.waiting {
  position: absolute;
  margin: 0;
  color: var(--muted);
}

.chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px 22px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  transition: opacity 0.3s ease;
}

.chrome p { margin: 0; min-width: 4.5em; text-align: center; color: #ddd; }
.badge { color: #fff; min-width: 0; }

dialog {
  background: #0a0a0a;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  width: min(420px, calc(100vw - 32px));
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
dialog h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
dialog p { margin: 0 0 16px; color: var(--muted); }

dialog input {
  width: 100%;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

dialog input:focus { outline: 1px solid #fff; }
.error { color: #ff8d7a; }
.row { display: flex; justify-content: flex-end; gap: 8px; }

@keyframes arrive {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.stage img.arrived { animation: arrive 0.18s ease; }

@media (prefers-reduced-motion: reduce) {
  .stage img.arrived { animation: none; }
  .chrome { transition: none; }
  html { scroll-behavior: auto; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 99px; }
