:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.09);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --accent: #7c5cff;
  --accent2: #19d3ff;
  --border: rgba(255,255,255,.10);
  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 18px;
}

[data-theme="light"]{
  --bg: #f6f7fb;
  --panel: rgba(0,0,0,.04);
  --panel2: rgba(0,0,0,.06);
  --text: rgba(0,0,0,.88);
  --muted: rgba(0,0,0,.56);
  --accent: #5b4bff;
  --accent2: #008cff;
  --border: rgba(0,0,0,.08);
  --shadow: 0 18px 60px rgba(5,10,30,.18);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.bg{
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 18% 12%, rgba(124,92,255,.30), transparent 58%),
    radial-gradient(900px 520px at 85% 22%, rgba(25,211,255,.22), transparent 58%),
    radial-gradient(900px 520px at 50% 92%, rgba(124,92,255,.16), transparent 58%);
  opacity: .95;
}

.container{ width: min(1280px, calc(100% - 48px)); margin: 0 auto; }

.top{
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.top .container{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.brand{ display:flex; align-items:center; gap:12px; text-decoration:none; color: var(--text); }
.logo{
  width: 34px; height: 34px;
  border-radius: 11px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: var(--shadow);
  font-weight: 800;
}
.brand-text{ font-weight: 820; letter-spacing: .2px; }
.brand-sub{ color: var(--muted); font-size: 13px; margin-left: 4px; }

.search{ flex: 1; display:flex; gap: 10px; max-width: 680px; }
.search input{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}
.search input::placeholder{ color: color-mix(in srgb, var(--muted) 85%, transparent); }

.right{ display:flex; gap: 10px; align-items:center; }

.btn{
  border: 1px solid var(--border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 36%, var(--panel)), var(--panel));
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  box-shadow: var(--shadow);
}
.btn:hover{ filter: brightness(1.05); }
.btn.ghost{ background: var(--panel); box-shadow: none; }

.pill{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
}
.pill:hover{ background: var(--panel2); }

.panel{
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.divider{ height:1px; background: var(--border); margin: 14px 0; }
.muted{ color: var(--muted); }
.tiny{ font-size: 12.5px; }

/* keyword link (밑줄 얇게 + 폰트 다르게) */
.kw{
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: rgba(255,95,95,.95);
  font-weight: 800;
  cursor: pointer;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,95,95,.85);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.kw.kw-inline{
  font-size: 12.8px;
}
.kw:hover{ filter: brightness(1.08); }
.kw:active{ transform: translateY(1px); }
.kw:focus-visible{ outline: 2px solid rgba(255,80,80,.55); outline-offset: 2px; border-radius: 6px; }

[data-theme="light"] .kw{
  color: rgba(220,40,40,.95);
  text-decoration-color: rgba(220,40,40,.75);
}

.tiny strong{ color: var(--text); }

.h3{ margin: 0 0 10px; font-size: 14px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* ===== Board (메인 화면) ===== */
.board{ padding: 16px; }
.board-head{
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}
.board-left{ min-width: 0; }
#catDesc{ max-width: 260px; word-break: keep-all; }
.board-title{ margin: 0; font-size: 20px; }
.board-actions{ min-width: 0; display:flex; align-items: stretch; }

/* 빨간박스 위치 안내 문구 */
.hint{
  width: 100%;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, rgba(255,85,85,.55) 55%, var(--border));
  background: rgba(255,85,85,.08);
  padding: 16px 16px;
  margin: 0;
  color: color-mix(in srgb, rgba(255,120,120,.95) 70%, var(--text));
  font-weight: 900;
  font-size: 17px;
  line-height: 1.55;
  display:flex;
  align-items:center;
}
.hint strong{ color: rgba(255,120,120,.98); font-weight: 900; padding: 0 4px; }
[data-theme="light"] .hint{
  background: rgba(220,40,40,.07);
  border-color: rgba(220,40,40,.22);
  color: rgba(160,20,20,.92);
}
[data-theme="light"] .hint strong{ color: rgba(200,30,30,.95); }

.board-grid{
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: color-mix(in srgb, var(--panel2) 45%, transparent);
}

.board-row{
  display:grid;
  grid-template-columns: repeat(var(--cols), 1fr);
}

.board-cell{
  min-height: 64px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 10px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.board-row .board-cell:last-child{ border-right: none; }

.board-headcell{
  cursor: pointer;
  background: color-mix(in srgb, var(--panel2) 70%, transparent);
  font-weight: 800;
  display:flex;
  align-items:center;
  justify-content:center;
}
.board-headcell.active{
  outline: 2px solid color-mix(in srgb, var(--accent2) 55%, transparent);
  outline-offset: -2px;
}

.board-item{
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 62%, transparent);
  padding: 9px 10px;
  cursor: pointer;
  margin-bottom: 8px;
}
.board-item:hover{ filter: brightness(1.03); }
.board-item .t{ font-weight: 780; }
.board-item .s{ color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.board-fill{ color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* ===== Drawer (오른쪽 내용 패널) ===== */
.drawer{
  position: fixed;
  inset: 0;
  display:none;
  justify-content: flex-end;
  background: rgba(0,0,0,.50);
  z-index: 40;
}
.drawer.show{ display:flex; }
.drawer-card{
  width: min(640px, 94vw);
  height: 100%;
  overflow: auto;
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, black);
  padding: 16px;
  font-size: 15.5px;
  line-height: 1.75;
}
.drawer-head{ display:flex; align-items:flex-start; justify-content: space-between; gap: 10px; }
.drawer-head h2{ margin: 0; font-size: 20px; line-height: 1.25; }
.actions{ display:flex; gap: 10px; align-items:center; flex-wrap: wrap; justify-content:flex-end; }

.drawer-search{
  display:flex;
  gap: 10px;
  margin-top: 10px;
}
.drawer-search input{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}
.drawer-search input::placeholder{ color: color-mix(in srgb, var(--muted) 85%, transparent); }

.content{
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel2) 55%, transparent);
  border: 1px solid var(--border);
}

.content p{ margin: 0 0 12px; }
.content p:last-child{ margin-bottom: 0; }
.content ul{ margin: 10px 0 0; }

.summary{
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  padding: 12px;
  margin-bottom: 12px;
}
.summary-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.sum{ margin: 0; padding-left: 18px; color: var(--text); }
.sum li{ margin: 6px 0; }

.full{ color: var(--text); font-size: 15.5px; line-height: 1.85; letter-spacing: .01em; }
.full.collapsed{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
}

.section-head{ display:flex; align-items:center; justify-content: space-between; gap: 10px; margin-top: 10px; }

.related{ display:flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.rel{
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  padding: 9px 11px;
  cursor: pointer;
  font-size: 13px;
}
.rel:hover{ filter: brightness(1.04); }

.x{ border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 12px; padding: 6px 10px; cursor:pointer; }

/* ===== Net panel ===== */
.net{ margin: 0 auto 22px; }
.net.hidden{ display:none; }
.net .container{ padding: 16px 0 0; }
.panel-head h2{ margin: 0; font-size: 18px; }
.panel-head p{ margin: 6px 0 0; }
.net-area{
  height: 360px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel2) 55%, transparent);
  overflow: hidden;
  margin-top: 10px;
}

