
:root {
  --bg: #080d1a;
  --panel: #111a2e;
  --ink: #e8efff;
  --muted: #8d9bb8;
  --line: #24314b;

  --purple: #528bff;
  --purple2: #172b4d;

  --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 #293b60;
  background: linear-gradient(
    140deg,
    #15213a 0%,
    #0d1629 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 #528bff;
}

.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, #1a2c4b, #101a30);
}

.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: #528bff;
  box-shadow: 0 0 0 3px #528bff25;
}

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,
    #172b52,
    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 #293b60;
  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;
  }
}
