/* =========================================================
   MyDoc — style.css
   Tema: K-Drama Male Lead Manhwa + warna ceria
   (ivory webtoon, garis navy tebal, bayangan offset keras)
   ========================================================= */

:root {
  --bg-ivory: #FAF8F5;
  --ink: #161B33;
  --cobalt: #3B5BFD;
  --cobalt-dark: #2447E0;
  --slate: #1E293B;
  --gold: #F59E0B;
  --gold-soft: #FEF3C7;
  --gold-mid: #FDE68A;
  --mint: #10B981;
  --mint-dark: #059669;
  --mint-soft: #D1FAE5;
  --peri: #EEF2FF;
  --peri-mid: #E0E7FF;
  --coral: #EC4899;
  --coral-soft: #FCE7F3;
  --text: #1E293B;
  --muted: #64748B;
  --line: #CBD5E1;
  --radius: 1rem;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Aptos Display', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg-ivory);
  /* pola halftone ala webtoon */
  background-image:
    radial-gradient(#CBD5E1 1.25px, transparent 1.25px),
    radial-gradient(#FDE68A 0.95px, var(--bg-ivory) 0.95px);
  background-size: 26px 26px;
  background-position: 0 0, 13px 13px;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.hidden { display: none !important; }
.font-manhwa { font-family: 'Fredoka', 'Plus Jakarta Sans', cursive, sans-serif; letter-spacing: .015em; }
.accent { color: var(--cobalt); }
.muted { color: var(--muted); }
.text-white { color: #fff; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- warna latar utilitas ---------- */
.bg-white { background: #fff; }
.bg-ivory { background: var(--bg-ivory); }
.bg-peri { background: var(--peri); }
.bg-gold { background: var(--gold-soft); }
.bg-gold-strong { background: var(--gold); color: #fff; }
.bg-mint { background: var(--mint-soft); }
.bg-mint-strong { background: var(--mint); color: #fff; }
.bg-coral { background: var(--coral-soft); }
.bg-cobalt { background: var(--cobalt); color: #fff; }
.bg-ink { background: var(--ink); color: var(--gold-soft); }
.tilt-l { transform: rotate(-2deg); }
.tilt-r { transform: rotate(2deg); }

/* ---------- komponen komik ---------- */
.comic-card {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 1.25rem;
  box-shadow: 6px 6px 0 var(--ink);
}
.comic-card-sm {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}

.comic-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2.5px solid var(--ink);
  border-radius: .9rem;
  box-shadow: 4px 4px 0 var(--ink);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .12s ease, filter .12s;
}
.comic-btn:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); filter: brightness(1.03); }
.comic-btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--ink); }
.comic-btn:disabled, .comic-pill:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: 2px 2px 0 var(--ink); }

.comic-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}
.comic-pill:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); filter: brightness(1.04); }
.comic-pill:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }

