:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #eef0fb;
  background: #101320;
  --muted: #a9b0c9;
  --border: #343a52;
  --accent: #9ee1d0;
  --violet: #c9bcff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 30% 0%, #232541 0%, transparent 65%), #101320;
}

.shell { width: min(100% - 3rem, 56rem); margin-inline: auto; }

.site-header { border-bottom: 1px solid #393d564f; }

.wordmark {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 4.5rem;
  color: #d3d8ef;
  font-size: .92rem;
  font-weight: 650;
  letter-spacing: .02em;
}

.window-mark {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid #a6a4e8;
  border-radius: .24rem;
  background:
    linear-gradient(#a6a4e8, #a6a4e8) center / 1px 100% no-repeat,
    linear-gradient(#a6a4e8, #a6a4e8) center / 100% 1px no-repeat,
    #7775b13b;
}

main { padding-block: 4rem 2rem; }

h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(2.2rem, 6vw, 3.55rem);
  font-weight: 660;
  letter-spacing: -.05em;
  line-height: 1.04;
}

.twitch-sign-in {
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  align-items: center;
}

.twitch-sign-in a { color: var(--accent); font-weight: 650; }
.twitch-sign-in .feedback { margin: 0; }

.pilot-help {
  margin-bottom: 1rem;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: #171a2c;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.5;
}

.pilot-help summary { color: #eef0fb; font-weight: 650; cursor: pointer; }
.pilot-help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pilot-help p { margin: .7rem 0 0; }

.pilot-commands { margin: .8rem 0 0; }
.pilot-commands div { display: flex; flex-wrap: wrap; gap: .1rem .75rem; padding-block: .2rem; }
.pilot-commands dt { flex: 0 1 17rem; }
.pilot-commands dd { flex: 1 1 16rem; margin: 0; }
.pilot-commands code { color: var(--accent); }

h2 {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  font-weight: 650;
  line-height: 1.35;
}

.scene-link { display: inline-block; margin-bottom: .75rem; color: var(--accent); }
.house-preview {
  margin-bottom: 1rem;
  padding: clamp(1.05rem, 3vw, 1.55rem);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  background: radial-gradient(ellipse at 50% 35%, #2d3051 0%, #171a2c 60%);
  box-shadow: 0 12px 30px #080a1550;
}

.night-scene {
  --facade-height: 5.4rem;
  --roof-height: 2.85rem;
  position: relative;
  padding-top: var(--roof-height);
  isolation: isolate;
}

.night-scene::before {
  position: absolute;
  top: .55rem;
  left: min(100% - 1rem, 50% + 10rem);
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  box-shadow: -.22rem .2rem 0 #c8c0eb;
  content: "";
}

.night-scene::after {
  position: absolute;
  z-index: -1;
  inset: calc(var(--roof-height) + var(--facade-height)) 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, #515475, transparent);
  content: "";
}

.night-house {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  width: min(100% - 1.4rem, 20rem);
  margin-inline: auto;
}

.night-house[data-width="single"] { width: min(100% - 1.4rem, 13rem); }
.night-house[data-width="wide"] { width: min(100% - 1.4rem, 36rem); }

.night-house::before {
  position: absolute;
  right: -.7rem;
  bottom: 100%;
  left: -.7rem;
  height: var(--roof-height);
  background: linear-gradient(130deg, #575472, #34364e 90%);
  clip-path: polygon(3% 96%, 50% 0, 97% 96%, 100% 100%, 0 100%);
  content: "";
}

.window-bay { min-width: 0; }
.window-opening,
.house-empty {
  display: grid;
  place-items: center;
  height: var(--facade-height);
  border-block: 1px solid #53516c;
  border-bottom-color: #3e405a;
  background: repeating-linear-gradient(#24273a 0 13px, #2d2e42 13px 14px);
}

.house-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: .5rem;
  text-align: center;
  color: var(--muted);
}

.house-window {
  position: relative;
  overflow: hidden;
  width: 3.1rem;
  height: 3.3rem;
  border: 4px solid #70677b;
  border-bottom-width: 6px;
  border-radius: 1.15rem 1.15rem .18rem .18rem;
  background-color: #161928;
  background-image:
    linear-gradient(90deg, transparent calc(50% - 1px), #3b394d calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(180deg, #3c3b52, transparent);
}

.window-bay[data-lit="true"] .house-window {
  border-color: #b58671;
  background-color: #e8a464;
  background-image:
    linear-gradient(90deg, transparent calc(50% - 1px), #a87963 calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(180deg, #ffe2a6, transparent);
  box-shadow: 0 0 1.55rem #ffc08169, 0 0 3rem #eba45c2e;
}

.window-figure {
  --avatar-hair: #2e2331;
  position: absolute;
  bottom: 3%;
  left: 26%;
  width: 48%;
  height: 39%;
  border-radius: 50% 50% 10% 10%;
  background: #454656;
}

.window-figure[data-hair="brown"] { --avatar-hair: #674137; }
.window-figure[data-hair="blond"] { --avatar-hair: #ad7438; }
.window-figure[data-hair="red"] { --avatar-hair: #9c4234; }
.window-figure[data-variant="f"] { left: 29%; width: 42%; border-radius: 58% 58% 14% 14%; }

.window-figure::before {
  position: absolute;
  bottom: 75%;
  left: 22%;
  width: 56%;
  height: 68%;
  border-radius: 50%;
  background: #5c4150;
  content: "";
}

.window-figure[data-variant="m"]::before,
.window-figure[data-variant="f"]::before { background: #b2785f; }

.window-hair {
  display: none;
  position: absolute;
  bottom: 105%;
  left: 18%;
  width: 64%;
  height: 42%;
  border-radius: 60% 55% 22% 25%;
  background: var(--avatar-hair);
}

.window-figure[data-variant="m"] .window-hair,
.window-figure[data-variant="f"] .window-hair { display: block; }
.window-figure[data-variant="f"] .window-hair {
  bottom: 77%;
  left: 13%;
  width: 74%;
  height: 74%;
  clip-path: polygon(0 30%, 17% 5%, 53% 0, 84% 7%, 100% 38%, 98% 100%, 77% 100%, 76% 57%, 49% 42%, 23% 60%, 20% 100%, 0 100%);
}

.window-caption {
  min-height: 5.25rem;
  padding-top: .6rem;
  text-align: center;
  font-size: .88rem;
}

.window-caption p { margin: 0; }
.window-caption .window-label { margin-bottom: .15rem; color: #eef0fb; font-weight: 650; }
.window-status { color: var(--muted); }

.window-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .12rem .45rem;
  margin-top: .3rem;
  color: #ffe2bd;
}

.window-holder { font-weight: 650; }
.window-focus { color: #d3cbec; }
.window-focus .time { color: #ffe2bd; }

.dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.claim-notice {
  grid-column: 1 / -1;
  margin: 0;
  padding: .8rem 1rem;
  border: 1px solid var(--border);
  border-radius: .65rem;
  background: #232840;
  color: #e7eaf8;
  font-size: .92rem;
  line-height: 1.45;
}

.pilot-claim-access, .claim-notice--paused { margin-bottom: 1rem; }

.claim-notice .time {
  color: var(--violet);
  font-weight: 650;
}

.claim-notice--blocked, .claim-notice--paused {
  border-color: #675263;
  background: #352839;
}

.claim-notice--blocked .time { color: #f5c5b7; }

.panel {
  min-width: 0;
  padding: clamp(1.05rem, 3vw, 1.55rem);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  background: #1b2034;
  box-shadow: 0 12px 30px #080a1550;
}

.room-heading { color: #eef0fb; font-size: 1.18rem; }

.room-reading {
  min-height: 5.4rem;
  padding-block: .8rem 1rem;
}

.room-status {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-size: 1.58rem;
  font-weight: 650;
  line-height: 1.25;
}

.room-status::before {
  width: .56rem;
  height: .56rem;
  border-radius: 50%;
  background: #a9b0c9;
  content: "";
}

.room-status[data-state="free"]::before { background: var(--accent); }
.room-status[data-state="occupied"]::before { background: #f0bf92; }
.room-status[data-state="reserved"]::before { background: var(--violet); }

.room-details {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .35rem 1rem;
  margin-top: .6rem;
  color: var(--muted);
  font-size: .95rem;
}

.room-details p { margin: 0; }
.room-details .time { color: #e8ebfc; }

.reservation-note { margin: .55rem 0 0; color: var(--violet); font-size: .88rem; line-height: 1.4; }
.reservation-note:empty { margin: 0; }
.reservation-time { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.reservation-time .time { color: var(--violet); font-weight: 650; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.claim-note { margin: .55rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.claim-note:empty { margin: 0; }

button, input, select {
  min-height: 2.65rem;
  border: 1px solid #505977;
  border-radius: .55rem;
  font: inherit;
}

button {
  padding: .6rem .9rem;
  background: #2a324c;
  color: #eef0fb;
  font-size: .91rem;
  font-weight: 650;
  cursor: pointer;
}

button:hover:enabled { background: #394463; }
button.primary { border-color: var(--accent); background: var(--accent); color: #112d2b; }
button.primary:hover:enabled { border-color: #b7f4e3; background: #b7f4e3; }
button:disabled, button.primary:disabled {
  border-color: #343a52;
  background: #252a3d;
  color: #a0a9c5;
  cursor: default;
}

button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #d5ccff; outline-offset: 3px; }

.cycle-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  background: radial-gradient(ellipse at 100% 0%, #5547884a, transparent 80%), #25223c;
}

.cycle-phase { margin: .35rem 0 0; color: var(--violet); font-size: 1.1rem; font-weight: 650; }
.time { font-variant-numeric: tabular-nums; }

.cycle-time {
  margin: 0;
  color: #eee8ff;
  font-size: clamp(2.35rem, 6vw, 3.45rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.12;
}

.room-focus {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.room-focus h3 { margin: 0; color: var(--muted); font-size: .94rem; font-weight: 650; }
.focus-status { margin: .45rem 0 0; color: #dfe4f8; line-height: 1.4; }
.focus-time { margin: .35rem 0 0; color: var(--accent); font-size: 1.9rem; font-weight: 650; }
.focus-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .65rem; margin-top: .75rem; }
.field { display: grid; gap: .3rem; color: var(--muted); font-size: .84rem; }
.field input { width: 7rem; padding: .45rem .6rem; background: #111728; color: #eef0fb; }
.field input:disabled { border-color: #3c435d; color: #a0a9c5; }

.avatar-form { margin-top: 1.15rem; }
.avatar-form fieldset { min-width: 0; margin: 0; padding: .65rem 0 0; border: 0; border-top: 1px solid var(--border); }
.avatar-form legend { padding: 0 .45rem 0 0; color: var(--muted); font-size: .94rem; font-weight: 650; }
.avatar-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .65rem; }
.avatar-fields select { padding: .45rem 1.35rem .45rem .6rem; background: #111728; color: #eef0fb; }
.avatar-fields select:disabled { border-color: #3c435d; color: #a0a9c5; }

.feedback { margin: .8rem 0 0; color: #f5c5b7; font-size: .9rem; line-height: 1.45; }
.feedback[data-tone="success"] { color: var(--accent); }
.feedback:empty { margin: 0; }

.pilot-feedback { margin-top: 1rem; }
.pilot-feedback summary { cursor: pointer; font-weight: 650; }
.pilot-feedback-note { margin: .65rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.pilot-feedback fieldset { min-width: 0; margin: .75rem 0 0; padding: 0; border: 0; }
.pilot-feedback-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .65rem; }
.pilot-feedback-fields select { padding: .45rem 1.35rem .45rem .6rem; background: #111728; color: #eef0fb; }
.pilot-feedback-fields select:disabled { border-color: #3c435d; color: #a0a9c5; }

.participant-details { margin-top: 1rem; color: var(--muted); font-size: .88rem; }
.participant-details summary { width: fit-content; cursor: pointer; }
.participant-details input {
  display: block;
  width: min(100%, 42rem);
  margin-top: .55rem;
  padding: .45rem .6rem;
  background: #111728;
  color: #eef0fb;
  font-family: ui-monospace, monospace;
}

@media (max-width: 39rem) {
  .shell { width: calc(100% - 2rem); }
  main { padding-top: 2.5rem; }
  .dashboard { grid-template-columns: 1fr; }
  .window-details { flex-direction: column; }
}
