/* 안녕아파트 UI - modern dark / clean horror */
:root {
  color-scheme: dark;
  --bg: #07080d;
  --bg-2: #0b0d14;
  --panel: rgba(18, 22, 32, .74);
  --panel-solid: #111620;
  --panel-soft: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .105);
  --line-strong: rgba(255, 255, 255, .20);
  --ink: #f3f0e8;
  --muted: #aaa6b3;
  --faint: #72707c;
  --accent: #d8b56d;
  --accent-2: #8f6dff;
  --danger: #e05555;
  --shadow: 0 24px 90px rgba(0, 0, 0, .55);
  --blur: blur(22px) saturate(130%);
  --mono: "D2Coding", "IBM Plex Mono", "Consolas", monospace;
  --sans: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 14% -8%, rgba(143, 109, 255, .18), transparent 28rem),
    radial-gradient(circle at 86% 8%, rgba(216, 181, 109, .11), transparent 30rem),
    radial-gradient(circle at 50% 112%, rgba(115, 19, 28, .22), transparent 36rem),
    linear-gradient(180deg, #090a11 0%, #07080d 55%, #050508 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .38;
  mask-image: linear-gradient(to bottom, black 0 45%, transparent 90%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, transparent 0 48%, rgba(0,0,0,.48) 100%);
}

.is-hidden { display: none !important; }

button, input { font: inherit; }
button { user-select: none; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, h3, p { word-break: keep-all; }
h1, h2 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(24px, 3.2vw, 42px); font-weight: 520; }
h2 { font-size: 18px; font-weight: 520; }
p { line-height: 1.75; }

/* Intro */
.start-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.start-card {
  position: relative;
  width: min(620px, 100%);
  padding: clamp(34px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 0%, rgba(216,181,109,.16), transparent 18rem),
    radial-gradient(circle at 100% 100%, rgba(143,109,255,.12), transparent 18rem),
    rgba(12, 14, 20, .78);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: var(--blur);
  text-align: center;
}

.start-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 24px;
  pointer-events: none;
}

.start-card h1 {
  margin-top: 6px;
  font-size: clamp(42px, 8vw, 76px);
  font-weight: 560;
  letter-spacing: -.055em;
}

.start-subtitle {
  margin: 10px 0 34px;
  color: rgba(244,240,232,.68);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
}

.play-button {
  min-width: 190px;
  padding: 15px 34px;
  border: 1px solid rgba(216,181,109,.55);
  border-radius: 999px;
  color: #fff2ce;
  background:
    linear-gradient(135deg, rgba(216,181,109,.28), rgba(143,109,255,.13)),
    rgba(255,255,255,.045);
  box-shadow: 0 18px 60px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.08);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: .2em;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.play-button:hover,
.play-button:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255,224,160,.82);
  background-color: rgba(216,181,109,.10);
  outline: none;
}

.start-meta {
  margin: 28px auto 0;
  max-width: 460px;
  color: rgba(170,166,179,.64);
  font-size: 11px;
  line-height: 1.65;
}

.start-meta p {
  margin: 4px 0;
  line-height: inherit;
}

.intro-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.intro-frame {
  width: min(1120px, 100%);
  height: min(760px, calc(100vh - 56px));
  min-height: 620px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 206px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(10, 12, 18, .74);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: var(--blur);
}

.intro-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: #090c13;
}

.intro-scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .72;
  filter: brightness(.62) saturate(.84) contrast(1.06);
  transform: scale(1.012);
  transition: opacity .22s ease, transform .7s ease;
}
.intro-scene-image.is-changing { opacity: 0; transform: scale(1.025); }

.intro-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 0 70%, rgba(0,0,0,.45));
  pointer-events: none;
}

.door-scene { display: none; }

.door-scene::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 9%;
  width: min(390px, 42vw);
  height: 92%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, .10);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(255,255,255,.20) 50%, transparent 50.4%),
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.012));
  box-shadow: inset 0 0 90px rgba(0,0,0,.60), 0 30px 90px rgba(0,0,0,.34);
}

.door-line {
  position: absolute;
  left: calc(50% + min(145px, 15vw));
  top: 44%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 26px rgba(216,181,109,.5);
}