/* ===== Toast ===== */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--bg) 70%, black);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 70;
}
.toast.show{ opacity: 1; transform: translateX(-50%) translateY(-2px); }

/* ===== modal ===== */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 22px;
  z-index: 60;
}
.modal.show{ display:flex; }
.modal-card{
  width: min(760px, 100%);
  border-radius: 22px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, black);
  box-shadow: var(--shadow);
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-body{ padding: 14px 16px; }
.modal-foot{ padding: 14px 16px; border-top: 1px solid var(--border); display:flex; justify-content:flex-end; }
.code{ margin-top: 8px; }
.code code{
  display:block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: pre-wrap;
}

.attrib{ margin-top: 10px; }
.attrib-title{ font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.attrib-body{ border-radius: 16px; border: 1px solid var(--border); background: color-mix(in srgb, var(--panel) 70%, transparent); padding: 12px; }
.attrib-list{ margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.attrib-list a{ color: color-mix(in srgb, var(--accent2) 60%, var(--text)); text-decoration: none; }
.attrib-list a:hover{ text-decoration: underline; }

.site-footer{ padding: 16px 0 28px; }
.site-footer a{ color: color-mix(in srgb, var(--accent2) 60%, var(--text)); text-decoration: none; }
.site-footer a:hover{ text-decoration: underline; }

@media (max-width: 980px){
  .search{ display:none; }
  .board-head{ flex-direction: column; align-items:flex-start; }
  .board-actions{ width: 100%; justify-content:flex-start; }
  .hint{ width: 100%; }
}