.btn-xs { padding: 5px 12px; font-size: 12px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-md { padding: 10px 18px; font-size: 15px; font-family: 'Fredoka', sans-serif; }

.sfx-badge {
  display: inline-flex; align-items: center; gap: 4px;
  border: 2px solid var(--ink);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  border-radius: 999px;
  padding: 2px 10px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.ghost-btn {
  border: 2px solid transparent; background: none; border-radius: 8px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.ghost-btn:hover { color: var(--coral); border-color: var(--ink); }

/* ---------- header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250,248,245,.96);
  backdrop-filter: blur(8px);
  border-bottom: 2.5px solid var(--ink);
}
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 16px; background: var(--cobalt);
  border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 22px; transform: rotate(-3deg);
}
.brand-line { display: flex; align-items: center; gap: 8px; }
.brand-name { font-size: 26px; font-weight: 700; line-height: 1; }
.repo-pill { font-size: 11px; font-weight: 700; background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; }
.brand-sub { font-size: 13px; font-weight: 600; color: #475569; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #CBD5E1; border: 1.5px solid var(--ink); }
.dot.on { background: var(--mint); }

/* laci AI */
.ai-drawer { border-top: 2.5px solid var(--ink); background: var(--peri); }
.ai-drawer-inner { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; padding-bottom: 14px; }
.ai-intro { display: flex; gap: 12px; align-items: flex-start; }
.ai-title { font-size: 15px; font-weight: 800; }
.ai-title small { font-weight: 600; color: #475569; }
.ai-note { font-size: 12.5px; color: #334155; margin-top: 2px; }
.ai-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.ai-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; padding-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.field.grow { flex: 1 1 260px; }
.field-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #475569; }
.key-row { display: flex; gap: 6px; align-items: center; }
.key-row input { flex: 1; }
.ai-form select, .ai-form input[type="text"], .ai-form input[type="password"] {
  padding: 8px 10px; font-size: 13px; font-weight: 600; background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.ai-buttons { display: flex; gap: 8px; padding-bottom: 2px; }

/* ---------- main ---------- */
.main { padding-top: 22px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 22px; }

/* hero */
.hero { position: relative; padding: 18px; background: linear-gradient(90deg, var(--peri), #fff 55%, rgba(254,243,199,.6)); }
.hero-sfx { position: absolute; top: 14px; right: 16px; display: flex; gap: 8px; }
.hero-body { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mascot { position: relative; flex-shrink: 0; padding-bottom: 12px; }
.mascot-frame {
  width: 128px; height: 144px; padding: 3.5px; border-radius: 1.25rem;
  background: linear-gradient(135deg, #10B981 0%, #3B5BFD 52%, #161B33 100%);
  border: 2.5px solid var(--ink); box-shadow: var(--shadow);
}
.mascot-gif { width: 100%; height: 100%; object-fit: cover; object-position: center top; border-radius: 1rem; display: block; background: #E2E8F0; }
.mascot-tag { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); font-size: 10px; }
.hero-text { flex: 1; width: 100%; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.speech-bubble { position: relative; background: #fff; border: 2.5px solid var(--ink); border-radius: 1.25rem; box-shadow: var(--shadow); padding: 12px 16px; }
.bubble-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.bubble-head .sfx-badge { font-size: 10px; border-radius: 6px; }
.mood { font-size: 12px; font-weight: 800; color: var(--cobalt); }
.speech { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.underline { text-decoration: underline; text-decoration-color: var(--cobalt); text-decoration-thickness: 2px; font-weight: 800; }
.sample-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sample-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 8px; padding: 3px 10px; }
.sample-row .comic-pill { padding: 6px 14px; font-size: 12px; }

/* tab sumber */
.tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tab { justify-content: flex-start; text-align: left; padding: 12px 14px; background: #fff; gap: 12px; }
.tab > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tab-ico { font-size: 22px; padding: 6px; border-radius: 12px; border: 2px solid var(--ink); line-height: 1; flex-shrink: 0; }
.tab-title { font-size: 15px; font-weight: 700; line-height: 1.15; }
.tab-sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.tab.is-active { background: var(--cobalt); color: #fff; }
.tab.is-active .tab-sub { color: rgba(255,255,255,.9); }
.tab.is-active .tab-ico { background: rgba(255,255,255,.22); }

/* penerjemah */
.translator { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(90deg, #fff, rgba(238,242,255,.7) 50%, rgba(209,250,229,.45)); }
.translator-head { display: flex; align-items: center; gap: 10px; }
.tr-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--mint); color: #fff; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tr-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tr-title { font-size: 18px; font-weight: 700; }
.tr-sub { font-size: 12.5px; font-weight: 500; color: #475569; }
.translator-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lang-box { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 5px 10px; }
.lang-cap { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.lang-box select { border: 0; background: transparent; font-size: 13px; font-weight: 700; outline-offset: 4px; max-width: 170px; }
.tone-box { background: var(--gold-soft); }
.arrow { font-weight: 800; }

/* split */
.split { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 2px dashed var(--line); }
.panel-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.panel-title h2 { font-size: 20px; font-weight: 700; }

/* opsi */
.opt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--peri); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; }
.opt-label { font-size: 12px; font-weight: 800; }
.opt-bar select { padding: 4px 8px; font-size: 12px; font-weight: 700; background: #fff; border: 2px solid var(--ink); border-radius: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--cobalt); }

/* dropzone */
.dropzone { border: 2.5px dashed var(--ink); border-radius: 1rem; padding: 20px 14px; text-align: center; background: var(--bg-ivory); cursor: pointer; transition: background .15s, transform .15s; }
.dropzone:hover, .dropzone.is-over { background: var(--peri); }
.dropzone.is-over { transform: scale(1.01); }
.drop-icon { font-size: 32px; margin-bottom: 4px; }
.drop-title { font-size: 16px; font-weight: 700; }
.drop-sub { font-size: 12px; font-weight: 500; color: #475569; margin-top: 4px; }

.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; width: 96px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; box-shadow: 2px 2px 0 var(--ink); overflow: hidden; }
.thumb canvas { display: block; width: 100%; height: 88px; object-fit: cover; background: #f1f5f9; }
.thumb-no { position: absolute; left: 4px; top: 4px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 800; border-radius: 6px; padding: 0 6px; }
.thumb-status { display: block; font-size: 10px; font-weight: 700; text-align: center; padding: 2px 4px; background: var(--peri); border-top: 2px solid var(--ink); }
.thumb-status.done { background: var(--mint-soft); }
.thumb-remove { position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; padding: 0; line-height: 1; border: 2px solid var(--ink); border-radius: 50%; background: var(--coral); color: #fff; font-weight: 800; font-size: 11px; cursor: pointer; }
.file-info { font-size: 12.5px; font-weight: 700; background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; word-break: break-word; }

.progress { background: var(--peri); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.progress-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 800; }
.progress-track { height: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--cobalt); border-radius: 999px; transition: width .2s; background-image: linear-gradient(45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%); background-size: 16px 16px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 16px 0; } }

.raw-block { display: flex; flex-direction: column; gap: 6px; }
.raw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.raw-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #334155; }
.raw-count { font-size: 11px; font-weight: 700; color: var(--muted); }
#rawInput, #mdText {
  width: 100%; padding: 12px; font-size: 13px; font-weight: 500; line-height: 1.55; resize: vertical;
  background: #F8FAFC; border: 2.5px solid var(--ink); border-radius: 12px; min-height: 140px;
}
#rawInput:focus, #mdText:focus { background: #fff; outline: 3px solid rgba(59,91,253,.35); }
#mdText { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: #fff; }

.cta { width: 100%; padding: 14px 18px; font-size: 19px; font-weight: 700; }

/* panel hasil */
.export-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.view-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.seg { flex: 1; display: flex; gap: 6px; padding: 6px; background: var(--bg-ivory); border: 2px solid var(--ink); border-radius: 12px; min-width: 0; }
.seg-mint { flex: 0 1 auto; background: var(--mint-soft); }
.seg-btn { flex: 1; padding: 8px 8px; border: 2px solid transparent; border-radius: 9px; background: transparent; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 13px; color: #334155; cursor: pointer; white-space: nowrap; }
.seg-btn:hover { background: #fff; }
.seg-btn.is-active { background: var(--cobalt); color: #fff; border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.seg-mint .seg-btn { font-family: inherit; font-size: 11.5px; font-weight: 800; }
.seg-mint .seg-btn.is-active { background: var(--ink); }

.empty { padding: 48px 16px; text-align: center; background: var(--bg-ivory); border: 2px dashed var(--line); border-radius: 1rem; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty-ico { font-size: 44px; }
.empty h3 { font-size: 20px; font-weight: 700; }
.empty p { font-size: 13.5px; color: #475569; max-width: 440px; }

#outputWrap { display: flex; flex-direction: column; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { padding: 10px 12px; min-width: 0; }
.kpi-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: #475569; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; line-height: 1.15; }

.view { display: flex; flex-direction: column; gap: 14px; }
.box { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.box-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.box-title { font-size: 16px; font-weight: 700; }
.engine-badge { font-size: 10.5px; font-weight: 800; padding: 2px 10px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; }
.sub-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 8px; }
.summary { font-size: 13.5px; line-height: 1.6; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.summary ul { margin: 0; padding-left: 18px; }

/* chip entitas */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; }
.chip b { color: var(--cobalt); }
.chip.warn { background: var(--gold-soft); }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checks li { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 8px; border: 2px solid var(--ink); }
.checks li.ok { background: var(--mint-soft); }
.checks li.warn { background: var(--gold-soft); }

/* insight */
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.insight-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.insight-card h5 { margin: 0; font-size: 12.5px; font-weight: 800; color: #334155; overflow-wrap: anywhere; }
.insight-big { font-family: 'Fredoka', sans-serif; font-size: 26px; font-weight: 700; color: var(--cobalt); line-height: 1; }
.insight-big small { font-size: 13px; color: var(--muted); font-weight: 600; }
.insight-meta { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: minmax(70px, 38%) 1fr auto; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: #E2E8F0; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--cobalt); border-radius: 999px; }
.bar-fill.mint { background: var(--mint); }
.bar-fill.gold { background: var(--gold); }
.bar-val { font-weight: 800; font-size: 11.5px; }
.stat-line { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; }
.stat-line b { font-weight: 800; }

/* kartu kunci-nilai */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kv-card { padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-sm); min-width: 0; }
.kv-card.t0 { background: var(--peri); }
.kv-card.t1 { background: var(--gold-soft); }
.kv-card.t2 { background: var(--mint-soft); }
.kv-card.t3 { background: var(--coral-soft); }
.kv-key { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #475569; overflow-wrap: anywhere; }
.kv-val { font-size: 13.5px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }

.bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.bullets li { display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; }
.bullets li::before { content: '✦'; color: var(--cobalt); font-weight: 800; flex-shrink: 0; }
.bullets li.bullet-h { font-family: 'Fredoka', sans-serif; font-weight: 700; margin-top: 6px; color: var(--ink); }
.bullets li.bullet-h::before { content: '▸'; }
.bullets li.bullet-p::before { content: '¶'; color: var(--muted); }

/* terjemahan berdampingan */
.s-o { display: block; color: var(--muted); font-weight: 500; font-size: .92em; }
.s-t { display: block; font-weight: 700; }

/* tabel */
.table-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.table-tools input { width: 100%; max-width: 300px; padding: 8px 12px; font-size: 13px; font-weight: 600; background: var(--bg-ivory); border: 2px solid var(--ink); border-radius: 12px; }
.table-tools input:focus { background: #fff; }
.table-hint { font-size: 12px; font-weight: 700; color: #475569; }
.table-scroll { overflow: auto; max-height: 72vh; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--cobalt); color: #fff; font-family: 'Fredoka', sans-serif; font-weight: 600; padding: 9px 12px; white-space: nowrap; cursor: pointer; user-select: none; border-bottom: 2.5px solid var(--ink); }
.data-table thead th:hover { background: var(--cobalt-dark); }
.data-table thead th .si { opacity: .75; font-size: 11px; margin-left: 4px; }
.data-table tbody td { padding: 8px 12px; border-bottom: 1px solid #E2E8F0; vertical-align: top; font-weight: 500; min-width: 70px; }
.data-table tbody tr:nth-child(even) { background: var(--bg-ivory); }
.data-table tbody tr:hover { background: var(--peri); }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-note { font-size: 12px; font-weight: 700; color: #92400E; background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 8px; padding: 4px 10px; }

/* markdown */
.md { font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; }
.md h1 { font-family: 'Fredoka', sans-serif; font-size: 21px; margin: 4px 0 8px; }
.md h2 { font-family: 'Fredoka', sans-serif; font-size: 17px; margin: 14px 0 6px; }
.md h3 { font-family: 'Fredoka', sans-serif; font-size: 15px; margin: 12px 0 4px; }
.md p { margin: 6px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; margin: 8px 0; }
.md th, .md td { border: 1.5px solid var(--ink); padding: 5px 9px; text-align: left; font-size: 12.5px; }
.md th { background: var(--peri); }
.md hr { border: 0; border-top: 2px dashed var(--line); margin: 14px 0; }
.md-box { padding: 14px 16px; background: var(--bg-ivory); border: 2px solid var(--ink); border-radius: 12px; }
.md-edit { display: flex; flex-direction: column; gap: 6px; }

.app-footer { text-align: center; font-size: 12px; font-weight: 600; color: #475569; background: #fff; border-top: 2.5px solid var(--ink); padding: 14px 16px 84px; }

/* ---------- pemutar musik ---------- */
.music-dock { position: fixed; left: 14px; bottom: 14px; z-index: 45; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.music-fab { background: var(--gold-soft); padding: 8px 14px; font-size: 13px; }
.music-fab-label { font-family: 'Fredoka', sans-serif; }
.music-panel { width: min(300px, calc(100vw - 28px)); background: #fff; border: 2.5px solid var(--ink); border-radius: 1rem; box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.music-title { font-size: 15px; font-weight: 700; }
.music-row { display: flex; gap: 10px; align-items: center; }
.music-row select { flex: 1; padding: 8px 10px; font-size: 13px; font-weight: 700; background: var(--bg-ivory); border: 2px solid var(--ink); border-radius: 10px; }
.music-play { width: 44px; height: 44px; font-size: 16px; background: var(--cobalt); color: #fff; border-radius: 50%; padding: 0; flex-shrink: 0; }
.music-vol { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.music-vol input { flex: 1; accent-color: var(--cobalt); }
.music-note { font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1.4; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.eq i { display: block; width: 3px; height: 4px; background: var(--ink); border-radius: 2px; }
.is-playing .eq i, .eq.on i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s !important; }
.eq i:nth-child(3) { animation-delay: .4s !important; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 14px; } }

/* ---------- toast ---------- */
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; transform: translateY(110px); opacity: 0; transition: transform .3s, opacity .3s; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-inner { background: var(--gold-soft); padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13.5px; }
.toast-inner > span:first-child { font-size: 20px; }

body.is-busy { cursor: progress; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-ivory); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--ink); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

.print-only { display: none; }

/* ---------- responsif ---------- */
@media (max-width: 520px) {
  .hide-xs { display: none; }
  .brand-name { font-size: 22px; }
  .repo-pill { display: none; }
  .hero-sfx { display: none; }
  .seg-btn { font-size: 12px; padding: 8px 4px; white-space: normal; }
  .kpi-value { font-size: 19px; }
  .tab { padding: 10px; gap: 8px; }
  .tab-ico { font-size: 18px; }
  .tab-title { font-size: 13px; }
}
@media (min-width: 640px) {
  .hero-body { flex-direction: row; align-items: center; }
  .speech-bubble::before, .speech-bubble::after { content: ""; position: absolute; width: 0; height: 0; }
  .speech-bubble::before { left: -16px; top: 28px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-right: 16px solid var(--ink); }
  .speech-bubble::after { left: -11px; top: 30px; border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 13px solid #fff; }
  .mascot-frame { width: 144px; height: 162px; }
}
@media (min-width: 1024px) {
  .tabs { grid-template-columns: repeat(4, 1fr); }
  .split { grid-template-columns: 5fr 7fr; }
  .panel-in { position: sticky; top: 86px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* =========================================================
   CETAK RAPI (@media print)
   Hanya #printArea yang tampil: dokumen formal, tanpa tombol / sidebar.
   ========================================================= */
@page { size: A4; margin: 16mm 14mm; }
@media print {
  body { background: #fff !important; background-image: none !important; color: #000 !important; font-size: 11pt; }
  .no-print, .app-header, .app-footer, .music-dock, .toast, .skip-link, noscript { display: none !important; }
  main, .main { display: none !important; }
  .print-only { display: block !important; }

  #printArea { font-family: 'Plus Jakarta Sans', 'Aptos Display', Arial, sans-serif; color: #111; }
  #printArea .pr-head { border-bottom: 2px solid #161B33; padding-bottom: 8px; margin-bottom: 14px; }
  #printArea .pr-brand { font-size: 9pt; letter-spacing: .08em; text-transform: uppercase; color: #475569; }
  #printArea h1 { font-size: 18pt; margin: 2px 0 2px; color: #161B33; }
  #printArea .pr-meta { font-size: 9pt; color: #475569; }
  #printArea h2 { font-size: 13pt; margin: 14px 0 6px; color: #161B33; border-bottom: 1px solid #CBD5E1; padding-bottom: 2px; page-break-after: avoid; }
  #printArea h3 { font-size: 11.5pt; margin: 10px 0 4px; page-break-after: avoid; }
  #printArea p { margin: 4px 0; line-height: 1.5; }
  #printArea ul, #printArea ol { margin: 4px 0 8px 18px; padding: 0; }
  #printArea li { margin: 2px 0; line-height: 1.45; }
  #printArea table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; font-size: 9.5pt; }
  #printArea th, #printArea td { border: 1px solid #94A3B8; padding: 4px 7px; text-align: left; vertical-align: top; }
  #printArea th { background: #E2E8F0; font-weight: 700; }
  #printArea thead { display: table-header-group; }
  #printArea tr { page-break-inside: avoid; }
  #printArea table.kv th { width: 32%; background: #F1F5F9; }
  #printArea .pr-ai { border: 1px solid #94A3B8; border-left: 4px solid #3B5BFD; padding: 6px 10px; margin: 8px 0; background: #F8FAFC; }
  #printArea .s-o { color: #475569; font-size: .9em; }
  #printArea .pr-foot { margin-top: 18px; padding-top: 6px; border-top: 1px solid #CBD5E1; font-size: 8pt; color: #64748B; }
}

/* Perbaikan urutan spesifisitas: warna latar tombol komik tidak boleh tertimpa */
.comic-btn.bg-cobalt { background: var(--cobalt); color: #fff; }
.comic-btn.bg-mint-strong { background: var(--mint); color: #fff; text-shadow: 0 1px 0 rgba(22,27,51,.35); }
.comic-btn.bg-gold-strong { background: var(--gold); color: #fff; }
.comic-btn.bg-ink { background: var(--ink); color: var(--gold-soft); }
.comic-btn.bg-peri { background: var(--peri); }
.comic-btn.bg-gold { background: var(--gold-soft); }
.comic-btn.bg-mint { background: var(--mint-soft); }
.comic-btn.bg-coral { background: var(--coral-soft); }

/* Tab ZIP selebar penuh */
.tab-wide { grid-column: 1 / -1; }

/* ---- Pemeriksaan data cerdas ---- */
.vhead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.vscore { font-family: 'Fredoka', sans-serif; border: 3px solid #0f172a; border-radius: 14px; padding: 6px 12px; line-height: 1; box-shadow: 3px 3px 0 #0f172a; background: #fff; }
.vscore b { font-size: 28px; } .vscore small { font-size: 12px; color: var(--muted); }
.vscore.v-ok { background: #dcfce7; } .vscore.v-warn { background: #fef9c3; } .vscore.v-bad { background: #fee2e2; }
.vlabel { font-weight: 800; font-size: 14px; }
.vcounts { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.vchip { font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; border: 2px solid #0f172a; }
.vs-high.vchip { background: #fecaca; } .vs-med.vchip { background: #fde68a; } .vs-low.vchip { background: #e0e7ff; }
.vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vi { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 7px 9px; border-radius: 10px; border: 2px solid #0f172a22; background: #fff; overflow-wrap: anywhere; }
.vi .vsev { flex: none; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; border: 2px solid #0f172a; }
.vi.vs-high .vsev { background: #fecaca; } .vi.vs-med .vsev { background: #fde68a; } .vi.vs-low .vsev { background: #e0e7ff; }
.vfix { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vmore { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 8px; }
td.vsev-high { background: #fecaca !important; } td.vsev-med { background: #fef08a !important; } td.vsev-low { background: #e0e7ff !important; }
td.vnote { font-size: 12px; min-width: 220px; color: #7c2d12; white-space: normal; }

/* ---- Menu format cetak/unduh ---- */
.export-modal { position: fixed; inset: 0; z-index: 9000; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.export-modal.hidden { display: none; }
.export-card { background: #fff; padding: 18px; max-width: 460px; width: 100%; display: grid; gap: 12px; }
.export-card h3 { margin: 0; font-size: 18px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-hint { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
@media print { .export-modal { display: none !important; } }

@media print {
  #printArea table.kpi td { text-align: center; padding: 8px; }
  #printArea .kpi-v { font-size: 18pt; font-weight: 800; color: #3B5BFD; }
  #printArea .kpi-l { font-size: 9pt; color: #475569; }
  #printArea .vhead { display: flex; gap: 10px; align-items: center; margin: 4px 0; }
  #printArea .vscore { border: 1.5px solid #161B33; border-radius: 8px; padding: 2px 8px; font-weight: 800; }
  #printArea .vchip { font-size: 9pt; font-weight: 700; margin-right: 6px; }
  #printArea .vlist { list-style: none; margin: 4px 0; padding: 0; }
  #printArea .vi { display: flex; gap: 6px; margin: 3px 0; font-size: 10pt; page-break-inside: avoid; }
  #printArea .vsev { font-weight: 800; font-size: 8.5pt; border: 1px solid #161B33; border-radius: 99px; padding: 0 6px; flex: none; height: fit-content; }
  #printArea .vfix, #printArea .vmore { font-size: 9pt; color: #475569; }
  #printArea .pr-sum p { margin: 3px 0; }
}