.package-box {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: min(240px, 44vw);
  height: 116px;
  transform: translateX(-50%) perspective(420px) rotateX(3deg) skewX(-2deg);
  display: grid;
  place-items: center;
  border: 1px solid rgba(216,181,109,.38);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(199,159,91,.43), rgba(77,55,32,.76)),
    linear-gradient(90deg, transparent 48%, rgba(255,255,255,.12) 48% 52%, transparent 52%);
  color: #f0d9a1;
  font-family: var(--mono);
  font-size: 12px;
  box-shadow: 0 28px 80px rgba(0,0,0,.52);
}

.hall-light {
  position: absolute;
  left: 50%;
  top: -22%;
  width: 460px;
  height: 460px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(230,215,170,.18), transparent 62%);
  filter: blur(8px);
}

.intro-letter {
  position: relative;
  z-index: 2;
  margin: 0;
  width: min(390px, 70vw);
  padding: 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: rgba(11, 13, 18, .78);
  box-shadow: 0 28px 90px rgba(0,0,0,.68);
  animation: letterIn .22s ease-out;
  cursor: zoom-in;
}
.intro-letter:hover { border-color: rgba(216,181,109,.45); }

.intro-letter img {
  display: block;
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 10px;
  filter: grayscale(.08) contrast(1.04) brightness(.93);
}

.intro-letter span {
  display: block;
  margin-top: 8px;
  text-align: center;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

@keyframes letterIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.intro-dialogue {
  position: relative;
  height: 224px;
  padding: 24px 28px 22px;
  border-top: 1px solid var(--line);
  background: rgba(12, 14, 20, .86);
  backdrop-filter: var(--blur);
}

.intro-dialogue::before {
  content: "23:58 / 현관";
  position: absolute;
  right: 28px;
  top: 24px;
  color: rgba(216,181,109,.42);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
}

.intro-text {
  width: min(820px, calc(100% - 260px));
  height: 112px;
  margin: 0;
  overflow: hidden;
  color: rgba(244, 240, 232, .76);
  font-size: clamp(15px, 1.25vw, 18px);
  font-weight: 360;
  line-height: 1.72;
  letter-spacing: -.006em;
  text-shadow: 0 8px 32px rgba(0,0,0,.92);
  white-space: pre-line;
}

.intro-controls {
  position: absolute;
  right: 28px;
  bottom: 22px;
  display: flex;
  gap: 10px;
}

/* Main layout */
.site-shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 60px;
}

.agency-header,
.notice-panel,
.registry-panel,
.building-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter: var(--blur);
}

.agency-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 0%, rgba(216,181,109,.16), transparent 26rem),
    linear-gradient(135deg, rgba(255,255,255,.075), rgba(255,255,255,.02)),
    rgba(18,22,32,.72);
}

.status-stamp {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(224,85,85,.65);
  color: #ff7a70;
  border-radius: 24px;
  transform: rotate(-5deg);
  font-family: var(--mono);
  font-weight: 560;
  line-height: 1.05;
  background: rgba(224,85,85,.075);
  box-shadow: 0 0 40px rgba(224,85,85,.10);
}

.notice-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin-top: 18px;
  padding: 28px;
}

.notice-copy { align-self: center; }
.notice-copy p { margin: 14px 0 0; color: rgba(217,213,206,.80); font-size: 14px; }
.muted { color: var(--muted) !important; }
.assignment-brief { grid-template-columns: minmax(0, 1fr); }

.letter-preview { display: none; }

.assignment-layout {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.registry-panel,
.building-panel,
.result-panel { padding: 22px; }

.registry-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.count-chip {
  min-width: 84px;
  padding: 9px 12px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.045);
  font-family: var(--mono);
  color: var(--muted);
}
.count-chip.valid { color: #ffe0a0; border-color: rgba(216,181,109,.55); background: rgba(216,181,109,.09); }

.image-reserve {
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  min-height: 112px;
  border: 1px dashed rgba(255,255,255,.17);
  border-radius: 20px;
  color: var(--faint);
  background:
    linear-gradient(135deg, rgba(255,255,255,.045), transparent),
    rgba(0,0,0,.18);
  font-family: var(--mono);
  font-size: 12px;
}
.image-reserve.wide { min-height: 96px; }

.building-figure {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0,0,0,.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  cursor: zoom-in;
  text-align: left;
  transition: border-color .14s ease, transform .14s ease, filter .14s ease;
}
.building-figure:hover { border-color: rgba(216,181,109,.45); filter: brightness(1.05); }
.building-figure:focus-visible { outline: 3px solid rgba(216,181,109,.38); outline-offset: 3px; }

.building-figure::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(7,8,13,.05), transparent 42%, rgba(7,8,13,.42)),
    radial-gradient(circle at 50% 50%, transparent 0 58%, rgba(0,0,0,.36) 100%);
}

