/* IPO Nexus 사이트 디자인 15종 — 원본 화면 코드는 그대로 두고 덧입히는 스타일
 * html[data-ipo-theme="<id>"] 로 고름 (theme.js 가 서버에 저장된 디자인을 읽어 붙임)
 * 각 디자인은 원본 색 변수(--bg --card --border --tp --ts --hint --hover --alt --accent --yellow)와
 * 추가 변수(--ipo-*)만 바꾸고, 몇몇 디자인은 머리글·탭·카드 모양을 따로 꾸밈.
 * 관리자 화면의 작은 미리보기(.ipo-pv[data-ipo-theme])도 같은 변수를 씀.
 */

/* ---------- 공통 (기본 디자인이 아닐 때만) ---------- */
html.ipo-themed body{background:var(--bg);font-family:var(--ipo-body)}
html.ipo-themed #root{font-family:var(--ipo-body)}
html.ipo-themed h1,html.ipo-themed h2,html.ipo-themed h3{font-family:var(--ipo-head);letter-spacing:var(--ipo-head-ls,-.01em)}
html.ipo-themed table td{font-variant-numeric:tabular-nums}
/* 숫자 글꼴은 조금 작게·촘촘하게 — 고정폭 글꼴 때문에 표가 넓어져 맨 오른쪽 '수요예측 링크' 칸이 화면 밖으로 밀리지 않게 */
html.ipo-themed table td:not(:first-child){font-family:var(--ipo-num);font-size:12px;letter-spacing:-.03em}

/* 긴 종목명(스팩 등)은 칸 안에서 다음 줄로 — 띄어쓰기 없는 이름도 글자 단위로 줄바꿈해 옆 칸(상장일)을 가리지 않게,
 * 표도 화면 안에 들어와 맨 오른쪽 '수요예측 링크' 칸까지 보이게 (모든 디자인) */
main table td:first-child{white-space:normal!important;word-break:break-all!important;overflow-wrap:anywhere;min-width:10em;max-width:11em}
main table td:first-child>*{white-space:normal!important;word-break:break-all!important;overflow-wrap:anywhere}

