:root {
  --bg: #090b10;
  --bg-card: #121620;
  --bg-elev: #181e2c;
  --line: #252e42;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #facc15;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
  --accent-blue: #38bdf8;
  --kakao: #fee500;
  --kakao-ink: #191919;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Malgun Gothic", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(9, 11, 16, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 16px 24px 0;
}
.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
}
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}
.brand-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.section-head {
  margin-bottom: 24px;
}
.section-head h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.section-head p {
  color: var(--muted);
  font-size: 15px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
.kpi-card.danger { border-color: rgba(239, 68, 68, 0.5); background: linear-gradient(180deg, rgba(239,68,68,0.09), var(--bg-card)); }
.kpi-card.win { border-color: rgba(34, 197, 94, 0.5); background: linear-gradient(180deg, rgba(34,197,94,0.09), var(--bg-card)); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.kpi-val { font-size: 30px; font-weight: 900; letter-spacing: -0.03em; }
.kpi-card.danger .kpi-val { color: #f87171; }
.kpi-card.win .kpi-val { color: #4ade80; }
.kpi-desc { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 28px;
}
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
}

.panel-box {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}
.panel-box h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bar chart */
.bar-row { margin-bottom: 14px; }
.bar-meta { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.bar-track { height: 13px; background: #1e2638; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }

/* Before vs After Visual Compare */
.vs-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 960px) { .vs-wrap { grid-template-columns: 1fr; } }
.vs-card {
  border-radius: 18px;
  padding: 22px;
  background: var(--bg-card);
  border: 2px solid var(--line);
}
.vs-card.bad { border-color: rgba(239, 68, 68, 0.55); }
.vs-card.good { border-color: rgba(250, 204, 21, 0.65); }
.vs-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
}
.vs-card.bad .vs-tag { background: rgba(239,68,68,0.18); color: #fca5a5; }
.vs-card.good .vs-tag { background: rgba(250,204,21,0.18); color: #fde047; }
.vs-img {
  width: 100%;
  max-width: 380px;
  display: block;
  margin: 14px auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.reason-list { list-style: none; margin-top: 12px; }
.reason-list li {
  font-size: 13.5px;
  padding: 7px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  color: #cbd5e1;
}

/* Filter chips */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.chip {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: #cbd5e1;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  color: #0f172a;
  border-color: var(--accent);
}

/* Threads Authentic Feed Cards Grid */
.samples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 24px;
}
@media (max-width: 520px) { .samples-grid { grid-template-columns: 1fr; } }

.th-card {
  background: #101010;
  border: 1px solid #262626;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.th-strategy-bar {
  background: #181e2c;
  padding: 11px 18px;
  border-bottom: 1px solid #262f45;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.th-strategy-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
.th-target-room {
  font-size: 11.5px;
  color: #93c5fd;
  background: rgba(56,189,248,0.12);
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 700;
}
.th-post {
  padding: 18px 18px 12px;
  display: flex;
  gap: 12px;
}
.th-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.th-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e293b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #f8fafc;
  flex-shrink: 0;
}
.th-thread-line {
  width: 2px;
  flex: 1;
  background: #2a2a2a;
  margin-top: 8px;
}
.th-main { flex: 1; min-width: 0; }
.th-handle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.th-handle { font-weight: 700; font-size: 14px; color: #f5f5f5; }
.th-time { font-size: 12.5px; color: #737373; }
.th-body {
  font-size: 14.5px;
  color: #ededed;
  white-space: pre-line;
  margin-bottom: 12px;
  line-height: 1.52;
}
.th-carousel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.th-carousel.single { grid-template-columns: 1fr; max-width: 330px; }
.th-carousel img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #2c2c2c;
  cursor: zoom-in;
  transition: transform 0.16s;
}
.th-carousel img:hover { transform: scale(1.015); }
.th-actions-icons {
  display: flex;
  gap: 16px;
  color: #8e8e8e;
  font-size: 13px;
  margin-top: 4px;
}
.th-reply {
  padding: 0 18px 16px;
  display: flex;
  gap: 12px;
}
.th-reply-body {
  background: #171717;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13.5px;
  color: #e5e5e5;
  white-space: pre-line;
}
.th-psych-note {
  margin: auto 18px 14px;
  background: rgba(250, 204, 21, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 12.5px;
  color: #fef08a;
}
.th-btn-bar {
  padding: 12px 18px;
  background: #141822;
  border-top: 1px solid #22293a;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-sm {
  background: #1f2937;
  color: #f1f5f9;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.btn-sm:hover { background: #334155; }
.btn-sm.primary {
  background: var(--accent);
  color: #111827;
  border-color: var(--accent);
}

/* Interactive Simulators (Tab 3 & Sample 5/6) */
.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}
.phone-frame {
  background: #0d1017;
  border: 3px solid #2d364d;
  border-radius: 34px;
  padding: 18px 16px;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.55);
}
.phone-notch {
  width: 96px;
  height: 6px;
  background: #2d364d;
  border-radius: 99px;
  margin: 0 auto 14px;
}

/* Bridge Page Mockup */
.bridge-screen {
  background: #0f172a;
  border-radius: 22px;
  padding: 20px 16px;
  border: 1px solid #1e293b;
}
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  margin-right: 6px;
}
.bridge-deal-item {
  background: #1e293b;
  border-radius: 12px;
  padding: 11px 13px;
  margin-top: 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bridge-deal-item.locked {
  border: 1px dashed #facc15;
  background: rgba(250, 204, 21, 0.08);
}
.kakao-cta-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--kakao);
  color: var(--kakao-ink);
  border: none;
  border-radius: 14px;
  padding: 15px 14px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(254, 229, 0, 0.25);
}

/* Kakao OpenChat Cover & Room Simulator */
.kakao-cover {
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
  border-radius: 22px;
  padding: 22px 18px;
  color: #fff;
  position: relative;
}
.kakao-room-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.38;
  margin-top: 26px;
}
.kakao-tags {
  color: #93c5fd;
  font-size: 12px;
  margin-top: 10px;
}
.kakao-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: #e2e8f0;
}
.kakao-heart-pill {
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.5);
  color: #fda4af;
  padding: 3px 10px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 12px;
}
.kakao-chat-room {
  background: #bacee0;
  color: #191919;
  border-radius: 22px;
  padding: 14px 12px;
  min-height: 490px;
  display: flex;
  flex-direction: column;
}
.kakao-notice-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  margin-bottom: 12px;
  line-height: 1.48;
}
.kakao-bubble {
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  max-width: 90%;
  margin-bottom: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  white-space: pre-line;
}
.kakao-bubble.coffee {
  background: #fffbeb;
  border: 2px solid #f59e0b;
}
.kakao-react {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.88);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
  width: fit-content;
}
.kakao-frozen-input {
  margin-top: auto;
  background: rgba(255,255,255,0.65);
  border-radius: 99px;
  padding: 9px 14px;
  font-size: 12px;
  color: #475569;
  text-align: center;
  font-weight: 700;
}

/* Templates & SOP */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
}
.tpl-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.tpl-pre {
  background: #0b0e15;
  border: 1px solid #1f293d;
  border-radius: 12px;
  padding: 13px;
  font-size: 13.5px;
  color: #e2e8f0;
  white-space: pre-wrap;
  margin: 10px 0 14px;
  flex: 1;
}

.sop-step {
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.sop-step h4 { font-size: 18px; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.sop-step ul { padding-left: 20px; color: #dbeafe; font-size: 14px; }
.sop-step li { margin-bottom: 7px; }

.calc-row { margin-bottom: 16px; }
.calc-row label { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.calc-row input[type="range"] { width: 100%; accent-color: var(--accent); }

/* Lightbox modal */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.88);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-height: 92vh;
  max-width: 94vw;
  border-radius: 14px;
}
.toast {
  position: fixed;
  bottom: 26px;
  right: 26px;
  background: var(--accent);
  color: #0f172a;
  font-weight: 800;
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 12px;
  z-index: 300;
  display: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
