:root {
  --navy: #02021E;
  --panel: #0E1433;
  --panel-2: #121A3F;
  --line: #1C2448;
  --line-2: #2A335C;
  --muted: #A9B1CC;
  --amber: #F2B45A;
  --teal: #00C2CE;
  --lilac: #A9B8FF;
  --wood: #5A4326;
  --danger: #FF8A80;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: #fff; font-family: Montserrat, Arial, sans-serif; }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--teal); }
a:hover { color: #5FE3EA; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px; color: var(--muted); }
.screen { animation: fade .3s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Buttons */
.btn { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--amber); color: #fff; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--navy); font-weight: 600; }
.btn-primary:hover { background: #F7C579; color: var(--navy); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-small { height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line-2); background: transparent; color: #fff; cursor: pointer; }
.icon-btn:hover { border-color: var(--amber); }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 13px; cursor: pointer; padding: 6px 0; text-decoration: underline; }
.link-btn:hover { color: #fff; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: #fff; font-size: 15px; width: 100%; }
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > * { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.6; }

/* Sign in */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { margin: 0; font-size: 26px; }
.auth-mark { width: 56px; height: 56px; border-radius: 14px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; }

/* Door */
.door { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; overflow: hidden; position: relative; padding: 48px 24px; }
.door-scene { display: flex; flex-direction: column; align-items: center; animation: enter 2.5s ease-in forwards; }
.door-body { width: 300px; height: 400px; background: #141B3D; border: 2px solid var(--line-2); border-top: none; display: flex; align-items: flex-end; justify-content: center; }
.door-frame { width: 176px; height: 320px; background: #2A1F12; position: relative; border: 6px solid #3A4470; border-bottom: none; }
.door-light { position: absolute; inset: 0; background: var(--amber); animation: glow 2.5s ease-in forwards; }
.door-leaf { position: absolute; inset: 0; background: #1F2A5A; border: 1px solid #3A4470; display: flex; flex-direction: column; align-items: center; justify-content: space-around; padding: 20px 0; transform-origin: left center; animation: leaf 2.5s ease-in-out forwards; }
.door-panel { width: 116px; height: 104px; border: 2px solid #3A4470; border-radius: 4px; }
.door-handle { position: absolute; right: 16px; top: 52%; width: 11px; height: 11px; border-radius: 50%; background: var(--amber); }
.door-step { width: 380px; height: 10px; background: var(--line-2); }
.door h1 { margin: 0; font-size: 30px; font-weight: 600; text-align: center; animation: rise .6s .3s ease-out both; }
.door .skip { position: absolute; right: 28px; bottom: 28px; }
@keyframes leaf { 0%, 18% { transform: perspective(900px) rotateY(0); } 70%, 100% { transform: perspective(900px) rotateY(-105deg); } }
@keyframes glow { 0%, 18% { opacity: .15; } 70%, 100% { opacity: 1; } }
@keyframes enter { 0%, 68% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .door-scene, .door-leaf, .door-light, .door h1, .screen { animation-duration: .01s; animation-delay: 0s; } }

/* Top bar */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 200px; }
.brand strong { font-size: 19px; }
.brand small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.search { position: relative; flex: 2 1 300px; max-width: 520px; }
.search .input { padding-left: 44px; }
.search svg { position: absolute; left: 14px; top: 13px; }
.results { position: absolute; left: 0; right: 0; top: 54px; z-index: 30; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.45); max-height: 380px; overflow-y: auto; }
.result { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: transparent; border: 0; border-radius: 8px; color: #fff; text-align: left; cursor: pointer; font-size: 14px; }
.result:hover, .result:focus-visible { background: var(--line); }
.result span:last-child { color: var(--muted); font-size: 12px; text-align: right; }
.me { display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* Layout */
.page { display: flex; flex-wrap: wrap; gap: 28px; padding: 24px 32px 48px; max-width: 1400px; margin: 0 auto; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.side { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.card h2, .side h2 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar .hint { margin-left: 4px; }
.tab-on { background: var(--amber); border-color: var(--amber); color: var(--navy); font-weight: 600; }
.tab-on:hover { color: var(--navy); }

/* House pictures and hotspots */
.stage { position: relative; width: 100%; margin: 0 auto; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 18px 24px rgba(0,0,0,.5)); }
.stage .missing { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; border: 2px dashed var(--line-2); border-radius: 14px; color: var(--muted); font-size: 14px; }
.spot { position: absolute; padding: 0; margin: 0; background: transparent; border: 0; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.spot:hover, .spot:focus-visible { background: rgba(242,180,90,.18); outline: none; }
.tag { font-size: 12px; font-weight: 600; color: #fff; background: rgba(2,2,30,.86); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 10px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; pointer-events: none; }
.spot.poly .tag { position: absolute; transform: translate(-50%, -50%); margin: 0; }
.spot:hover .tag, .spot:focus-visible .tag { background: var(--amber); border-color: var(--amber); color: var(--navy); }

/* Lists */
.list { display: flex; flex-direction: column; gap: 4px; }
.list-btn { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: transparent; border: 0; border-radius: 8px; color: #fff; text-align: left; cursor: pointer; }
.list-btn:hover, .list-btn:focus-visible { background: var(--line); }
.list-btn small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* Room header */
.room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.room-head h1 { margin: 0; font-size: 28px; }
.room-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.coming { border-style: dashed; }
.coming ul { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.coming li { display: flex; align-items: center; gap: 10px; font-size: 15px; }

/* Noticeboard */
.board { background: #6B4B2A; background-image: radial-gradient(rgba(0,0,0,.12) 1px, transparent 1px); background-size: 6px 6px; border: 10px solid var(--wood); border-radius: 12px; padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; min-height: 220px; align-content: start; }
.note { color: #1B1B1B; border-radius: 4px; padding: 16px 14px 12px; box-shadow: 0 6px 14px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; position: relative; min-height: 150px; }
.note:nth-child(3n+1) { transform: rotate(-1.2deg); }
.note:nth-child(3n+2) { transform: rotate(.8deg); }
.note p { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.45; flex: 1; }
.note footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: #3B3B3B; }
.note .actions { display: flex; gap: 4px; }
.note .actions button { background: rgba(0,0,0,.08); border: 0; border-radius: 6px; height: 30px; padding: 0 8px; font-size: 12px; color: #1B1B1B; cursor: pointer; }
.note .actions button:hover { background: rgba(0,0,0,.18); }
.note .pin { position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #C0392B; box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.note-yellow { background: #FFE68A; } .note-pink { background: #FFC1D3; } .note-blue { background: #BFE3FF; } .note-green { background: #C8F0B8; }
.swatches { display: flex; gap: 10px; align-items: center; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span { width: 36px; height: 36px; border-radius: 8px; display: block; border: 3px solid transparent; cursor: pointer; }
.swatch input:checked + span { border-color: #fff; }
.swatch input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Calendar */
.cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.cal-head h2 { margin: 0; font-size: 22px; letter-spacing: 0; text-transform: none; color: #fff; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 0; }
.day { min-height: 96px; background: var(--panel-2); border: 1px solid transparent; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; text-align: left; color: #fff; overflow: hidden; }
.day:hover { border-color: var(--line-2); }
.day.other { opacity: .45; }
.day.today .num { background: var(--amber); color: var(--navy); }
.day.sel { border-color: var(--amber); }
.day .num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.chip { font-size: 11px; font-weight: 600; line-height: 1.3; padding: 2px 6px; border-radius: 4px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more { font-size: 11px; color: var(--muted); }
.ev { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .bar { width: 4px; align-self: stretch; border-radius: 2px; flex: 0 0 auto; }
.ev .body { flex: 1; min-width: 0; }
.ev .title { font-size: 15px; font-weight: 600; word-break: break-word; }
.ev .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.feed-url { font-family: Consolas, "Courier New", monospace; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; word-break: break-all; color: var(--muted); }
@media (max-width: 640px) { .day { min-height: 64px; } .chip { display: none; } .day.has::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); } .topbar, .room-head, .page { padding-left: 16px; padding-right: 16px; } }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(2,2,30,.75); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { margin: 0; font-size: 22px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }

/* QualiHub door */
.qh-door { width: 100%; min-height: 360px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; padding: 24px; background: #0A0F2A; border: 3px solid var(--teal); border-bottom: none; border-radius: 12px 12px 0 0; color: #fff; text-decoration: none; }
.qh-door:hover { border-color: #5FE3EA; color: #fff; }
.qh-door .panels { display: flex; flex-direction: column; gap: 14px; }
.qh-door .panels span { display: block; height: 86px; border: 2px solid var(--line); border-radius: 6px; }
.threshold { height: 8px; background: var(--wood); border-radius: 0 0 4px 4px; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; background: var(--amber); color: var(--navy); padding: 12px 20px; border-radius: 10px; font-weight: 600; font-size: 14px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.4); }
