html {
  height: 100%;
  background: #07070b;
  color-scheme: dark;
  overflow: hidden;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(92, 68, 158, 0.34), transparent 54%),
    #07070b;
  color: #f4f1ea;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font-family: system-ui, sans-serif;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

#stage {
  position: fixed;
  left: 50%;
  top: 50%;
  box-sizing: border-box;
  width: 600px;
  height: 600px;
  margin: 0;
  padding: 22px 28px 36px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 22%),
    #121114;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(min(1, 100dvw / 600px, 100dvh / 600px));
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage.framed {
  border-radius: 40px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

#app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mast {
  flex: none;
}

h1 {
  margin: 0;
  text-align: center;
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.byline {
  margin: 6px 0 0;
  text-align: center;
  color: #b7b3c2;
  font-family: system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.2;
}

#app[data-state="playing"] h1,
#app[data-state="listening"] h1,
#app[data-state="resolving"] h1,
#app[data-state="clarifying"] h1,
#app[data-state="complete"] h1 {
  font-size: 34px;
}

#app[data-state="playing"] .byline,
#app[data-state="listening"] .byline,
#app[data-state="resolving"] .byline,
#app[data-state="clarifying"] .byline,
#app[data-state="complete"] .byline {
  font-size: 16px;
}

.vignette {
  flex: 1 1 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app[data-state="playing"] .vignette,
#app[data-state="listening"] .vignette,
#app[data-state="resolving"] .vignette,
#app[data-state="clarifying"] .vignette,
#app[data-state="complete"] .vignette {
  align-items: flex-end;
  padding-bottom: 2px;
}

#app[data-state="playing"] .orb,
#app[data-state="listening"] .orb,
#app[data-state="resolving"] .orb,
#app[data-state="clarifying"] .orb,
#app[data-state="complete"] .orb {
  height: min(300px, 100%);
}

.orb {
  position: relative;
  height: min(280px, 100%);
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.38);
}

.exterior,
.orb-room,
.orb svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.exterior {
  display: block;
  object-fit: cover;
  object-position: center 42%;
}

.orb-room {
  opacity: 0;
  background: radial-gradient(circle at 50% 62%, #5a3b34 0%, #2a1c22 46%, #120e14 78%);
  transition: opacity 0.8s ease;
}

.orb svg {
  display: block;
}

.exterior,
.interior {
  transition: opacity 0.8s ease;
}

.interior {
  opacity: 0;
}

#app[data-bed="interior"] .exterior {
  opacity: 0;
}

#app[data-bed="interior"] .interior,
#app[data-bed="interior"] .orb-room {
  opacity: 1;
}

.screen {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lead,
.place,
.status {
  margin: 0;
  text-align: center;
}

.lead {
  color: #b7b3c2;
  font-family: system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.35;
}

.place {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.15;
}

.place:empty,
.status:empty {
  display: none;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.times {
  display: flex;
  justify-content: space-between;
  color: #b7b3c2;
  font-family: system-ui, sans-serif;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #3a3844;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

#progress-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: inherit;
  background: linear-gradient(90deg, #8d78ef, #e4dcff);
  transition: transform 0.12s linear;
}

.status {
  color: #b7b3c2;
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.3;
}

.status.error {
  color: #ffb4a8;
}

#dock,
#choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#choices:empty {
  display: none;
}

input[data-focusable],
button[data-focusable] {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  background: #1c1c22;
  color: #f4f1ea;
  font-size: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  appearance: none;
  -webkit-appearance: none;
}

input[data-focusable] {
  min-height: 58px;
  padding: 0 16px;
  user-select: text;
  -webkit-user-select: text;
}

button[data-focusable] {
  min-height: 68px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

#choices button {
  justify-content: flex-start;
  text-align: left;
  animation: rise 0.4s ease both;
}

#choices button:nth-child(2) {
  animation-delay: 0.05s;
}

#choices button:nth-child(3) {
  animation-delay: 0.1s;
}

.mark {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #d4ccff;
  font-size: 14px;
  font-weight: 600;
}

.label {
  flex: 1 1 auto;
  line-height: 1.2;
}

button[disabled] {
  opacity: 0.42;
}

#choices button[disabled] {
  animation: none;
  opacity: 0.42;
}

button[data-focusable]:focus,
button[data-focusable].focused {
  outline: 3px solid #efeaff;
  outline-offset: 2px;
  border-color: transparent;
  background: #d9d0ff;
  color: #1b1430;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

button[data-focusable]:focus .mark,
button[data-focusable].focused .mark {
  background: rgba(27, 20, 48, 0.1);
  color: #1b1430;
}

input[data-focusable]:focus,
input[data-focusable].focused {
  outline: 3px solid #efeaff;
  outline-offset: 2px;
  border-color: transparent;
  background: #1c1c22;
  color: #f4f1ea;
  box-shadow: none;
}

.credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  margin: 0;
  text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(244, 241, 234, 0.38);
  pointer-events: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb-room,
  .exterior,
  .interior,
  #progress-fill,
  #choices button {
    transition: none;
    animation: none;
  }
}
