.party-wrap { max-width: 980px; }

.party-hero { padding-bottom: 54px; }
.party-hero h1 { max-width: 18ch; }
.party-hero .lede { max-width: 58ch; }

.party-promises {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  list-style: none;
  margin: 34px 0 0;
  max-width: 900px;
}
.party-promises li {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  padding: 16px 18px;
  font-size: 13.5px;
}
.party-promises strong { color: var(--ink); }

.party-lanterns {
  display: flex;
  align-items: flex-end;
  gap: 26px;
  min-height: 96px;
  margin: 28px 0 8px 8px;
}
.lantern {
  position: relative;
  display: block;
  width: 48px;
  height: 58px;
  border: 2px solid var(--accent);
  border-radius: 10px 10px 16px 16px;
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
  box-shadow: 0 10px 34px color-mix(in srgb, var(--accent) 22%, transparent);
  transform-origin: 50% -24px;
}
.lantern::before {
  content: "";
  position: absolute;
  width: 27px;
  height: 20px;
  left: 8px;
  top: -17px;
  border: 2px solid var(--accent);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
}
.lantern::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  left: 16px;
  top: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px 5px color-mix(in srgb, var(--accent) 42%, transparent);
}
.lantern-one { animation: lantern-sway 2.8s ease-in-out 1; }
.lantern-two { width: 54px; height: 66px; animation: lantern-sway 3.1s .14s ease-in-out 1; }
.lantern-two::before { width: 31px; left: 9px; }
.lantern-two::after { left: 19px; top: 25px; }
.lantern-three { animation: lantern-sway 2.6s .28s ease-in-out 1; }

@keyframes lantern-sway {
  0%, 100% { transform: rotate(0); }
  35% { transform: rotate(4deg); }
  70% { transform: rotate(-3deg); }
}

.party-stage { min-height: 560px; }
.player-form { max-width: 780px; }
.player-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.player-field,
.answer-field { display: grid; gap: 8px; }
.player-field span,
.answer-field span {
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.player-field input,
.answer-field textarea {
  width: 100%;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
}
.player-field input { min-height: 48px; }
.answer-field textarea {
  resize: vertical;
  min-height: 126px;
  line-height: 1.55;
}
.player-field input:focus,
.answer-field textarea:focus { border-color: var(--accent); }
.party-button { border: 0; cursor: pointer; }
.form-error {
  color: var(--ink);
  font-weight: 650;
  margin: -4px 0 18px;
  max-width: 66ch;
}

.party-meter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.phase-track {
  display: grid;
  grid-template-columns: auto minmax(26px, 76px) auto minmax(26px, 76px) auto;
  align-items: center;
  flex: 1;
  max-width: 620px;
}
.phase-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 13px;
  white-space: nowrap;
}
.phase-step b {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--control-line);
  border-radius: 50%;
  font-size: 12px;
}
.phase-step[data-state="current"] { color: var(--ink); font-weight: 700; }
.phase-step[data-state="current"] b { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.phase-step[data-state="done"] { color: var(--accent); }
.phase-step[data-state="done"] b { border-color: var(--accent); }
.phase-step[data-state="done"]::after {
  content: "✓";
  color: var(--ink);
  font-weight: 800;
}
.phase-line { height: 1px; background: var(--line); margin: 0 10px; }
.turn-count { color: var(--faint); font-size: 12px; white-space: nowrap; }

.handoff-card,
.turn-card,
.world-result {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: clamp(28px, 5vw, 52px);
}
.handoff-card {
  min-height: 330px;
  display: grid;
  align-content: center;
  justify-items: start;
}
.handoff-card h2,
.turn-card h2 {
  max-width: 24ch;
  overflow-wrap: anywhere;
}
.handoff-card p,
.turn-rule,
.result-lede { color: var(--muted); max-width: 58ch; }
.handoff-card p { margin-bottom: 28px; }
.handoff-glow {
  position: absolute;
  top: 22px;
  right: 28px;
  color: var(--accent);
  font-size: 42px;
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 62%, transparent);
}
.turn-rule { margin: 2px 0 26px; }
.answer-field { margin-bottom: 18px; }
.party-exit { display: flex; justify-content: flex-end; margin-top: 16px; }
.party-exit .btn { cursor: pointer; }

