:root {
  --ink: #1f1b2d;
  --ink-2: #5b5468;
  --paper: #f7f2e8;
  --surface: #fffdf8;
  --rule: #e6dccb;
  --lantern: #e2663a;
  --lantern-ink: #fff;
  --moss: #3f6b52;
  --live: #2f6b4a;
  --dusk: #2b2547;
  --shadow: 0 18px 36px -24px rgba(31, 27, 45, 0.55);
  --radius-thumb: 12px;
  --gutter: 16px;
  --maxw: 1120px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  --text-hero: clamp(1.9rem, 1.2rem + 3.2vw, 3.6rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Starfield (space.js), as "r g b" triplets. Light: a twilight star chart on paper. */
  --star: 86 72 138;
  --star-max: 0.55;
  --glow-a: 226 102 58;
  --glow-b: 122 98 196;
  --glow-alpha: 0.13;
  --sky: 74 63 115;
  --sky-alpha: 0.1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4efe6;
    --ink-2: #bdb4c8;
    --paper: #15121f;
    --surface: #1e1a2c;
    --rule: #332d45;
    --dusk: #0d0b15;
    --shadow: 0 18px 36px -24px rgba(0, 0, 0, 0.9);
    --live: #8fd6a8;
    /* Night sky: warm white stars, deeper top band. */
    --star: 255 246 232;
    --star-max: 0.9;
    --glow-alpha: 0.16;
    --sky: 6 4 14;
    --sky-alpha: 0.55;
  }
}
* { box-sizing: border-box; }
/* Author display rules (.door, .preview, .filters) must not beat the hidden attribute. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.65 var(--font); }
a { color: inherit; }
/* Fixed starfield behind everything (z-index -1 still shows over body); 100lvh covers under hiding URL bars. */
.starfield { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; display: block; }
@media print { .starfield { display: none; } }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 32px; display: block; }
.top-link { font-size: 0.95rem; text-decoration: none; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 14px; white-space: nowrap; }
.top-link:hover, .top-link:focus-visible { border-color: var(--lantern); color: var(--lantern); }

