:root {
  --bg: #060a16;
  --panel: rgba(14, 20, 42, 0.72);
  --panel-solid: #0e142a;
  --line: rgba(160, 180, 255, 0.16);
  --text: #eef1ff;
  --muted: #9aa4c7;
  --job: #4f8cff;
  --resume: #ff8a3d;
  --accent: #bfa8ff;
  --danger: #ff5f6d;
  --radius: 14px;
  --font: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; cursor: grab; }

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; word-break: break-word; margin: 0 0 8px; }
.hidden { display: none !important; }

/* ---------- 버튼 ---------- */
.btn {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06); cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .15s, border-color .15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #5b7cff, #a46bff); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 95, 109, .5); color: #ffb3ba; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: #ff9aa4; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.06); cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(255,255,255,.14); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; letter-spacing: .02em; vertical-align: middle; }
.badge.job { background: rgba(79, 140, 255, .18); color: #9cc0ff; border: 1px solid rgba(79,140,255,.45); }
.badge.resume { background: rgba(255, 138, 61, .16); color: #ffbe94; border: 1px solid rgba(255,138,61,.45); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 8px currentColor; vertical-align: middle; }
.count { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: rgba(191, 168, 255, .12); border: 1px solid rgba(191,168,255,.3); }
kbd { font: 11.5px var(--font); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: rgba(255,255,255,.06); margin-right: 3px; }

/* ---------- 상단 바 ---------- */
.topbar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 8px 12px;
}
.logo { background: none; border: 0; cursor: pointer; font-size: 19px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; padding: 4px; flex: none; }
.logo b { color: var(--accent); }
.logo-mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--job), var(--resume)); transform: rotate(45deg) scale(.8); box-shadow: 0 0 14px rgba(191,168,255,.6); }
.filters { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.filters input, .filters select, .field input, .field select, .field textarea {
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
.filters select option, .field select option { background: var(--panel-solid); }
#search { flex: 1; max-width: 320px; }
.user-area { display: flex; align-items: center; gap: 8px; flex: none; }
.me { display: flex; align-items: center; gap: 6px; text-decoration: none; padding: 6px 10px; border-radius: 10px; }
.me:hover { background: rgba(255,255,255,.08); }

/* ---------- HUD ---------- */
.help { position: fixed; left: 12px; bottom: 12px; z-index: 10; padding: 10px 14px; width: 220px; font-size: 13px; }
.help ul { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 4px; }
.help.collapsed ul, .help.collapsed .legend, .help.collapsed .link { display: none; }
.help.collapsed .help-toggle span { transform: rotate(-90deg); }
.help-toggle { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; width: 100%; text-align: left; display: flex; justify-content: space-between; }
.help-toggle span { transition: transform .2s; display: inline-block; }
.legend { display: grid; gap: 4px; margin-bottom: 8px; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.sw.job { background: var(--job); } .sw.resume { background: var(--resume); border-radius: 50%; }
.minimap { position: fixed; right: 12px; bottom: 12px; z-index: 10; padding: 6px; }
.minimap canvas { display: block; width: 160px; height: 160px; cursor: crosshair; }

/* ---------- 툴팁 ---------- */
.tip { position: fixed; z-index: 15; max-width: 280px; padding: 10px 12px; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; display: grid; gap: 3px; font-size: 13.5px; }
.tip.show { opacity: 1; transform: none; }
.tip strong { font-size: 15px; line-height: 1.35; }
.tip-foot { font-size: 12px; color: var(--accent); margin-top: 2px; }

/* ---------- 상세 패널 ---------- */
.panel {
  position: fixed; top: 80px; right: 12px; bottom: 12px; width: 440px; z-index: 30;
  display: flex; flex-direction: column; transform: translateX(110%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.panel.open { transform: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 0; }
.panel-body { overflow-y: auto; padding: 8px 18px 18px; flex: 1; }
.panel h2 { margin: 6px 0 6px; font-size: 22px; line-height: 1.3; }
.byline { margin-bottom: 12px; font-size: 14px; }
.user-link { text-decoration: none; font-weight: 600; }
.user-link:hover { text-decoration: underline; }
h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 4px; }
.facts div { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; word-break: break-word; }
.facts a { color: var(--accent); }
.row-actions { display: flex; gap: 8px; margin: 14px 0 0; }

.comments { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.comments h3 { margin: 0 0 10px; font-size: 17px; }
.c-list, .c-replies { list-style: none; margin: 0; padding: 0; }
.c-list > li { margin-bottom: 10px; }
.c-replies { margin: 6px 0 0 18px; padding-left: 12px; border-left: 2px solid var(--line); display: grid; gap: 6px; }
.comment { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.c-head { font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 3px; }
.c-head .muted { font-size: 12px; }
.c-actions { display: flex; gap: 12px; font-size: 12.5px; }
.c-form { display: grid; gap: 8px; margin-top: 10px; }
.c-form textarea { width: 100%; resize: vertical; background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.c-form .btn { justify-self: end; }
.login-hint { margin-top: 10px; padding: 12px; border-radius: 10px; background: rgba(191,168,255,.08); text-align: center; }
.empty { margin: 4px 0 10px; }

/* ---------- 프로필 ---------- */
.profile {
  position: fixed; inset: 0; z-index: 25; overflow-y: auto; padding: 84px 16px 40px;
  background: radial-gradient(circle at 20% 0%, rgba(91,124,255,.22), transparent 50%), radial-gradient(circle at 90% 30%, rgba(255,138,61,.14), transparent 45%), rgba(6,10,22,.94);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.profile.open { opacity: 1; pointer-events: auto; }
.profile-inner { max-width: 920px; margin: 0 auto; display: grid; gap: 16px; position: relative; }
.profile .close { position: absolute; top: -46px; right: 0; }
.p-hero { display: flex; align-items: center; gap: 24px; padding: 20px 24px; }
.p-hero canvas { width: 180px; height: 180px; flex: none; }
.p-id h1 { margin: 6px 0 2px; font-size: 32px; letter-spacing: -.01em; }
.headline { margin: 0 0 12px; font-size: 16px; }
.p-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.card { padding: 16px 18px; }
.card h3 { margin: 0 0 10px; font-size: 17px; }
.p-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.p-posts a { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; background: rgba(255,255,255,.03); }
.p-posts a:hover { background: rgba(255,255,255,.08); }
.p-posts .muted { font-size: 13px; }

/* ---------- 목록 보기 ---------- */
.list { position: fixed; inset: 0; z-index: 5; overflow-y: auto; padding: 84px 16px 40px; background: rgba(6,10,22,.9); display: none; }
.list.open { display: block; }
.list-inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 24px; }
.zone-title { margin: 0 0 10px; font-size: 19px; }
.zone-title.job { color: #9cc0ff; } .zone-title.resume { color: #ffbe94; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.post-card { display: grid; gap: 6px; padding: 14px 16px; text-decoration: none; border-top: 3px solid var(--job); transition: transform .15s; }
.post-card.resume { border-top-color: var(--resume); }
.post-card:hover { transform: translateY(-3px); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips span { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.07); }
body.no3d #hud { display: none; }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(2, 4, 12, .6); }
.modal.open { display: flex; }
.modal-card { position: relative; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px 24px; background: rgba(14,20,42,.94); animation: pop .22s ease-out; }
.modal-card h2 { margin: 0 0 6px; font-size: 21px; }
.modal-card .close { position: absolute; top: 14px; right: 14px; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.form { display: grid; gap: 12px; margin-top: 14px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.wide { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; font-size: 13.5px; min-width: 0; }
.field span { color: var(--muted); }
.field textarea { resize: vertical; }
.field input[type=color] { height: 40px; padding: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.acct-list { display: grid; gap: 6px; }
.acct { display: flex; align-items: center; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; }
.acct:hover { background: rgba(255,255,255,.1); }
.radio-row { display: grid; gap: 6px; font-size: 14px; }
.form h4 { margin: 8px 0 0; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- 토스트 ---------- */
.toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; font-size: 14px; transition: opacity .3s, transform .3s; animation: pop .25s ease-out; }
.toast.out { opacity: 0; transform: translateY(-6px); }

/* ---------- 반응형 ---------- */
@media (max-width: 1100px) {
  .filters select#f-emp, .filters select#f-loc { display: none; }
}
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; top: 8px; left: 8px; right: 8px; gap: 8px; }
  .filters { order: 3; flex-basis: 100%; }
  .filters select#f-zone { display: none; }
  #search { max-width: none; }
  .user-area .btn.ghost, .me span:not(.dot):not(.badge) { display: none; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 72vh; transform: translateY(110%); }
  .panel.open { transform: none; }
  .help { width: auto; max-width: calc(100% - 200px); }
  .help:not(.collapsed) { max-height: 50vh; overflow-y: auto; }
  .minimap canvas { width: 110px; height: 110px; }
  .profile, .list { padding-top: 120px; }
  .p-hero { flex-direction: column; text-align: center; }
  .p-grid, .grid2, .login-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .toasts { top: 120px; width: calc(100% - 32px); }
}