/* 증권사 로고 (logos.js 가 증권사 링크에 data-ipo-logo 를 붙임) — 모든 디자인 공통 */
a[data-ipo-logo]{display:inline-block;width:22px;height:22px;font-size:0!important;line-height:0;color:transparent!important;text-decoration:none!important;vertical-align:middle;
  background:#fff var(--logo) center/16px 16px no-repeat;border-radius:6px;box-shadow:0 0 0 1px rgba(0,0,0,.08);transition:transform .12s}
a[data-ipo-logo]:hover{transform:scale(1.15)}
a[data-ipo-logo]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
html.ipo-themed [class*="text-red-"]{color:var(--ipo-up)!important}
html.ipo-themed [class*="text-blue-"]{color:var(--ipo-down)!important}
html.ipo-themed .bg-\[var\(--accent\)\]{color:var(--ipo-on-accent)!important}
html.ipo-themed button[title="다크 모드"]{display:none!important}
html.ipo-themed header span[class*="bg-teal-50"]{background:var(--yellow)!important;border-color:var(--border)!important;color:var(--ts)!important}
html.ipo-themed .rounded-2xl{border-radius:var(--ipo-r2,16px)!important}
html.ipo-themed .rounded-xl{border-radius:var(--ipo-r1,12px)!important}
html.ipo-themed .rounded-lg{border-radius:var(--ipo-r0,8px)!important}
html.ipo-themed .shadow-sm{box-shadow:var(--ipo-shadow,0 1px 2px rgba(0,0,0,.05))!important}
html.ipo-themed ::selection{background:var(--accent);color:var(--ipo-on-accent)}

/* ---------- 01 기본 (원본 그대로) — 미리보기 칸에서만 쓰는 값 ---------- */
.ipo-pv[data-ipo-theme="default"]{--bg:#f2f4f6;--card:#fff;--border:#e5e8eb;--tp:#191f28;--ts:#6b7684;--hint:#adb5bd;--hover:#eff4ff;--alt:#f6f8fa;--accent:#3182f6;--yellow:#eff4ff;--ipo-on-accent:#fff;--ipo-up:#e5484d;--ipo-down:#3182f6;--ipo-head:"Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Noto Sans KR",sans-serif}

/* ---------- 02 나이트 데스크 ---------- */
[data-ipo-theme="night"]{
  --bg:#0a0f1c;--card:#101a2d;--border:#1e2a44;--tp:#e6ecf7;--ts:#8391ad;--hint:#56627d;--hover:#14213a;--alt:#0d1526;--accent:#f5a524;--yellow:#1d2840;
  --ipo-on-accent:#1a1204;--ipo-up:#ff5d63;--ipo-down:#4f8fff;
  --ipo-head:"Space Grotesk","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"JetBrains Mono","Noto Sans KR",monospace;
  --ipo-r2:10px;--ipo-r1:8px;--ipo-r0:6px;--ipo-shadow:0 0 0 1px rgba(255,255,255,.02);
}
html[data-ipo-theme="night"] header .bg-\[var\(--accent\)\]:first-child{box-shadow:0 0 22px -4px rgba(245,165,36,.75)}
html[data-ipo-theme="night"] thead th,html[data-ipo-theme="night"] th{text-transform:uppercase;letter-spacing:.04em}
html[data-ipo-theme="night"] main .rounded-2xl{background:linear-gradient(180deg,#111c31,#0e172a)}
#ipo-ticker{display:flex;overflow:hidden;border-bottom:1px solid #1e2a44;background:#070b15;color:#e6ecf7;font:12px/1 "JetBrains Mono","Noto Sans KR",monospace;position:relative;z-index:41}
#ipo-ticker div{display:flex;gap:28px;padding:8px 0;white-space:nowrap;animation:ipo-tick 60s linear infinite}
#ipo-ticker b{color:#8391ad;font-weight:500;margin-right:6px}
#ipo-ticker .u{color:#ff5d63} #ipo-ticker .d{color:#4f8fff}
@keyframes ipo-tick{from{transform:translateX(0)}to{transform:translateX(-50%)}}
@media (prefers-reduced-motion:reduce){#ipo-ticker div{animation:none}}
@media print{#ipo-ticker{display:none}}

/* ---------- 03 청자 ---------- */
[data-ipo-theme="celadon"]{
  --bg:#e7efeb;--card:#f8fbf9;--border:#cbdad3;--tp:#16302c;--ts:#5c7570;--hint:#93aaa4;--hover:#eef5f1;--alt:#eef4f1;--accent:#2c7a69;--yellow:#d4e8e0;
  --ipo-on-accent:#f3fbf8;--ipo-up:#c1432f;--ipo-down:#2b5ea6;
  --ipo-head:"Gowun Dodum","Noto Sans KR",sans-serif;--ipo-body:"IBM Plex Sans KR","Noto Sans KR",sans-serif;--ipo-num:"IBM Plex Mono","IBM Plex Sans KR",monospace;
  --ipo-r2:18px;--ipo-r1:14px;--ipo-r0:10px;--ipo-shadow:0 1px 0 #fff inset,0 10px 24px -18px rgba(22,48,44,.45);
}
html[data-ipo-theme="celadon"] header nav{background:var(--yellow);border-radius:999px;padding:4px;width:max-content;max-width:calc(100% - 32px);margin-bottom:10px}
html[data-ipo-theme="celadon"] header nav button{border:0!important;border-radius:999px;padding:7px 14px}
html[data-ipo-theme="celadon"] header nav button[class*="border-[var(--accent)]"]{background:var(--card);box-shadow:0 2px 6px -2px rgba(22,48,44,.3)}

/* ---------- 04 바우하우스 ---------- */
[data-ipo-theme="bauhaus"]{
  --bg:#fbfaf7;--card:#fff;--border:#111;--tp:#111;--ts:#4d4d4d;--hint:#8a8a8a;--hover:#fff8dc;--alt:#f4f4f4;--accent:#111;--yellow:#ffd23f;
  --ipo-on-accent:#ffd23f;--ipo-up:#e23b2e;--ipo-down:#1f4fd8;
  --ipo-head:"Black Han Sans","Noto Sans KR",sans-serif;--ipo-body:"Gothic A1","Noto Sans KR",sans-serif;--ipo-num:"Space Grotesk","Gothic A1",sans-serif;
  --ipo-r2:0;--ipo-r1:0;--ipo-r0:0;--ipo-shadow:3px 3px 0 #111;--ipo-head-ls:0;
}
html[data-ipo-theme="bauhaus"] main .rounded-2xl,html[data-ipo-theme="bauhaus"] main .border.rounded-xl{border-width:2px!important;box-shadow:5px 5px 0 #111!important}
html[data-ipo-theme="bauhaus"] header{border-bottom:3px solid #111!important;background:#fff!important}
html[data-ipo-theme="bauhaus"] header h1{font-weight:400}
html[data-ipo-theme="bauhaus"] header nav{gap:8px;padding-bottom:12px}
html[data-ipo-theme="bauhaus"] header nav button{border:2px solid #111!important;color:#111!important;background:#fff}
html[data-ipo-theme="bauhaus"] header nav button[class*="border-[var(--accent)]"]{background:#ffd23f;box-shadow:3px 3px 0 #111}
html[data-ipo-theme="bauhaus"] thead th,html[data-ipo-theme="bauhaus"] th{background:#111!important;color:#fff!important}
html[data-ipo-theme="bauhaus"] header .bg-\[var\(--accent\)\]:first-child{background:#e23b2e!important;color:#fff!important}

/* ---------- 05 오로라 글래스 ---------- */
[data-ipo-theme="aurora"]{
  --bg:rgba(255,255,255,.45);--card:rgba(255,255,255,.6);--border:rgba(255,255,255,.9);--tp:#1b2233;--ts:#586379;--hint:#8c95a8;--hover:rgba(255,255,255,.7);--alt:rgba(255,255,255,.35);--accent:#f0643c;--yellow:rgba(240,100,60,.12);
  --ipo-on-accent:#fff;--ipo-up:#e5484d;--ipo-down:#3e63dd;
  --ipo-head:"Gothic A1","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Space Grotesk","Noto Sans KR",sans-serif;
  --ipo-r2:24px;--ipo-r1:18px;--ipo-r0:12px;--ipo-shadow:0 18px 36px -24px rgba(40,50,90,.45);--ipo-head-ls:-.02em;
}
html[data-ipo-theme="aurora"] body{background:radial-gradient(60% 50% at 8% 0%,#ffd9c7 0%,transparent 60%),radial-gradient(50% 45% at 92% 8%,#c9defe 0%,transparent 60%),radial-gradient(55% 50% at 70% 100%,#c9f1e0 0%,transparent 60%),radial-gradient(40% 40% at 0% 100%,#f6d1ff 0%,transparent 60%),#f2f5fb fixed}
html[data-ipo-theme="aurora"] main .rounded-2xl,html[data-ipo-theme="aurora"] header{backdrop-filter:blur(18px) saturate(1.4);-webkit-backdrop-filter:blur(18px) saturate(1.4)}
html[data-ipo-theme="aurora"] header .bg-\[var\(--accent\)\]{background:linear-gradient(135deg,#ff8a5c,#f0643c 45%,#d6407a)!important}
html[data-ipo-theme="aurora"] header nav button{border:0!important;border-radius:999px;margin-bottom:8px}
html[data-ipo-theme="aurora"] header nav button[class*="border-[var(--accent)]"]{background:rgba(255,255,255,.75);box-shadow:0 6px 16px -10px rgba(40,50,90,.5)}

/* ---------- 06 프라이빗 뱅크 ---------- */
[data-ipo-theme="bank"]{
  --bg:#f2f3f7;--card:#fff;--border:#dfe3ec;--tp:#15213a;--ts:#66708a;--hint:#a0a8bb;--hover:#f8f6f1;--alt:#f7f8fb;--accent:#a8844a;--yellow:#f3ece0;
  --ipo-on-accent:#fff;--ipo-up:#b3232d;--ipo-down:#1f4e9f;
  --ipo-head:"Nanum Myeongjo","Noto Serif KR",serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Noto Sans KR",sans-serif;
  --ipo-r2:6px;--ipo-r1:6px;--ipo-r0:4px;--ipo-shadow:0 1px 2px rgba(21,33,58,.06),0 8px 24px -18px rgba(21,33,58,.35);--ipo-head-ls:-.02em;
}
html[data-ipo-theme="bank"] header{--card:#15213a;--tp:#ffffff;--ts:#b9c1d3;--hint:#7f8aa6;--border:#2c3a5c;--bg:#1d2b4a;--accent:#c9a96b;background:#15213a!important;border-bottom:3px solid #a8844a!important}
html[data-ipo-theme="bank"] header h1{font-weight:800}

/* ---------- 07 그래파이트 ---------- */
[data-ipo-theme="graphite"]{
  --bg:#141518;--card:#1c1d21;--border:#2b2d33;--tp:#ececef;--ts:#9b9ea8;--hint:#5f626b;--hover:#23252b;--alt:#18191c;--accent:#7aa2ff;--yellow:#232a3d;
  --ipo-on-accent:#0d1530;--ipo-up:#ff6369;--ipo-down:#6e9bff;
  --ipo-head:"Space Grotesk","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"IBM Plex Mono","Noto Sans KR",monospace;
  --ipo-r2:12px;--ipo-r1:10px;--ipo-r0:7px;
}

/* ---------- 08 포레스트 ---------- */
[data-ipo-theme="forest"]{
  --bg:#0e1814;--card:#14211b;--border:#22352b;--tp:#e4eee8;--ts:#8ea79a;--hint:#567064;--hover:#1a2b23;--alt:#111c17;--accent:#e0b15c;--yellow:#2a2716;
  --ipo-on-accent:#1d1505;--ipo-up:#ff6b5e;--ipo-down:#62a3ff;
  --ipo-head:"Gowun Dodum","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"IBM Plex Mono","Noto Sans KR",monospace;
  --ipo-r2:16px;--ipo-r1:12px;--ipo-r0:8px;
}

/* ---------- 09 딥 오션 ---------- */
[data-ipo-theme="ocean"]{
  --bg:#06161f;--card:#0b2230;--border:#16384a;--tp:#e2f1f6;--ts:#86a9b8;--hint:#4f7384;--hover:#0f2b3c;--alt:#081c27;--accent:#2dd4bf;--yellow:#0f3338;
  --ipo-on-accent:#03201c;--ipo-up:#ff6b78;--ipo-down:#5aa5ff;
  --ipo-head:"Gothic A1","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"JetBrains Mono","Noto Sans KR",monospace;
  --ipo-r2:14px;--ipo-r1:10px;--ipo-r0:8px;
}
html[data-ipo-theme="ocean"] body{background:radial-gradient(80% 60% at 50% -10%,#0d3446 0%,transparent 70%),#06161f fixed}

/* ---------- 10 플럼 벨벳 ---------- */
[data-ipo-theme="plum"]{
  --bg:#170e1b;--card:#211426;--border:#382342;--tp:#f3e9f5;--ts:#ab95b2;--hint:#6e5876;--hover:#2a1a31;--alt:#1b1120;--accent:#f0a6ca;--yellow:#3a1f34;
  --ipo-on-accent:#2a0f1f;--ipo-up:#ff6f7d;--ipo-down:#7ea6ff;
  --ipo-head:"Nanum Myeongjo","Noto Serif KR",serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Space Grotesk","Noto Sans KR",sans-serif;
  --ipo-r2:14px;--ipo-r1:10px;--ipo-r0:8px;
}

/* ---------- 11 노르딕 프로스트 ---------- */
[data-ipo-theme="nord"]{
  --bg:#eceff4;--card:#f8f9fb;--border:#d8dee9;--tp:#2e3440;--ts:#5c6677;--hint:#9aa3b2;--hover:#e5e9f0;--alt:#f0f2f6;--accent:#5e81ac;--yellow:#e1e8f2;
  --ipo-on-accent:#fff;--ipo-up:#bf4a52;--ipo-down:#4a6fa5;
  --ipo-head:"IBM Plex Sans KR","Noto Sans KR",sans-serif;--ipo-body:"IBM Plex Sans KR","Noto Sans KR",sans-serif;--ipo-num:"IBM Plex Mono",monospace;
  --ipo-r2:10px;--ipo-r1:8px;--ipo-r0:6px;--ipo-shadow:0 1px 2px rgba(46,52,64,.06);
}

/* ---------- 12 벚꽃 ---------- */
[data-ipo-theme="sakura"]{
  --bg:#fdf3f5;--card:#fff;--border:#f3d9e0;--tp:#3a2230;--ts:#8a6676;--hint:#c4a2b0;--hover:#fdebef;--alt:#fff7f9;--accent:#d6457a;--yellow:#fbe3ea;
  --ipo-on-accent:#fff;--ipo-up:#d63a4a;--ipo-down:#3a63c9;
  --ipo-head:"Gowun Dodum","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Space Grotesk","Noto Sans KR",sans-serif;
  --ipo-r2:22px;--ipo-r1:16px;--ipo-r0:12px;--ipo-shadow:0 10px 24px -18px rgba(214,69,122,.45);
}

/* ---------- 13 시트러스 ---------- */
[data-ipo-theme="citrus"]{
  --bg:#fffbeb;--card:#fff;--border:#f3e3b5;--tp:#2b2410;--ts:#7a6a3d;--hint:#bba86f;--hover:#fff4cc;--alt:#fffdf3;--accent:#ea7c0c;--yellow:#fff0c2;
  --ipo-on-accent:#fff;--ipo-up:#e0372c;--ipo-down:#2a5bd7;
  --ipo-head:"Gothic A1","Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Space Grotesk","Noto Sans KR",sans-serif;
  --ipo-r2:16px;--ipo-r1:12px;--ipo-r0:10px;--ipo-head-ls:-.02em;
}
html[data-ipo-theme="citrus"] header h1{font-weight:800}

/* ---------- 14 모노 페이퍼 ---------- */
[data-ipo-theme="mono"]{
  --bg:#ffffff;--card:#ffffff;--border:#e6e6e6;--tp:#0d0d0d;--ts:#666;--hint:#a3a3a3;--hover:#f5f5f5;--alt:#fafafa;--accent:#0d0d0d;--yellow:#f2f2f2;
  --ipo-on-accent:#fff;--ipo-up:#e0262f;--ipo-down:#1d4ed8;
  --ipo-head:"Noto Sans KR",sans-serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"IBM Plex Mono",monospace;
  --ipo-r2:2px;--ipo-r1:2px;--ipo-r0:2px;--ipo-shadow:none;--ipo-head-ls:-.04em;
}
html[data-ipo-theme="mono"] header h1{font-weight:900}
html[data-ipo-theme="mono"] main .rounded-2xl{box-shadow:none!important}

/* ---------- 15 수묵 ---------- */
[data-ipo-theme="ink"]{
  --bg:#f1f1ef;--card:#fbfbfa;--border:#d9d9d4;--tp:#1d1d1b;--ts:#62625c;--hint:#a3a39b;--hover:#ececE8;--alt:#f6f6f4;--accent:#b8322a;--yellow:#efe3e1;
  --ipo-on-accent:#fff;--ipo-up:#b8322a;--ipo-down:#2c4f8a;
  --ipo-head:"Nanum Myeongjo","Noto Serif KR",serif;--ipo-body:"Noto Sans KR",sans-serif;--ipo-num:"Noto Sans KR",sans-serif;
  --ipo-r2:4px;--ipo-r1:4px;--ipo-r0:3px;--ipo-head-ls:-.02em;
}
html[data-ipo-theme="ink"] header .bg-\[var\(--accent\)\]:first-child{border-radius:3px!important;transform:rotate(-4deg)}

/* ---------- 관리자 화면: 디자인 고르기 미리보기 칸 ---------- */
.ipo-pv{background:var(--bg);color:var(--tp);border:1px solid var(--border);border-radius:10px;overflow:hidden;font-family:var(--ipo-body);font-size:11px;line-height:1.3}
.ipo-pv .pv-h{display:flex;align-items:center;gap:6px;padding:7px 8px;background:var(--card);border-bottom:1px solid var(--border)}
.ipo-pv .pv-h i{width:14px;height:14px;border-radius:4px;background:var(--accent);flex:none}
.ipo-pv .pv-h b{font-family:var(--ipo-head);font-size:12px}
.ipo-pv .pv-n{display:flex;gap:8px;padding:5px 8px 0;color:var(--ts)}
.ipo-pv .pv-n span:first-child{color:var(--accent);font-weight:700;border-bottom:2px solid var(--accent)}
.ipo-pv .pv-b{margin:6px 8px 8px;background:var(--card);border:1px solid var(--border);border-radius:6px}
.ipo-pv .pv-r{display:flex;justify-content:space-between;padding:4px 7px;border-bottom:1px solid var(--border);font-family:var(--ipo-num)}
.ipo-pv .pv-r:last-child{border-bottom:0}
.ipo-pv .u{color:var(--ipo-up)} .ipo-pv .d{color:var(--ipo-down)}
