:root {
  color-scheme: light;
  --ink: #18212b;
  --muted: #64748b;
  --line: #dbe3ea;
  --paper: #f7faf9;
  --panel: #ffffff;
  --green: #126c5a;
  --teal: #0e918c;
  --gold: #d89b29;
  --red: #b42318;
  --soft: #e6f4ef;
  --blue-soft: #e9f1fb;
  --shadow: 0 20px 70px rgba(18, 32, 45, 0.16);
  --home-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --home-title-size: clamp(2.7rem, 7vw, 6.2rem);
  --home-text-size: 1.1rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(18, 108, 90, 0.12), transparent 35rem),
    linear-gradient(180deg, #fffdf8 0%, #eef7f4 46%, #f8fbff 100%);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: #ffffff;
  transition: opacity 500ms ease, visibility 500ms ease;
  animation: splashExit 700ms ease 1600ms forwards;
}

.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes splashExit {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.splash p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.splash strong {
  font-size: 1.4rem;
}

.brin-logo {
  width: 118px;
  height: auto;
  display: block;
  object-fit: contain;
}

.brin-logo.big { width: min(420px, 82vw); }
.brin-logo.small { width: 92px; }

.app {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(219, 227, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 42px rgba(18, 32, 45, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
}

.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.main-nav select {
  width: auto;
  min-height: 40px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.main-nav a, .nav-login, .admin-tab {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.main-nav a.active, .main-nav a:hover, .nav-login:hover, .admin-tab.active {
  background: var(--soft);
  color: var(--green);
}

.page { display: none; padding-top: 22px; }
.page.active { display: block; }
.page:target { display: block; }

body:has(.page:target) .page.active:not(:target) {
  display: none;
}

body:has(#beranda:target) .main-nav a[href="#beranda"],
body:has(#kamus:target) .main-nav a[href="#kamus"],
body:has(#multimedia:target) .main-nav a[href="#multimedia"],
body:has(#tentang:target) .main-nav a[href="#tentang"],
body:has(#hak-cipta:target) .main-nav a[href="#hak-cipta"] {
  background: var(--soft);
  color: var(--green);
}

.hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  display: grid;
  align-content: center;
  padding: 38px 0;
  font-family: var(--home-font);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 750px;
  margin-bottom: 18px;
  font-size: var(--home-title-size);
  line-height: 0.93;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 3.5vw, 3.1rem);
  line-height: 1.04;
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: var(--home-text-size);
  line-height: 1.7;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

.primary-button, .ghost-button, .danger-button, .icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
}

.primary-button:hover { background: #0d5748; }
.ghost-button { padding: 0 14px; background: #eef4f3; color: var(--ink); }
.danger-button { padding: 0 14px; background: #fff1f1; color: var(--red); }
.compact { min-height: 34px; font-size: 0.88rem; }
.icon-button { width: 42px; background: #eef4f3; color: var(--ink); font-size: 1.2rem; }

.hero-visual {
  position: relative;
  min-height: 520px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(14, 145, 140, 0.92), rgba(18, 108, 90, 0.8)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cpath d='M0 180 C 60 120, 100 210, 160 138 S 230 90, 240 130 L240 240 L0 240 Z' fill='%23ffffff' fill-opacity='.20'/%3E%3Ccircle cx='52' cy='48' r='34' fill='%23f3c15d' fill-opacity='.75'/%3E%3Cpath d='M35 108 Q120 42 205 106 Q126 145 35 108Z' fill='%23ffffff' fill-opacity='.18'/%3E%3C/svg%3E");
  background-size: cover, 240px 240px;
  box-shadow: var(--shadow);
}

.language-card {
  position: absolute;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(7, 43, 39, 0.24);
}

.language-card.main {
  left: 36px;
  right: 36px;
  bottom: 42px;
  padding: 28px;
}

.language-card.main span { color: var(--green); font-weight: 900; }
.language-card.main strong { display: block; margin: 10px 0; font-size: clamp(2.6rem, 7vw, 5.2rem); line-height: 0.95; }
.language-card.main small { color: var(--muted); font-size: 1.05rem; }
.language-card.mini { padding: 14px 18px; font-weight: 900; }
.language-card.top { top: 42px; right: 42px; }
.language-card.bottom { top: 142px; left: 44px; }

.stats-band, .admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.stats-band article, .admin-stats article, .settings-card, .about-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  padding: 20px;
}

.stats-band strong, .admin-stats strong {
  display: block;
  color: var(--green);
  font-size: 2rem;
}

.stats-band span, .admin-stats span, .about-panel li, .about-layout p { color: var(--muted); }

.section-block { margin-top: 30px; }
.section-title.wide { max-width: 780px; }

.featured-grid, .media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.word-card, .media-card, .admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.word-card button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.word-card strong, .entry-detail h3 { display: block; font-size: 1.7rem; margin-bottom: 8px; }
.word-card span, .entry-summary, .media-card p { color: var(--muted); line-height: 1.55; }

.dictionary-layout {
  display: grid;
  grid-template-columns: 280px minmax(260px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.dictionary-tools, .dictionary-results, .entry-detail, .admin-sidebar, .admin-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.dictionary-tools, .dictionary-results, .entry-detail { padding: 16px; }
.dictionary-tools { display: grid; gap: 14px; position: sticky; top: 106px; }
.dictionary-tools label, .modal-form label, .content-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.search-box {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-box input { border: 0; outline: 0; min-width: 0; width: 100%; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline-color: var(--teal);
}

input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

.alpha-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.alpha-filter button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #eef4f3;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}
.alpha-filter button.active { background: var(--green); color: #fff; }

.result-head, .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
  background: #eef4f3;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.entry-list, .admin-list { display: grid; gap: 10px; }
.entry-button {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  background: #f7faf9;
  text-align: left;
  cursor: pointer;
}
.entry-button.active, .entry-button:hover { background: var(--soft); }
.entry-button strong { font-size: 1.15rem; }
.entry-button span { color: var(--muted); }

.entry-detail { min-height: 560px; }
.entry-detail .category-pill, .media-type {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1d4e89;
  font-size: 0.8rem;
  font-weight: 900;
}

.detail-section { padding: 15px 0; border-top: 1px solid var(--line); }
.detail-section span { display: block; margin-bottom: 7px; color: var(--green); font-weight: 900; font-size: 0.78rem; text-transform: uppercase; }
.detail-section p { color: var(--muted); line-height: 1.65; margin-bottom: 0; }
.media-preview { display: grid; gap: 10px; margin-top: 12px; }
.media-preview img, .media-card img, .media-preview video, .media-card video {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1f5f9;
}
audio { width: 100%; }

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
  padding: 40px 0;
}

.about-panel ul { padding-left: 20px; margin-bottom: 0; }

.admin-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
}

.admin-sidebar {
  position: sticky;
  top: 106px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.admin-tab { text-align: left; }
.admin-content { min-height: 560px; padding: 18px; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-row p { margin: 4px 0 0; color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content-form, .rules-form, .dynamic-fields, .settings-form { display: grid; gap: 12px; margin-bottom: 16px; }

.logout-button {
  margin-top: 8px;
  justify-content: center;
  border: 1px solid rgba(180, 35, 24, 0.18);
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.rule-row strong,
.rule-row small {
  display: block;
}

.rule-row small {
  margin-top: 3px;
  color: var(--muted);
}

.rule-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.rule-toggle input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.assignment-row {
  grid-template-columns: 1fr;
}

.assignment-row .rule-toggle {
  justify-content: flex-start;
}

.copyright-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.copyright-row strong {
  color: var(--green);
}

.copyright-row span {
  color: var(--muted);
  line-height: 1.5;
}

.app-footer {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto 22px;
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog[open] {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  max-height: min(90vh, 760px);
  overflow: auto;
}

dialog::backdrop { background: rgba(15, 23, 42, 0.45); }

.modal-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.modal-form header, .modal-form footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-form h2 { margin: 0; font-size: 1.4rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-weight: 800; }

@media (max-width: 980px) {
  .site-header, .hero, .dictionary-layout, .about-layout, .admin-shell {
    grid-template-columns: 1fr;
  }
  .site-header { display: grid; }
  .main-nav { justify-content: start; }
  .hero { min-height: auto; }
  .hero-visual { min-height: 420px; }
  .dictionary-tools, .admin-sidebar { position: static; }
  .featured-grid, .media-grid, .stats-band, .admin-stats { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app { width: min(100% - 18px, 560px); padding-top: 8px; }
  .site-header { top: 8px; }
  .brand { min-width: 0; }
  .brand small { display: none; }
  .main-nav a, .nav-login { padding: 8px 9px; font-size: 0.9rem; }
  h1 { font-size: 3rem; }
  .hero-visual { min-height: 360px; }
  .language-card.main { left: 18px; right: 18px; bottom: 22px; padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-row { display: grid; }
  .row-actions { justify-content: start; }
  .rule-row { grid-template-columns: 1fr; }
  .copyright-row { grid-template-columns: 1fr; }
}
