/* ==========================================================
   Kalkulator Hero HOK - tema terang krem dan hijau sage
   ========================================================== */

:root {
  --page: #e7e5dc;
  --screen: #f5f3ec;
  --card: #fbfaf6;
  --soft: #eceadf;

  --ink: #1f2a24;
  --ink-2: #5d665f;
  --ink-3: #98a097;

  --forest: #243229;
  --forest-2: #31443a;
  --sage: #dce5d2;
  --sage-2: #c8d6bc;
  --ok: #5b8c5a;

  --line: rgba(31, 42, 36, 0.09);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 10px 28px rgba(45, 55, 45, 0.08);

  --font-body: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  /* Variabel tambahan untuk pergantian tema (nilai terang = warna asli) */
  color-scheme: light;
  --accent: #243229;
  --on-accent: #fff;
  --accent-shadow: rgba(36, 50, 41, 0.22);
  --accent-icon-bg: rgba(255, 255, 255, 0.18);
  --hover: #fff;
  --tint: rgba(36, 50, 41, 0.07);
  --selected-icon-bg: rgba(255, 255, 255, 0.6);
  --line-strong: rgba(31, 42, 36, 0.18);
  --line-check: rgba(31, 42, 36, 0.22);
  --scroll-thumb: rgba(31, 42, 36, 0.22);
  --page-glow: rgba(255, 255, 255, 0.55);
  --screen-border: rgba(255, 255, 255, 0.8);
  --shadow-screen: 0 30px 70px rgba(60, 70, 55, 0.14), 0 2px 0 rgba(255, 255, 255, 0.9) inset;
  --shadow-tile: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 3px 10px rgba(45, 55, 45, 0.07);
  --shadow-avatar: 0 12px 28px rgba(45, 55, 45, 0.18);
  --shadow-card: 0 16px 34px rgba(36, 50, 41, 0.28);
  --shadow-dock: 0 14px 34px rgba(45, 55, 45, 0.2);
  --fab-shadow: rgba(36, 50, 41, 0.4);
  --warn-bg: #f6e4df;
  --warn-line: #ebc7be;
  --warn-ink: #8a3a2b;
}

/* ===== Mode gelap: nada krem dan hijau sage diubah ke hijau hutan gelap ===== */

:root[data-theme="dark"] {
  color-scheme: dark;

  --page: #0f1511;
  --screen: #171f19;
  --card: #1e2922;
  --soft: #28352d;

  --ink: #e7ede3;
  --ink-2: #a8b4a8;
  --ink-3: #75817a;

  --forest: #2c4535;
  --forest-2: #bcd1b2;
  --sage: #2a3d31;
  --sage-2: #3b5646;
  --ok: #7fb37e;

  --line: rgba(231, 237, 227, 0.09);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 28px rgba(0, 0, 0, 0.32);

  --accent: #d3e3c8;
  --on-accent: #16211a;
  --accent-shadow: rgba(0, 0, 0, 0.35);
  --accent-icon-bg: rgba(0, 0, 0, 0.1);
  --hover: #26352c;
  --tint: rgba(231, 237, 227, 0.07);
  --selected-icon-bg: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(231, 237, 227, 0.2);
  --line-check: rgba(231, 237, 227, 0.28);
  --scroll-thumb: rgba(231, 237, 227, 0.22);
  --page-glow: rgba(255, 255, 255, 0.04);
  --screen-border: rgba(255, 255, 255, 0.06);
  --shadow-screen: 0 30px 70px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
  --shadow-tile: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 3px 10px rgba(0, 0, 0, 0.28);
  --shadow-avatar: 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 16px 34px rgba(0, 0, 0, 0.4);
  --shadow-dock: 0 14px 34px rgba(0, 0, 0, 0.5);
  --fab-shadow: rgba(0, 0, 0, 0.5);
  --warn-bg: #3a2420;
  --warn-line: #5a3730;
  --warn-ink: #f0b3a5;
}

/* ===== Tombol ganti tema ===== */

.topbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: -8px;
  position: sticky;
  top: 8px;
  z-index: 40;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

/* Saat scroll: tombol mengecil jadi ikon saja */
.btn-label {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s ease, opacity 0.2s ease;
}