.building-figure img {
  display: block;
  width: 100%;
  height: clamp(170px, 22vw, 300px);
  object-fit: cover;
  object-position: center;
  filter: brightness(.72) saturate(.82) contrast(1.05);
}

.building-figure span {
  position: absolute;
  left: 16px;
  bottom: 13px;
  z-index: 1;
  margin: 0;
  color: rgba(244,240,232,.72);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-shadow: 0 2px 18px rgba(0,0,0,.9);
}

.resident-list {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: visible;
}

.registry-panel.is-scroll-constrained .resident-list {
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(216,181,109,.45) rgba(255,255,255,.055);
}

.empty-registry {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
  line-height: 1.8;
  font-size: 14px;
}
.empty-registry code { color: #f0d28c; }

.resident-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.045);
  cursor: grab;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.resident-card:hover { transform: translateY(-2px); border-color: rgba(216,181,109,.38); background: rgba(255,255,255,.065); }
.resident-card:active { cursor: grabbing; }
.resident-card.is-assigned { opacity: .38; filter: grayscale(.7); }
.resident-card.is-locked {
  cursor: not-allowed;
}
.resident-card__head { display: flex; justify-content: space-between; gap: 10px; }
.resident-name { font-size: 15px; font-weight: 520; }
.resident-risk { color: var(--accent); font-family: var(--mono); font-size: 12px; }
.resident-trait { margin: 10px 0; color: var(--muted); font-size: 14px; }
.resident-card dl { margin: 0; display: grid; gap: 6px; font-size: 13px; }
.resident-card dl div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.resident-card dt { color: var(--faint); white-space: nowrap; }
.resident-card dd { margin: 0; color: #ded8cf; }
.resident-contract-item {
  padding: 0;
  border: 0;
  border-bottom: 1px dotted rgba(216,181,109,.45);
  background: transparent;
  color: #f1d79c;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.resident-contract-item:hover { color: #ffe8ae; border-bottom-color: rgba(216,181,109,.9); }

.building-grid {
  display: grid;
  grid-template-columns: 154px repeat(4, minmax(112px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
}

.floor-info,
.room-cell {
  min-height: 116px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.floor-info {
  padding: 13px;
  background: rgba(255,255,255,.035);
}
.floor-info strong {
  display: block;
  margin-bottom: 8px;
  color: #f3ecdc;
  font-weight: 520;
}
.floor-info span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.room-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 11px;
  background: rgba(8, 10, 15, .44);
  transition: background .14s ease, outline-color .14s ease;
}
.room-cell.drag-over { outline: 2px solid rgba(216,181,109,.80); outline-offset: -4px; background: rgba(216,181,109,.10); }
.room-number { color: rgba(240,236,227,.82); font-family: var(--mono); font-weight: 520; }
.room-hint { color: var(--faint); font-size: 12px; }
.assigned-resident {
  position: relative;
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(216,181,109,.30);
  border-radius: 14px;
  background: rgba(216,181,109,.08);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}
.assigned-resident strong { color: #f0d9a1; font: inherit; font-weight: 560; }
.assigned-resident span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.assigned-resident:hover { border-color: rgba(255,118,106,.52); background: rgba(255,118,106,.08); transform: translateY(-1px); }
.assigned-resident:disabled {
  cursor: not-allowed;
  border-color: rgba(216,181,109,.34);
  color: inherit;
  background: rgba(216,181,109,.08);
}
.assigned-resident:disabled:hover {
  transform: none;
  border-color: rgba(216,181,109,.34);
  background: rgba(216,181,109,.08);
}
.assigned-resident::after {
  content: "클릭하여 해제";
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: rgba(255,180,170,.72);
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}
.assigned-resident:hover::after {
  opacity: 1;
}
.assigned-resident:disabled::after { content: "접수 완료"; color: rgba(216,181,109,.70); }
.assigned-resident:disabled:hover::after { opacity: 1; }

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-top: 18px;
}
.signature-line { flex: 1; display: grid; gap: 8px; color: var(--muted); }
.signature-line input {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.28);
  color: var(--ink);
  outline: none;
}
.signature-line input:focus { border-color: rgba(216,181,109,.55); box-shadow: 0 0 0 4px rgba(216,181,109,.08); }

.ghost-button,
.submit-button {
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: rgba(255,255,255,.055);
  cursor: pointer;
  outline: none;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.ghost-button { padding: 9px 13px; font-size: 14px; }
.submit-button {
  padding: 12px 17px;
  font-size: 14px;
  border-color: rgba(216,181,109,.46);
  background: linear-gradient(135deg, rgba(216,181,109,.26), rgba(143,109,255,.10));
  color: #fff2ce;
}
.ghost-button:hover,
.submit-button:hover { transform: translateY(-1px); border-color: rgba(216,181,109,.62); background-color: rgba(255,255,255,.075); }
.ghost-button:focus-visible,
.submit-button:focus-visible {
  border-color: rgba(216,181,109,.82);
  box-shadow: 0 0 0 4px rgba(216,181,109,.12);
}
.ghost-button:disabled,
.submit-button:disabled,
.signature-line input:disabled {
  cursor: not-allowed;
  opacity: .55;
}
.site-shell.is-submitted .building-grid {
  outline: 1px solid rgba(216,181,109,.30);
  box-shadow: inset 0 0 0 1px rgba(216,181,109,.10), 0 0 60px rgba(216,181,109,.08);
}

.result-panel {
  margin-top: 18px;
  border-color: rgba(216,181,109,.34);
}
.result-panel h2 { margin-bottom: 12px; }
.result-panel ul { margin: 12px 0 0; padding-left: 20px; line-height: 1.8; }
.result-panel .error { color: #ff8b84; }
.result-panel .success { color: #ffe0a0; }
.result-reopen-button { margin-top: 16px; }

.letter-modal,
.item-modal,
.building-modal,
.assignment-result-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
}

.letter-modal__backdrop,
.item-modal__backdrop,
.building-modal__backdrop,
.assignment-result-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(12px);
}

.letter-modal__panel {
  position: relative;
  width: min(720px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  display: grid;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: rgba(10, 12, 18, .86);
  box-shadow: 0 34px 120px rgba(0,0,0,.76);
  animation: modalIn .16s ease-out;
}

.letter-modal__panel img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 96px);
  object-fit: contain;
  border-radius: 12px;
  filter: contrast(1.03) brightness(.96);
}

.letter-modal__close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(244,240,232,.84);
  background: rgba(8,10,15,.76);
  cursor: pointer;
}
.letter-modal__close:hover { border-color: rgba(216,181,109,.55); color: #fff; }

.building-modal__panel {
  position: relative;
  width: min(1180px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  display: grid;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: rgba(10, 12, 18, .88);
  box-shadow: 0 34px 120px rgba(0,0,0,.76);
  animation: modalIn .16s ease-out;
}

.building-modal__panel img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 96px);
  object-fit: contain;
  border-radius: 12px;
  filter: contrast(1.02) brightness(.96);
}

.building-modal__close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(244,240,232,.84);
  background: rgba(8,10,15,.76);
  cursor: pointer;
}
.building-modal__close:hover { border-color: rgba(216,181,109,.55); color: #fff; }

.assignment-result-modal__panel {
  position: relative;
  width: min(1120px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(216,181,109,.30);
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 0%, rgba(216,181,109,.13), transparent 24rem),
    radial-gradient(circle at 100% 100%, rgba(143,109,255,.12), transparent 24rem),
    rgba(10, 12, 18, .94);
  box-shadow: 0 34px 120px rgba(0,0,0,.76);
  animation: modalIn .16s ease-out;
}
.assignment-result-modal__panel h2 {
  margin: 6px 0 10px;
  color: #f4ead4;
  font-size: clamp(24px, 3vw, 36px);
}
.assignment-result-summary {
  margin: 0 0 18px;
  color: rgba(230,225,216,.78);
  font-size: 14px;
}
.assignment-result-grid {
  display: grid;
  grid-template-columns: 130px repeat(4, minmax(112px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.assignment-result-floor,
.assignment-result-room {
  min-height: 94px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.assignment-result-floor {
  background: rgba(255,255,255,.04);
}
.assignment-result-floor strong,
.assignment-result-room b {
  display: block;
  color: #f3ecdc;
  font-family: var(--mono);
  font-weight: 520;
}
.assignment-result-floor span {
  display: block;
  margin-top: 7px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.45;
}
.assignment-result-room {
  display: grid;
  align-content: space-between;
  gap: 6px;
  background: rgba(8, 10, 15, .44);
  color: var(--faint);
}
.assignment-result-room.is-filled {
  border-color: rgba(216,181,109,.20);
  background: rgba(216,181,109,.08);
  color: var(--muted);
}
.assignment-result-room strong {
  color: #f0d9a1;
  font-size: 15px;
  font-weight: 560;
}
.assignment-result-room span {
  font-size: 12px;
  line-height: 1.45;
}
.assignment-result-modal__close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(244,240,232,.84);
  background: rgba(8,10,15,.76);
  cursor: pointer;
}
.assignment-result-modal__close:hover { border-color: rgba(216,181,109,.55); color: #fff; }

.item-modal__panel {
  position: relative;
  width: min(520px, calc(100vw - 44px));
  padding: 28px;
  border: 1px solid rgba(216,181,109,.28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(216,181,109,.13), transparent 18rem),
    rgba(10, 12, 18, .92);
  box-shadow: 0 34px 120px rgba(0,0,0,.76);
  animation: modalIn .16s ease-out;
}
.item-modal__panel h2 {
  margin: 6px 0 8px;
  color: #f4ead4;
  font-size: clamp(22px, 3vw, 32px);
}
.item-modal__owner {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}
.item-modal__panel #item-modal-description {
  margin: 0;
  color: rgba(230,225,216,.84);
  line-height: 1.9;
  word-break: keep-all;
}
.item-modal__close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(244,240,232,.84);
  background: rgba(8,10,15,.76);
  cursor: pointer;
}
.item-modal__close:hover { border-color: rgba(216,181,109,.55); color: #fff; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.intro-fade-out { animation: introFadeOut .9s ease forwards; }
.site-fade-in { animation: siteFadeIn .85s ease both; }

.form-transition {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(3, 4, 7, .96);
  backdrop-filter: blur(12px);
  pointer-events: none;
  animation: transitionFadeIn .9s ease forwards;
}

.form-transition.is-leaving {
  animation: transitionFadeOut .8s ease forwards;
}

@keyframes introFadeOut {
  to { opacity: 0; transform: scale(.99); filter: blur(6px); }
}

@keyframes siteFadeIn {
  from { opacity: 0; transform: translateY(8px); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes transitionFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes transitionFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (max-width: 1100px) {
  .assignment-layout { grid-template-columns: 1fr; }
  .resident-list { max-height: none; }
}

@media (max-width: 760px) {
  .intro-screen { padding: 10px; }
  .intro-frame { height: calc(100vh - 20px); min-height: 580px; grid-template-rows: minmax(0, 1fr) 240px; border-radius: 22px; }
  .intro-dialogue { height: 240px; padding: 20px 18px; }
  .intro-dialogue::before { display: none; }
  .intro-text { width: 100%; height: 126px; font-size: 14px; }
  .intro-controls { left: 18px; right: 18px; bottom: 18px; }
  .intro-controls button { flex: 1; }
  .intro-letter { width: min(330px, 82vw); }
  .site-shell { width: min(100% - 18px, 1480px); padding-top: 9px; }
  .agency-header, .notice-panel, .panel-title-row, .form-footer { grid-template-columns: 1fr; flex-direction: column; }
  .notice-panel { display: block; }
  .building-grid, .assignment-result-grid { grid-template-columns: 1fr; }
  .floor-info, .assignment-result-floor { min-height: auto; }
}
