:root {
  color-scheme: dark;
  --ink: #f2f4e9;
  --muted: #b7c3ac;
  --line: #527138;
  --glow: #c2e6a2;
  background: #070907;
  color: var(--ink);
  font: 16px/1.5 system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

.brand, .phone-home, footer {
  max-width: 940px;
  margin-inline: auto;
  padding-inline: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: max(10px, env(safe-area-inset-top)) 10px;
}
.brand h1 { margin: 0; line-height: 0; }
.brand img { width: min(44vw, 225px); height: auto; }
.brand a, footer a, .reading-link {
  color: var(--glow);
  text-underline-offset: .25em;
  padding-block: 6px;
}
.phone-home { display: grid; gap: 12px; }
.viewer {
  align-self: start;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #10160d;
}
.picture {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 918 / 548;
  background: #050605;
}
.picture :is(img,video) {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: contain;
}
.film-launch, .film-next {
  position: relative;
  border: 1px solid var(--glow);
  background: #162315;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
}
.film-launch {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #0e1a1366;
  padding: 0;
}
.film-next {
  align-self: end;
  margin-bottom: 2rem;
  border-radius: 6px;
  padding: .65em 1em;
}
.viewer-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  min-height: 44px;
  padding-inline: 10px;
  font-size: .78rem;
  color: var(--muted);
}
#port-counter { letter-spacing: .12em; white-space: nowrap; }
#media-status { text-align: center; }
#sound-toggle {
  border: 0;
  background: none;
  min-height: 44px;
  color: var(--glow);
  white-space: nowrap;
}
.port-picker, .story-scenes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.port-picker a, .story-scenes button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121911;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  padding: .3em;
  font-size: .74rem;
  letter-spacing: .06em;
}
.port-picker [aria-current="true"], .story-scenes [aria-pressed="true"] {
  background: #2c431d;
  color: #e6f7d9;
  border-color: #9db77d;
}
.story { min-width: 0; }
.story h2 {
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  line-height: 1;
  margin-block: .45em .35em;
}
.story p { color: var(--muted); margin: 0 0 .7em; }
footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  font-size: .85rem;
}
@media (orientation: landscape) and (min-width: 540px) {
  .phone-home { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .viewer { grid-row: span 2; }
  .port-picker { grid-column: 2; }
  .story { grid-column: 2; }
}