.hero { position: relative; padding-block: 28px 20px; }
.hero h1 { font-size: var(--text-hero); line-height: 1.15; letter-spacing: -0.035em; margin: 0 0 12px; font-weight: 800; }
.hero h1 em { font-style: normal; color: var(--lantern); }
.hero p { margin: 0; color: var(--ink-2); max-width: 34em; }
/* Owner 10/31: on a full desktop window the heading and the intro each sit on one line. */
@media (max-width: 619px) { .hero p { font-size: 14px; } }
@media (min-width: 620px) { .hero .hero-br-sm { display: none; } }
@media (min-width: 1100px) { .hero .hero-br { display: none; } .hero p { max-width: none; white-space: nowrap; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Search lives in the top bar (owner 10/31): an input left of 등록 요청 on wider screens; on phones a magnifier
   that opens the input across the whole bar. */
.top { position: relative; }
.top-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-search { display: flex; align-items: center; gap: 6px; min-width: 0; }
.search-input { width: 220px; box-sizing: border-box; font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: 7px 14px; outline: none; transition: border-color .2s var(--ease); }
.search-input:focus-visible { border-color: var(--lantern); }
.search-input::placeholder { color: var(--ink-2); }
.search-toggle, .search-close { display: none; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; }
.search-toggle { width: 38px; height: 38px; padding: 0; align-items: center; justify-content: center; }
.search-close { padding: 7px 12px; font-size: 0.9rem; white-space: nowrap; }
.search-toggle:focus-visible, .search-close:focus-visible { border-color: var(--lantern); outline: none; }
@media (max-width: 619px) {
  .search-input { display: none; }
  .search-toggle { display: inline-flex; }
  .top.is-searching .top-search { position: absolute; inset: 0; z-index: 5; padding: 0 var(--gutter); background: var(--paper); }
  .top.is-searching .search-toggle { display: none; }
  .top.is-searching .search-input { display: block; flex: 1; width: auto; min-width: 0; font-size: 1rem; padding: 10px 16px; }
  .top.is-searching .search-close { display: inline-block; }
}
.filters { display: flex; gap: 8px; overflow-x: auto; padding-block: 18px 8px; scrollbar-width: none; scroll-padding-inline: var(--gutter); }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; text-decoration: none; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: 0.92rem; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.chip:hover, .btn.ghost:hover { border-color: var(--lantern); }
.chip[aria-current="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }
.chip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 8px; }
.chip-head-title { margin: 0; font-size: 1.8rem; letter-spacing: -0.03em; }
.chip-head-title span { color: var(--lantern); }
.chip-head-all { flex: none; font-size: 0.9rem; color: var(--ink-2); }
.chip:focus-visible, .btn:focus-visible, .chip-head-all:focus-visible, .door:focus-within { outline: 3px solid var(--lantern); outline-offset: 2px; }

/* Owner rule (10/31): the first 3 cards of a section are big, the rest small (door--sm), each in rows of their own.
   A wrapping flex row lets the two sizes use different column counts; --n is how many of that card share a row.
   Basis is 1px under the share so rounding never wraps a row early; max-width keeps a short last row aligned. */
.grid { --gap: 14px; display: flex; flex-wrap: wrap; gap: var(--gap); padding-block: 12px 48px; }
.grid > * { min-width: 0; }
.grid > .empty { flex: 1 1 100%; }
.grid > .door { --n: 1; flex: 1 1 calc((100% - (var(--n) - 1) * var(--gap)) / var(--n) - 1px); max-width: calc((100% - (var(--n) - 1) * var(--gap)) / var(--n)); }
.grid > .door--sm { --n: 2; }
@media (min-width: 620px) { .grid { --gap: 18px; } .grid > .door { --n: 2; } .grid > .door.is-feature { --n: 1; } .grid > .door--sm { --n: 3; } }
@media (min-width: 840px) { .grid > .door--sm { --n: 4; } }
@media (min-width: 960px) { .grid > .door, .grid > .door.is-feature { --n: 3; } .grid > .door--sm { --n: 4; } }
/* Owner 10/31: the first two rows of small cards (door--mid, small #1-8) stay 4 to a row, the rest 5. */
@media (min-width: 1100px) { .grid > .door--sm { --n: 5; } .grid > .door--sm.door--mid { --n: 4; } }

.door { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--rule); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); transition: transform .35s var(--ease); }
.door:hover { transform: translateY(-3px); }
/* Frames use the OG image ratio (1200x630) so og:image pictures show whole. */
.door-frame { display: block; margin: 14px 14px 0; aspect-ratio: 1200 / 630; border-radius: var(--radius-thumb); overflow: hidden; background: linear-gradient(160deg, var(--dusk), #4a3f73 60%, var(--lantern)); position: relative; }
.door-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Second image (our screenshot, owner 10/31): stacked over the first in the same box, faded in on mouse hover or
   by the rotation in app.js (.is-shot). Opacity only, so nothing moves. */
.door-frame .door-shot { position: absolute; inset: 0; opacity: 0; transition: opacity .4s var(--ease); }
.door.is-shot .door-shot { opacity: 1; }
@media (hover: hover) { .door:hover .door-shot { opacity: 1; } }
.door-frame .glyph { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.9); font-size: 2.4rem; font-weight: 800; letter-spacing: -0.04em; }
.door-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.door-cat { font-size: 0.78rem; font-weight: 700; color: var(--moss); letter-spacing: 0.04em; }
.door-name { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; overflow-wrap: anywhere; }
.door-name a { text-decoration: none; }
.door-name a:hover, .door-name a:focus-visible { color: var(--lantern); }
a.door-cat { text-decoration: none; }
.door-sum { margin: 0; color: var(--ink-2); font-size: 0.95rem; flex: 1; }
.door-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.door-host { font-size: 0.8rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; background: var(--lantern); color: var(--lantern-ink); white-space: nowrap; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -10px var(--lantern); }
.btn:active { transform: translateY(0); }
/* Small card: picture, category + live badge (when there is a number), name (2 lines), 들어가기.
   The tag row wraps on narrow cards (~137px at 320px) and a long category ends in an ellipsis. */
.door--sm { border-radius: 16px; }
.door--sm .door-frame { margin: 8px 8px 0; border-radius: 10px; }
.door--sm .door-frame .glyph { font-size: 1.6rem; }
.door--sm .door-body { padding: 8px 10px 10px; gap: 4px; }
.door--sm .door-sum, .door--sm .door-host { display: none; }
.door--sm .door-tags { justify-content: space-between; flex-wrap: wrap; gap: 2px 6px; }
.door--sm .door-cat { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; line-height: 1.6; }
.door--sm .live { margin-left: auto; max-width: 100%; overflow: hidden; font-size: 0.72rem; padding: 2px 8px; }
.door--sm .door-name { font-size: 0.98rem; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.door--sm .door-foot { margin-top: auto; padding-top: 4px; }
.door--sm .btn { width: 100%; justify-content: center; padding: 7px 12px; font-size: 0.88rem; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.empty { padding: 40px 0; color: var(--ink-2); }
.radio-row { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.radio-row legend { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; width: 100%; }
.section-title { margin: 8px 0 0; font-size: 1.4rem; letter-spacing: -0.02em; }

.detail { padding-block: 4px 32px; }
.crumbs { font-size: 0.9rem; color: var(--ink-2); padding-block: 4px 14px; }
.crumbs a { text-decoration: none; }
.crumbs a:first-child::before { content: "← "; }
.space { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--rule); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.space > * { min-width: 0; }
@media (min-width: 860px) { .space { grid-template-columns: 1.3fr 1fr; align-items: center; } .space .door-frame { margin: 14px 0 14px 14px; } }
.space-body { padding: 0 20px 22px; display: grid; gap: 10px; justify-items: start; }
.space .door-tags { justify-content: flex-start; flex-wrap: wrap; }
.space-name { font-size: var(--text-hero); line-height: 1.15; letter-spacing: -0.035em; margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.space-sum { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.space-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.space-actions .btn { flex: 1 1 auto; justify-content: center; padding: 13px 24px; font-size: 1.05rem; }
.space .notice { border: 0; padding: 4px 0 0; margin: 0; }
.gallery { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.gallery .door-frame { flex: 1 1 260px; max-width: 560px; margin: 0; }
@media (min-width: 620px) { .grid--similar > .door--sm { --n: 3; } }
@media (min-width: 1100px) { .grid--similar > .door--sm { --n: 6; } }
.preview { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--rule); border-radius: 14px; font-size: 0.92rem; color: var(--ink-2); }
.preview img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: var(--radius-thumb); display: block; }
.preview p { margin: 0; }

.made-with { padding-block: 4px 32px; }
.made-card { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; padding: 22px 24px; border-radius: 22px; text-decoration: none; color: #fff; background: radial-gradient(120% 140% at 100% 0%, rgba(226, 102, 58, 0.55), transparent 55%), linear-gradient(140deg, var(--dusk), #3a3166); box-shadow: var(--shadow); overflow: hidden; transition: transform .3s var(--ease); }
.made-card:hover { transform: translateY(-2px); }
.made-card:focus-visible { outline: 3px solid var(--lantern); outline-offset: 3px; }
.made-logo { width: 56px; height: 56px; border-radius: 14px; background: #fff; padding: 8px; }
.made-text { display: grid; gap: 4px; min-width: 0; }
.made-kicker { font-size: 0.8rem; font-weight: 700; color: #f2a65a; }
@media (max-width: 480px) { .made-card { grid-template-columns: 1fr; gap: 12px; } .made-logo { width: 44px; height: 44px; } }
.made-title { font-size: clamp(1.15rem, 1rem + 0.8vw, 1.5rem); letter-spacing: -0.02em; }
.made-sub { color: rgba(255, 255, 255, 0.75); font-size: 0.92rem; }
.made-cta { justify-self: start; margin-top: 10px; padding: 8px 16px; border-radius: 999px; background: var(--lantern); font-weight: 700; font-size: 0.92rem; }

.live-total { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 0; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); color: var(--ink-2); font-size: 0.9rem; min-height: 48px; }
.live-total-num { color: var(--ink); font-weight: 800; font-size: 1rem; }
.live-total-note { font-size: 0.78rem; color: var(--ink-2); }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--lantern); }
.door-tags { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.live { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; line-height: 1.4; white-space: nowrap; border-radius: 999px; padding: 2px 9px; }
.live-on { color: var(--live); background: color-mix(in srgb, var(--live) 14%, transparent); font-weight: 700; }
.live-on .live-dot { width: 6px; height: 6px; background: var(--live); }
.live-off { color: var(--ink-2); opacity: 0.8; }
.others, .space-gallery, .similar { margin-top: 28px; }
.others-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.others-list a { display: inline-block; padding: 8px 14px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; background: var(--surface); }
.others-list a:hover, .others-list a:focus-visible { border-color: var(--lantern); color: var(--lantern); }
.chip-n { font-size: 0.8em; opacity: 0.6; font-variant-numeric: tabular-nums; }
.notice { font-size: 0.85rem; color: var(--ink-2); border-top: 1px solid var(--rule); padding-block: 18px; }
.foot { border-top: 1px solid var(--rule); padding-block: 22px 40px; font-size: 0.88rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 10px 18px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--lantern); }

.page { max-width: 680px; margin: 0 auto; padding: 8px var(--gutter) 56px; }
.page h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); letter-spacing: -0.03em; margin: 12px 0 8px; }
.page h2 { font-size: 1.1rem; margin: 28px 0 6px; }
.page p, .page li { color: var(--ink); }
.page .lead { color: var(--ink-2); margin-top: 0; }
form { display: grid; gap: 16px; margin-top: 20px; }
label { display: grid; gap: 6px; font-weight: 700; font-size: 0.95rem; }
label small { font-weight: 400; color: var(--ink-2); }
input, select, textarea { font: inherit; width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--lantern); outline-offset: 1px; }
textarea { min-height: 120px; resize: vertical; }
.field { display: grid; gap: 6px; }
.field-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.help > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 0.8rem; font-weight: 700; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary:focus-visible { outline: 3px solid var(--lantern); outline-offset: 2px; }
.help[open] { flex-basis: 100%; }
.help p { margin: 6px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2); font-size: 0.88rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 5px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status { min-height: 1.6em; font-weight: 700; }
.status.ok { color: var(--moss); }
.status.err { color: var(--lantern); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { border: 1px solid var(--rule); padding: 8px; text-align: left; vertical-align: top; }
@media (max-width: 600px) { table { display: block; overflow-x: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