.world-result { margin-top: 0; }
.world-result.is-born { border-color: var(--accent); }
.world-result h2 { max-width: 28ch; }
.world-output {
  display: grid;
  gap: 18px;
  margin-top: 30px;
}
.world-group {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.world-group h3 {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.world-entry {
  display: grid;
  grid-template-columns: minmax(132px, .8fr) minmax(0, 2fr);
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.world-entry:last-child { border-bottom: 0; }
.world-entry .world-by { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.world-entry .world-text { color: var(--ink); overflow-wrap: anywhere; }
.world-entry .world-text strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 500; }
.result-actions { margin-top: 30px; }
.result-actions button { cursor: pointer; }
.copy-status { min-height: 1.5em; color: var(--accent); font-size: 12.5px; margin-top: 14px; }
.copy-helper { position: fixed; inset: auto auto 0 0; width: 1px; height: 1px; opacity: 0; }

.dawn-card {
  position: relative;
  overflow: hidden;
  margin-top: 30px;
  border-top: 1px solid var(--accent);
  padding-top: 32px;
}
.dawn-card h3 {
  max-width: 30ch;
  padding-right: 54px;
  overflow-wrap: anywhere;
}
.dawn-sun {
  position: absolute;
  top: 26px;
  right: 4px;
  color: var(--accent);
  font-size: 42px;
  line-height: 1;
  text-shadow: 0 0 26px color-mix(in srgb, var(--accent) 40%, transparent);
}
.dawn-weather {
  max-width: 62ch;
  color: var(--muted);
  font-style: italic;
  overflow-wrap: anywhere;
}
.dawn-laws {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 26px 0;
}
.dawn-law {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
.dawn-law strong,
.dawn-law p,
.dawn-law .mono { overflow-wrap: anywhere; }
.dawn-law strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 500; }
.dawn-law p { margin: 10px 0; color: var(--muted); font-size: 13.5px; }
.dawn-law .mono { color: var(--faint); font-size: 11px; }
.dawn-weave {
  margin: 20px 0;
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 20px;
}
.dawn-weave p {
  max-width: 58ch;
  margin: 0 0 9px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.dawn-weave footer { color: var(--faint); font-size: 11px; }
.dawn-close { margin-top: 24px; color: var(--ink); font-style: italic; }

.celebration { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.celebration i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  opacity: 0;
}
.is-born .celebration i { animation: party-fall 1.15s ease-out 1; }
.celebration i:nth-child(1) { left: 7%; animation-delay: .02s; transform: rotate(12deg); }
.celebration i:nth-child(2) { left: 18%; animation-delay: .18s; background: var(--feed-b); }
.celebration i:nth-child(3) { left: 29%; animation-delay: .08s; background: var(--feed-c); }
.celebration i:nth-child(4) { left: 41%; animation-delay: .28s; }
.celebration i:nth-child(5) { left: 53%; animation-delay: .12s; background: var(--feed-b); }
.celebration i:nth-child(6) { left: 65%; animation-delay: .24s; background: var(--feed-c); }
.celebration i:nth-child(7) { left: 76%; animation-delay: .04s; }
.celebration i:nth-child(8) { left: 87%; animation-delay: .2s; background: var(--feed-b); }
.celebration i:nth-child(9) { left: 95%; animation-delay: .1s; background: var(--feed-c); }
@keyframes party-fall {
  0% { opacity: 0; translate: 0 0; rotate: 0deg; }
  15% { opacity: 1; }
  100% { opacity: 0; translate: 0 330px; rotate: 240deg; }
}

.party-rules .step { min-height: 210px; }

@media (max-width: 720px) {
  .party-promises,
  .player-fields,
  .dawn-laws { grid-template-columns: 1fr; }
  .party-promises { gap: 10px; }
  .party-meter { align-items: flex-start; flex-direction: column; }
  .phase-track { width: 100%; }
  .phase-step { gap: 5px; font-size: 11.5px; }
  .phase-step b { width: 24px; height: 24px; }
  .phase-line { margin-inline: 6px; }
  .world-entry { grid-template-columns: 1fr; gap: 5px; }
  .party-exit { justify-content: stretch; }
  .party-exit .btn { width: 100%; }
}

@media (max-width: 380px) {
  .party-lanterns { justify-content: center; margin-left: 0; }
  .phase-step { display: grid; justify-items: center; }
  .phase-line { margin-inline: 3px; }
  .handoff-card,
  .turn-card,
  .world-result { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .lantern,
  .is-born .celebration i { animation: none !important; }
  .celebration { display: none; }
}

@media (forced-colors: active) {
  .lantern,
  .handoff-card,
  .turn-card,
  .world-result,
  .dawn-law,
  .player-field input,
  .answer-field textarea { border: 1px solid ButtonText; box-shadow: none; }
}
