
:root {
  --bg: #080d1a;
  --panel: #111a2e;
  --ink: #e8efff;
  --muted: #8d9bb8;
  --line: #24314b;

  --purple: #e8455a;
  --purple2: #3a1a26;

  --green: #35d39a;
  --greenbg: #10382f;

  --red: #ff7185;
  --redbg: #3c1d2a;

  --shadow: 0 18px 50px #00000035;
}

/* =========================
   RESET & DASAR
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui,
    -apple-system, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 700;
  transition: 0.15s;
}

button:hover {
  transform: translateY(-1px);
}

/* =========================
   WARNA TOMBOL
========================= */

.primary {
  background: var(--purple);
  color: white;
}

.soft {
  background: var(--purple2);
  color: var(--purple);
}

.outline {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}

.danger {
  background: var(--redbg);
  color: var(--red);
}

.good {
  background: var(--greenbg);
  color: var(--green);
}

/* =========================
   UTILITAS
========================= */

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 12px;
}

.right {
  margin-left: auto;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* =========================
   LAYOUT UTAMA
========================= */

.wrap {
  max-width: 1120px;
  margin: auto;
  padding: 22px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 19px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: var(--purple);
  color: white;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.userline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
}

/* =========================
   PANEL & KARTU
========================= */

.side,
.panel,
.stat,
.authbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.side {
  padding: 12px;
  height: max-content;
  position: sticky;
  top: 15px;
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.heading h1 {
  font-size: 27px;
  margin: 0 0 4px;
  letter-spacing: -0.8px;
}

/* =========================
   NAVIGASI
========================= */

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  background: transparent;
  color: var(--muted);
  text-align: left;
  margin: 3px 0;
  text-decoration: none;
  padding: 11px 15px;
  border-radius: 12px;
  font-weight: 700;
}

.nav.active {
  background: var(--purple2);
  color: var(--purple);
}

.side-note {
  margin: 18px 8px 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   STATISTIK
========================= */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 17px 18px;
}

.stat .num {
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -1px;
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   FLASHCARD
========================= */

.flash-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.progress {
  height: 6px;
  border-radius: 10px;
  background: #202c44;
  overflow: hidden;
  margin: 12px 0 22px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--purple);
  width: 0;
  transition: width 0.2s;
}

.card-scene {
  perspective: 1200px;
  min-height: 270px;
}

.flashcard {
  min-height: 270px;
  border: 1px solid #4a2a3a;
  background: linear-gradient(
    140deg,
    #2a1522 0%,
    #16101c 100%
  );
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.75, 0.25, 1);
  outline: none;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard:focus-visible {
  outline: 3px solid #e8455a;
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 22px;
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(140deg, #3a1c2e, #1a1022);
}

.korean {
  font-size: clamp(35px, 6vw, 58px);
  font-weight: 850;
  letter-spacing: 1px;
  line-height: 1.2;
  margin: 14px 0;
}

.meaning {
  font-size: 25px;
  font-weight: 750;
  margin: 12px 0;
}

.tap {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.actions button {
  padding: 14px;
}

/* =========================
   FORM & INPUT
========================= */

.field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.field:focus {
  border-color: #e8455a;
  box-shadow: 0 0 0 3px #e8455a25;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 6px;
}

.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.formgrid .full {
  grid-column: 1 / -1;
}

/* =========================
   TABEL KOSAKATA
========================= */

.tablewrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 750;
}

td .hangul {
  font-size: 18px;
  font-weight: 800;
}

/* =========================
   STATUS KOSAKATA
========================= */

.pill {
  display: inline-block;
  border-radius: 100px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
}

.pill.known {
  background: var(--greenbg);
  color: var(--green);
}

.pill.review {
  background: var(--redbg);
  color: var(--red);
}

.pill.new {
  background: #202b42;
  color: #a8b9d8;
}

/* =========================
   PENCARIAN & PESAN KOSONG
========================= */

.searchrow {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.searchrow input {
  flex: 1;
  min-width: 0;
}

.empty {
  text-align: center;
  padding: 35px 10px;
  color: var(--muted);
}

/* =========================
   LOGIN & REGISTER
========================= */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(
    ellipse at top left,
    #3a1626,
    transparent 50%
  ), var(--bg);
}

.authbox {
  width: min(430px, 100%);
  padding: 30px;
}

.authbox h1 {
  margin: 18px 0 4px;
  font-size: 27px;
}

.authbox .logo {
  width: 50px;
  height: 50px;
}

.auth-tabs {
  margin-top: 22px;
}

.notice {
  padding: 11px 13px;
  border-radius: 12px;
  background: #352e1b;
  color: #f5d68b;
  font-size: 12px;
  margin-top: 15px;
}

.message {
  font-size: 13px;
  margin-top: 10px;
  color: var(--red);
}

.database-note {
  font-size: 13px;
  background: #111a2e;
  border: 1px solid #4a2a3a;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 15px;
}

/* =========================
   TOAST & TOMBOL KECIL
========================= */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #111a2e;
  color: white;
  padding: 12px 17px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 5;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.barline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.smallbtn {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 12px;
}

/* =========================
   MODE BELAJAR
========================= */

.study-tools {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.direction-select {
  width: auto;
  min-width: 190px;
  padding: 10px 12px;
}

.study-tools label {
  font-size: 12px;
  color: var(--muted);
}

/* =========================
   RESPONSIVE / MOBILE
========================= */

@media (max-width: 760px) {
  .wrap {
    padding: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    display: flex;
    overflow: auto;
    gap: 4px;
    padding: 7px;
  }

  .nav {
    white-space: nowrap;
    width: auto;
    margin: 0;
    padding: 10px 12px;
  }

  .side-note {
    display: none;
  }

  .stats {
    gap: 8px;
  }

  .stat {
    padding: 13px;
  }

  .stat .num {
    font-size: 23px;
  }

  .panel {
    padding: 16px;
  }

  .heading h1 {
    font-size: 23px;
  }

  .top {
    margin-bottom: 18px;
  }

  .formgrid {
    grid-template-columns: 1fr;
  }

  .formgrid .full {
    grid-column: auto;
  }

  .study-tools {
    justify-content: stretch;
  }

  .study-tools button {
    flex: 1;
  }

  .direction-select {
    flex: 1;
    min-width: 160px;
  }
}


/* =========================
   HALAMAN PILIH MATERI
   Terisolasi agar tidak mengubah halaman latihan/login
========================= */
.material-page {
  width: 100%;
}

.material-page > h1 {
  margin: 0 0 24px;
  font-size: 34px;
  line-height: 1.3;
  letter-spacing: -0.8px;
}

.material-subtitle {
  margin: 0 0 15px;
  color: var(--muted);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.material-card {
  display: block;
  min-height: 232px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}

.material-card:hover {
  transform: translateY(-3px);
  border-color: var(--purple);
}

.material-icon {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.4;
}

.material-icon.book-icon {
  font-size: 34px;
}

.material-card h2 {
  margin: 20px 0 22px;
  font-size: 22px;
  line-height: 1.35;
}

.material-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

.material-card strong {
  font-size: 14px;
  font-weight: 800;
}

.material-page .notice {
  margin-top: 15px;
}

@media (max-width: 760px) {
  .material-page > h1 {
    font-size: 27px;
    margin-bottom: 16px;
  }

  .material-grid {
    grid-template-columns: 1fr;
  }

  .material-card {
    min-height: 190px;
    padding: 20px;
  }
}

.footer {
        margin-top: 50px;
        padding: 30px 20px 20px;
        text-align: center;
        background: var(--panel, #111a2e);
        color: var(--ink, #e8efff);
        border-top: 1px solid var(--line, #24314b);
        font-size: 14px;
    }

    .footer-logo {
        font-size: 19px;
        font-weight: bold;
        margin-bottom: 10px;
    }

    .footer p {
        color: var(--muted, #8d9bb8);
        line-height: 1.7;
        margin: 0 auto 20px;
        max-width: 450px;
    }

    .footer-info {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px 24px;
        margin-bottom: 20px;
    }

    .footer-bottom {
        border-top: 1px solid var(--line, #24314b);
        padding-top: 15px;
        color: var(--muted, #8d9bb8);
        font-size: 12px;
    }
/* ===== Tambahan versi Jepang ===== */
.logo{font-family:"Noto Sans JP","Hiragino Sans","Yu Gothic",sans-serif}
.jp{font-family:"Noto Sans JP","Hiragino Sans","Yu Gothic","Meiryo",sans-serif}
.reading{font-size:20px;color:var(--muted);margin:2px 0}
.speak{background:transparent;color:var(--muted);font-size:20px;padding:4px 10px;margin-top:6px}
.brandlink{color:inherit;text-decoration:none}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.pill.known{cursor:default}
td .jpword{font-size:20px;font-weight:800}
.hint{font-size:12px;color:var(--muted);margin-top:10px;text-align:center}
.footer-info span{color:var(--muted)}