.theme-toggle {
  transition: padding 0.3s ease, gap 0.3s ease, background 0.2s;
}

.topbar.collapsed .theme-toggle {
  gap: 0;
  padding: 9px;
}

.topbar.collapsed .btn-label {
  max-width: 0;
  opacity: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--hover);
}

.theme-toggle .icon-sun,
.theme-toggle .label-light {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .label-light {
  display: inline-block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon,
:root[data-theme="dark"] .theme-toggle .label-dark {
  display: none;
}

.theme-toggle svg {
  display: block;
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  flex: none;
}
:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 20px;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(10px, 2.4vw, 32px);
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 0% 0%, var(--page-glow), transparent 60%),
    var(--page);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Kerangka: dua layar berdampingan ===== */

.app {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(380px, 470px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.screen {
  min-width: 0;
  padding: 28px;
  border-radius: 46px;
  background: var(--screen);
  border: 1px solid var(--screen-border);
  box-shadow: var(--shadow-screen);
}

.screen-items {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
}

/* Catatan tulisan tangan */
.note {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.05;
  color: var(--ink-2);
  transform: rotate(-4deg);
  transform-origin: left center;
}

.note-top {
  margin-bottom: 18px;
}

/* ===== Sapaan hero ===== */

.hello {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hello-text {
  min-width: 0;
}

.hello-line {
  margin: 0;
  font-size: 22px;
  font-weight: 300;
  color: var(--ink);
}

.hero-name {
  margin: 2px 0 12px;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 12.5px;
  font-weight: 600;
}

.chip-key {
  color: var(--ink-3);
  font-weight: 500;
}

.avatar-frame {
  flex: none;
  width: 104px;
  height: 104px;
  margin-top: 6px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--soft);
  border: 4px solid var(--card);
  box-shadow: var(--shadow-avatar);
}

.avatar-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Pemilih hero (carousel geser) ===== */

.hero-carousel-block {
  margin-top: 24px;
}

.hero-carousel-block .block-head {
  margin-bottom: 6px;
}

/* Judul "Hero (119 hero)" di kiri, kotak cari di kanan */
.hero-head {
  align-items: center;
  flex-wrap: wrap;
  row-gap: 8px;
}

.hero-head h3 {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.hero-search {
  flex: 1 1 130px;
  min-width: 110px;
  max-width: 190px;
}

.hero-search svg {
  left: 13px;
  width: 16px;
  height: 16px;
}

.hero-search .picker-search {
  height: 38px;
  padding: 0 12px 0 36px;
  font-size: 13px;
}

.hero-card[hidden] {
  display: none;
}

.hero-empty {
  flex: 1;
  margin: 0;
  padding: 30px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  cursor: default;
}

.hero-carousel {
  position: relative;
  display: flex;
  gap: 10px;
  margin: 0 -8px;
  padding: 6px 8px 14px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding: 0 8px;
  overscroll-behavior-x: contain;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

.hero-carousel::-webkit-scrollbar {
  height: 6px;
}

.hero-carousel::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 6px;
}

.hero-carousel.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
}

.hero-card {
  flex: none;
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  scroll-snap-align: start;
  cursor: inherit;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.hero-card:hover {
  background: var(--hover);
  color: var(--ink);
}

.hero-card-img {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--soft);
  font-size: 22px;
  font-weight: 800;
  color: var(--forest-2);
}

.hero-card-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* Simbol role: pojok kanan atas potret, kecil, ditumpuk ke bawah kalau lebih dari satu */
.hero-roles {
  position: absolute;
  top: 4px;
  right: 4px;
  left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  pointer-events: none;
}

/* Selektor sengaja lebih kuat dari ".hero-card-img img" (lebar/tinggi 100%),
   kalau tidak ukuran ikon role ikut membesar mengikuti ukuran aslinya */
.hero-card-img .role-icon {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.hero-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
  min-height: 2.5em;
  text-align: center;
  line-height: 1.25;
}

.hero-card.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 14px var(--accent-shadow);
}

.hero-card.selected .hero-card-img {
  background: var(--accent-icon-bg);
  color: var(--on-accent);
}

/* ===== Blok section ===== */

.block {
  margin-top: 30px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.block-head h3,
.effects-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.block-tools {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.count-note {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-3);
  cursor: pointer;
}

.link-btn:hover {
  text-decoration-color: var(--ink);
}

/* ===== Statistik lengkap (gaya daftar tugas) ===== */

.game-stat-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.group-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.group-head span {
  font-size: 12px;
  color: var(--ink-3);
}

.stat-list {
  padding: 4px 18px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  font-size: 14px;
  color: var(--ink-2);
}

.stat-row + .stat-row {
  border-top: 1px solid var(--line);
}

.stat-row .val {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cdr-notice {
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Pemberitahuan: efek pasif sama pada item yang dipilih */
.passive-notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.passive-notice .pn-title {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.passive-notice ul {
  margin: 0 0 6px;
  padding-left: 18px;
}

.passive-notice p {
  margin: 0;
}

/* ===== Efek pasif (kartu sage) ===== */

.effects-card {
  margin-top: 30px;
  padding: 20px;
  border-radius: 28px;
  background: var(--sage);
  border: 1px solid var(--sage-2);
}

.effects-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.effects-list li {
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--tint);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}

.effects-list li strong {
  color: var(--ink);
}

/* ===== Navigasi bawah (layar kecil) ===== */

.dock-wrap {
  display: none;
}

/* ===== Responsif ===== */

@media (max-width: 980px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    max-width: 560px;
    gap: 22px;
  }

  .screen-items {
    position: static;
    max-height: none;
  }

  /* Menu melayang di kanan, di tengah tinggi layar */
  .dock-wrap {
    position: fixed;
    right: 8px;
    top: 50%;
    z-index: 30;
    display: block;
    transform: translateY(-50%);
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .dock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-dock);
  }

  .dock-link,
  .fab,
  .dock-hide {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: 0;
    padding: 0;
    color: var(--ink-3);
    background: transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }

  .dock-link.active {
    color: var(--ink);
    background: var(--soft);
  }

  .fab {
    margin-top: 2px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 4px 10px var(--fab-shadow);
  }

  .dock-hide {
    width: 38px;
    height: 24px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    color: var(--ink-3);
  }

  .dock-hide:hover {
    color: var(--ink);
  }

  /* Sembunyi karena scroll: geser keluar layar ke kanan */
  .dock-wrap.scroll-hidden {
    transform: translate(calc(100% + 16px), -50%);
    opacity: 0;
    pointer-events: none;
  }

  /* Disembunyikan manual: hanya tersisa tab kecil di tepi */
  .dock-wrap.manual-hidden .dock {
    transform: translateX(calc(100% + 16px));
    opacity: 0;
    pointer-events: none;
  }

  .dock {
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .dock-show {
    position: absolute;
    right: -8px;
    top: 50%;
    display: none;
    place-items: center;
    width: 22px;
    height: 56px;
    padding: 0 0 0 4px;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    background: var(--card);
    color: var(--ink-2);
    box-shadow: var(--shadow-dock);
    transform: translateY(-50%);
    cursor: pointer;
  }

  .dock-wrap.manual-hidden .dock-show {
    display: grid;
  }
}

@media (max-width: 480px) {
  .screen {
    padding: 20px 18px;
    border-radius: 36px;
  }

  .avatar-frame {
    width: 84px;
    height: 84px;
  }

  .hello-line {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
    animation: none !important;
  }
}
/* ===== Footer ===== */

.site-footer {
  max-width: 760px;
  margin: 40px auto 0;
  padding: 28px 8px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  border-top: 1px solid var(--line);
}

.footer-social { display: flex; gap: 12px; }

.social-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}

.social-btn:hover { background: var(--accent); color: var(--on-accent); }

.footer-logo { display: inline-block; border-radius: 14px; }
.footer-logo img { display: block; width: clamp(150px, 40vw, 200px); height: auto; }

/* Teks "HOK" pada logo gelap, beri latar terang di mode gelap */
:root[data-theme="dark"] .footer-logo { background: #eef2ee; padding: 6px 14px; }

.footer-copy {
  margin: 0;
  max-width: 640px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
}

.footer-links a {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}

.footer-links a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 980px) {
  .site-footer { padding-bottom: 90px; }
}
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.nav-pill:hover {
  background: var(--hover);
}