/* Simulasi Waris Islam: kalkulator, game Detektif Waris, dan bahan belajar (awalan sw-) */
.sw { --sw: #047857; --sw-soft: #d1fae5; --sw-ink: #064e3b; }
.sw-warn { margin: 0; padding: 5px 12px; background: #fef3c7; color: #78350f; font-size: clamp(12px, 1.35vw, 15px); line-height: 1.35; text-align: center; border-bottom: 2px solid #fde68a; }
.sw-warn b { font-weight: 800; }
.sw-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: clamp(6px, 1.4vw, 16px); overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, #ecfdf5, #fff 55%); -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.sw-view { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 0; min-width: 0; }
.sw-view[hidden], .sw-hud[hidden] { display: none; }
.sw h2 { margin: 12px 0 6px; font-size: clamp(17px, 2vw, 22px); color: var(--sw-ink); }
.sw h3 { margin: 14px 0 6px; font-size: clamp(15px, 1.7vw, 19px); color: var(--sw-ink); }
.sw h4 { margin: 8px 0 4px; font-size: clamp(14px, 1.5vw, 17px); color: var(--ink); }
.sw-in h2:first-child, .sw-out h2:first-child { margin-top: 0; }

/* ---------- Simulasi ---------- */
.sw-sim { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(10px, 2vw, 24px); flex: 1; min-height: 0; }
.sw-in, .sw-out { min-width: 0; }
.sw-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.sw-seg .opt { flex: 1 1 140px; }
.sw-money { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.sw-f { display: flex; flex-direction: column; gap: 3px; font-weight: 700; color: var(--muted); font-size: clamp(13px, 1.4vw, 15px); }
.sw-f input { font: 800 clamp(17px, 2vw, 21px) var(--font); padding: 8px 12px; min-height: 48px; border: 3px solid var(--sky-100); border-radius: 14px; color: var(--ink); background: #fff; min-width: 0; width: 100%; font-variant-numeric: tabular-nums; }
.sw-f input::placeholder { color: #94a3b8; font-weight: 600; }
.sw-f input:focus { outline: none; border-color: var(--sw); }
.sw-f input.bad { border-color: var(--bad); background: #fff1f2; }
.sw-f input { padding-left: 46px; background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='36' height='20'><text x='4' y='15' font-family='Arial' font-weight='700' font-size='14' fill='%2364748b'>Rp</text></svg>") no-repeat 8px center; }
.sw-err { font-style: normal; font-weight: 700; color: var(--bad); font-size: 13px; min-height: 0; }
.sw-err:empty { display: none; }
.sw-counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 10px; }
.sw-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 4px 6px 4px 12px; min-height: 58px; }
.sw-row[hidden] { display: none; }
.sw-row .lb { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sw-row .lb b { color: var(--ink); font-size: clamp(14px, 1.5vw, 17px); }
.sw-row .lb small { color: var(--muted); font-size: 12px; font-weight: 600; }
.sw-row .ct { display: flex; align-items: center; gap: 6px; flex: none; }
.sw-row output { min-width: 34px; text-align: center; font: 800 clamp(20px, 2.4vw, 26px) var(--font); color: var(--sw-ink); font-variant-numeric: tabular-nums; }
.sw-step { width: 52px; height: 52px; border-radius: 16px; border: 3px solid var(--sw); background: var(--sw-soft); color: var(--sw-ink); font: 800 28px/1 var(--font); cursor: pointer; padding: 0; display: grid; place-items: center; touch-action: manipulation; }
.sw-step:hover:not(:disabled) { background: var(--sw); color: #fff; }
.sw-step:disabled { opacity: .35; cursor: default; border-color: var(--line); }
.sw-step:focus-visible, .sw-opt:focus-visible, .sw-f input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.sw-contoh { justify-content: flex-start; }
.sw-contoh .opt, .sw-coba { min-height: 44px; font-size: clamp(14px, 1.5vw, 17px); padding: 0 14px; border-width: 2px; }
.sw-belum { margin-top: 12px; background: #fff7ed; border: 2px solid #fed7aa; border-radius: 16px; padding: 8px 14px; color: #7c2d12; }
.sw-belum summary { font-weight: 800; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.sw-belum p, .sw-belum li { font-size: clamp(13px, 1.4vw, 16px); line-height: 1.5; }
.sw-belum ul { margin: 4px 0; padding-left: 20px; }

.sw-out { background: #fff; border: 3px solid var(--sw-soft); border-radius: 22px; padding: clamp(10px, 1.6vw, 18px); }
.sw-galat { background: #fff1f2; border: 2px solid #fecdd3; color: var(--bad); border-radius: 14px; padding: 10px 14px; font-weight: 700; line-height: 1.4; }
.sw-kosong { color: var(--muted); font-weight: 600; }
.sw-sum { display: grid; gap: 4px; }
.sw-sum > div { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: clamp(14px, 1.5vw, 17px); color: var(--muted); font-weight: 600; }
.sw-sum b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sw-sum .net { border-top: 3px solid var(--sw); padding-top: 6px; margin-top: 4px; font-size: clamp(16px, 1.8vw, 20px); color: var(--sw-ink); font-weight: 800; }
.sw-sum .net b { color: var(--sw); }
.sw-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.sw-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: clamp(13px, 1.4vw, 16px); border: 2px solid; }
.sw-badge.aul { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
.sw-badge.radd { background: #e0f2fe; border-color: #0284c7; color: #075985; }
.sw-badge.umar { background: #ede9fe; border-color: #7c3aed; color: #4c1d95; }
.sw-badge.biasa { background: #d1fae5; border-color: #059669; color: #064e3b; }

.sw-bars { display: grid; gap: 6px; }
.sw-bar { display: grid; grid-template-columns: minmax(96px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: clamp(13px, 1.4vw, 16px); font-weight: 700; color: var(--ink); }
.sw-bar .nm { line-height: 1.2; min-width: 0; }
.sw-bar .nm small { color: var(--muted); }
.sw-bar .trk { display: block; height: 22px; background: #f1f5f9; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.sw-bar .fill { display: block; height: 100%; border-radius: 7px; border-right: 3px solid rgba(15,23,42,.35); transition: width .35s ease; }
.sw-bar .val { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 78px; }
.sw-bar .val small { color: var(--muted); font-weight: 600; }
.sw-bar.tx { color: var(--muted); }

.sw-tw { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 2px solid var(--line); border-radius: 14px; background: #fff; }
.sw-tw:focus-visible { outline: 3px solid var(--amber); }
.sw-tbl { border-collapse: collapse; width: 100%; font-size: clamp(13px, 1.4vw, 16px); }
.sw-tbl th, .sw-tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.sw-tbl thead th { background: var(--sw-soft); color: var(--sw-ink); font-weight: 800; position: sticky; top: 0; white-space: nowrap; }
.sw-tbl tbody th { font-weight: 800; }
.sw-tbl small { color: var(--muted); font-weight: 600; }
.sw-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-tbl tr.tx { background: #f8fafc; color: var(--muted); }
.sw-st { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 800; font-size: .88em; padding: 1px 8px; border-radius: 12px; border: 2px solid; line-height: 1.25; }
.sw-st i { font-style: normal; font-size: .85em; }
.sw-st.fu { background: #e0f2fe; border-color: #38bdf8; color: #075985; }
.sw-st.as { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
.sw-st.fa { background: #ede9fe; border-color: #a78bfa; color: #4c1d95; }
.sw-st.tx { background: #f1f5f9; border-color: #94a3b8; color: #475569; }
.sw-why { background: var(--sky-50); border-radius: 14px; padding: 6px 14px 10px; }
.sw-why ol, .sw-why ul, .sw-cat { margin: 4px 0; padding-left: 22px; line-height: 1.5; font-size: clamp(13px, 1.4vw, 16px); color: var(--ink); }
.sw-alasan { list-style: none; padding-left: 0 !important; }
.sw-alasan li { margin: 6px 0; }
.sw-cat li { margin: 3px 0; }
.sw-ingat { margin: 12px 0 0; font-size: clamp(12px, 1.3vw, 15px); color: var(--muted); line-height: 1.5; }

/* ---------- HUD dan Detektif ---------- */
.sw-hud { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.sw-hud:empty { display: none; }
.sw-chip { background: #fff; border: 3px solid var(--c); color: var(--ink); border-radius: 999px; padding: 1px 12px; font-weight: 800; font-size: clamp(13px, 1.5vw, 18px); display: inline-flex; gap: 8px; align-items: baseline; }
.sw-chip b { font-size: 1.2em; font-variant-numeric: tabular-nums; }
.sw-chip.on { background: var(--c); color: #fff; }
.sw-qn { font-weight: 800; color: var(--muted); font-size: clamp(13px, 1.4vw, 17px); margin-left: 6px; }
.sw-det { display: flex; flex-direction: column; gap: clamp(6px, 1.4vh, 14px); flex: 1; min-height: 0; }
.sw-case { background: #fff; border: 3px solid var(--sw-soft); border-radius: 20px; padding: 8px 10px; min-width: 0; }
.sw-casehead { font-weight: 700; color: var(--ink); font-size: clamp(13px, 1.6vw, 18px); line-height: 1.4; margin-bottom: 6px; }
.sw-fam { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.sw-card { width: clamp(92px, 11vw, 124px); background: #f8fafc; border: 2px solid var(--w, #94a3b8); border-radius: 14px; padding: 4px 4px 5px; text-align: center; }
.sw-card svg { width: 100%; height: auto; display: block; max-height: 62px; }
.sw-card .nm { font-weight: 800; font-size: clamp(11px, 1.15vw, 13px); line-height: 1.15; color: var(--ink); min-height: 2.3em; display: flex; align-items: center; justify-content: center; }
.sw-card .jml { font-weight: 700; font-size: 12px; color: var(--w, #475569); }
.sw-card.sw-pw { --w: #64748b; border-style: dashed; background: #f1f5f9; }
.sw-qa { display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 12px); min-width: 0; }
.sw-ask { font-weight: 800; color: var(--ink); font-size: clamp(16px, 2vw, 24px); line-height: 1.35; text-align: center; }
.sw-opts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(6px, 1.2vw, 12px); }
.sw-opt { position: relative; min-height: clamp(54px, 9vh, 84px); padding: 8px 12px 8px 22px; border-radius: 18px; border: 4px solid var(--sw-soft); background: #fff; color: var(--ink); font: 800 clamp(19px, 2.8vw, 32px)/1.15 var(--font); cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; font-variant-numeric: tabular-nums; touch-action: manipulation; }
.sw-opts.txt .sw-opt { font-size: clamp(15px, 2vw, 23px); }
.sw-opt:hover:not(:disabled) { border-color: var(--sw); }
.sw-opt kbd { position: absolute; top: 3px; left: 8px; font: 800 11px var(--font); color: var(--muted); opacity: .75; }
.sw-opt:disabled { cursor: default; }
.sw-opt.good { background: #bbf7d0; border-color: var(--ok); }
.sw-opt.bad { background: #fecdd3; border-color: var(--bad); }
.sw-opt.good::after { content: "\2713"; position: absolute; right: 10px; top: 4px; font-size: 20px; color: var(--ok); }
.sw-opt.bad::after { content: "\2717"; position: absolute; right: 10px; top: 4px; font-size: 20px; color: var(--bad); }
.sw-fb { min-height: 1.3em; font-weight: 700; color: var(--muted); font-size: clamp(13px, 1.6vw, 18px); line-height: 1.4; }
.sw-fb.ok > b { color: var(--ok); } .sw-fb.bad > b { color: var(--bad); }
.sw-fb .sw-w { display: block; margin-top: 4px; color: var(--ink); font-weight: 600; background: var(--sky-50); border-radius: 12px; padding: 6px 10px; }
.sw-next { align-self: center; margin-top: 0; min-height: 52px; padding: 0 34px; font-size: clamp(18px, 2vw, 24px); }
.sw-next[hidden] { display: none; }
.sw-names { display: grid; gap: 6px; }
.sw-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; text-align: center; }
.sw-names input[hidden] { display: none; }
.sw-recap { display: flex; flex-direction: column; gap: 4px; font-size: clamp(15px, 2vw, 22px); margin-bottom: 4px; }
.sw-resp .actions { margin-top: 8px; }
.sw-review { text-align: left; margin: 8px 0; }
.sw-review h3 { margin: 6px 0; text-align: center; }
.sw-allok { text-align: center; font-weight: 800; color: var(--ok) !important; }
.sw-rv { border: 2px solid var(--line); border-radius: 14px; margin: 6px 0; background: #fff; }
.sw-rv summary { cursor: pointer; padding: 8px 12px; font-size: clamp(13px, 1.5vw, 16px); line-height: 1.35; color: var(--ink); min-height: 44px; }
.sw-rv .in { padding: 0 12px 8px; font-size: clamp(13px, 1.4vw, 16px); }
.sw-rv .in p { margin: 4px 0; font-size: inherit; color: var(--ink); }
.sw-rv .bad { color: var(--bad); font-weight: 800; } .sw-rv .ok { color: var(--ok); font-weight: 800; }
.sw-rv .lg { margin: 4px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- Belajar ---------- */
.sw-bel { max-width: 1040px; width: 100%; margin: 0 auto; }
.sw-nav { display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: -6px; z-index: 5; background: #ecfdf5; padding: 6px 0; margin-bottom: 4px; }
.sw-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--sw); color: var(--sw-ink); background: #fff; font-weight: 800; font-size: clamp(13px, 1.4vw, 15px); text-decoration: none; }
.sw-nav a:hover { background: var(--sw); color: #fff; }
.sw-sec { background: #fff; border: 3px solid var(--sw-soft); border-radius: 20px; padding: 4px clamp(12px, 2vw, 22px) 14px; margin: 10px 0; }
.sw-sec h2 { display: flex; align-items: center; gap: 10px; }
.sw-sec h2 .no { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--sw); color: #fff; font-size: 18px; flex: none; }
.sw-sec p, .sw-sec li { font-size: clamp(14px, 1.6vw, 18px); line-height: 1.6; color: var(--ink); }
.sw-sec ol, .sw-sec ul { padding-left: 22px; margin: 4px 0; }
.sw-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.sw-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.sw-box { background: var(--sky-50); border: 2px solid var(--sky-100); border-radius: 14px; padding: 6px 14px 10px; }
.sw-box h4 { margin-top: 4px; color: var(--sw-ink); }
.sw-box p { margin: 4px 0; font-size: clamp(13px, 1.5vw, 16px); }
.sw-contoh-t { background: #fffbeb; border-left: 6px solid var(--amber); border-radius: 0 12px 12px 0; padding: 8px 12px; margin: 10px 0 6px; }
.sw-bgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.sw-bk { border: 3px solid var(--w); border-radius: 16px; overflow: hidden; background: #fff; }
.sw-bk .fr { display: flex; align-items: baseline; gap: 10px; background: var(--w); color: #fff; padding: 4px 12px; }
.sw-bk .fr b { font-size: clamp(24px, 3vw, 32px); line-height: 1.1; }
.sw-bk .fr span { font-weight: 700; }
.sw-bk ul { margin: 6px 0; padding-left: 20px; padding-right: 10px; }
.sw-bk li { font-size: clamp(13px, 1.4vw, 16px); line-height: 1.45; margin: 2px 0; }
.sw-hik li { margin: 6px 0; }
.sw-sec .sw-tw { margin: 8px 0; }

/* ---------- tata letak lebar ---------- */
@media (min-width: 760px) {
  .sw-sim { grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr); align-items: start; }
  .sw-counters { grid-template-columns: 1fr; }
  .sw-wrap.sim { overflow: hidden; }
  #view-sim { flex: 1 1 0; }
  .sw-sim { height: 100%; align-items: stretch; }
  .sw-in, .sw-out { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; padding-right: 6px; }
  .sw-out { padding: clamp(10px, 1.6vw, 18px); }
}
@media (min-width: 1000px) { .sw-money { grid-template-columns: 1fr 1fr; } }
@media (orientation: landscape) and (min-width: 640px) {
  .sw-view { flex: 1 1 0; }
  .sw-det { flex-direction: row; align-items: stretch; gap: clamp(8px, 2vw, 24px); }
  .sw-case { flex: 1 1 48%; overflow-y: auto; min-height: 0; }
  .sw-qa { flex: 1 1 52%; overflow-y: auto; overflow-x: hidden; padding: 2px; justify-content: center; }
}
@media (max-width: 639px) { .sw-opts { grid-template-columns: 1fr; } .sw-opts.n4 { grid-template-columns: 1fr 1fr; } .sw-opts.txt { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .sw-tbl:not(.small) { min-width: 0; }
  .sw-tbl:not(.small) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sw-tbl:not(.small) tr { display: block; padding: 6px 4px; border-bottom: 3px solid var(--sw-soft); }
  .sw-tbl:not(.small) th, .sw-tbl:not(.small) td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 8px; text-align: right; }
  .sw-tbl:not(.small) th[scope="row"] { font-size: 1.05em; }
  .sw-tbl:not(.small) td::before, .sw-tbl:not(.small) th::before { content: attr(data-l); font-weight: 700; color: var(--muted); text-align: left; flex: none; }
  .sw-tbl:not(.small) th::before { content: none; }
  .sw-tbl:not(.small) td.num { white-space: normal; }
  .sw-bar { grid-template-columns: minmax(80px, 34%) 1fr; }
  .sw-bar .val { grid-column: 1 / -1; text-align: left; margin-top: -4px; }
}
@media (max-width: 420px) { .sw-card { width: 86px; } .sw-step { width: 48px; height: 48px; } }
@media (max-height: 520px) {
  .sw-warn { padding: 2px 8px; font-size: 11px; line-height: 1.25; }
  .sw-wrap { gap: 3px; padding: 4px 8px; }
  .sw-opt { min-height: 40px; border-width: 3px; padding-top: 4px; padding-bottom: 4px; }
  .sw-ask { font-size: clamp(14px, 4.2vh, 18px); }
  .sw-card { width: 82px; padding: 2px; } .sw-card svg { max-height: 40px; }
  .sw-card .nm { font-size: 10.5px; min-height: 2.2em; } .sw-card .jml { font-size: 10.5px; }
  .sw-casehead { font-size: 12px; margin-bottom: 3px; }
  .sw-next { min-height: 40px; }
  .sw-step { width: 44px; height: 44px; }
  .sw-f input { min-height: 40px; padding-top: 4px; padding-bottom: 4px; font-size: 17px; }
  .sw-money { gap: 4px 12px; }
  .sw-row { min-height: 50px; }
  .sw-fb { font-size: 12.5px; }
  .sw-nav { top: -4px; padding: 3px 0; } .sw-nav a { min-height: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.sw-legend { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 2; }

@media (max-width: 759px), (max-height: 520px) { .sw-nav { position: static; } }
