/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Nunito", sans-serif;
}

:root {
  --primary: #ff6b6b;
  --primary-light: #ff8e8e;
  --primary-dark: #e85555;
  --orange: #ff9a3c;
  --yellow: #ffd166;
  --green: #06d6a0;
  --blue: #118ab2;
  --purple: #7b4fbf;
  --pink: #ff6bb3;
  --bg: #fff5f0;
  --bg-card: #ffffff;
  --text: #2d2d2d;
  --text-muted: #888888;
  --shadow: 0 3px 12px rgba(255, 107, 107, 0.15);
}

body.dark-mode {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --text: #eaeaea;
  --text-muted: #aaaaaa;
  --shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

/* ===== APP CONTAINER ===== */
#app {
  max-width: 420px;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ===== MAIN CONTENT ===== */
#main-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
#main-content.hidden {
  display: none;
}

/* ===== PAGE PANELS ===== */
.page-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.hidden-panel {
  display: none !important;
}

/* ===== WELCOME SCREEN ===== */
#welcome-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff9a3c 50%, #ffd166 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 2rem;
}
#welcome-screen.hidden {
  display: none;
}

.welcome-logo {
  font-size: 5rem;
  margin-bottom: 0.6rem;
  animation: bounce 1.2s infinite alternate;
}
@keyframes bounce {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-14px);
  }
}
.welcome-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  margin-bottom: 0.3rem;
}
.welcome-sub {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.4rem;
}
.welcome-card {
  background: white;
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}
.welcome-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.2rem;
  text-align: center;
}
.welcome-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #ffd166;
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  color: #333;
  transition: border-color 0.2s;
}
.welcome-input:focus {
  border-color: #ff6b6b;
}
.welcome-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 1rem;
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.welcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}
.welcome-btn:active {
  transform: scale(0.97);
}

/* auth strip di welcome card */
.auth-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.auth-strip-text {
  font-size: 0.82rem;
  color: #888;
}
.auth-strip-dot {
  color: #ccc;
  font-size: 0.82rem;
}
.auth-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #ff6b6b;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:active {
  opacity: 0.7;
}

/* ===== MODAL AUTH ===== */
#modal-auth {
  z-index: 1000;
}
.auth-box {
  max-width: 340px;
  padding: 0;
  overflow: hidden;
}
.auth-box .modal-header {
  padding: 16px 16px 0;
  border-bottom: none;
  align-items: center;
}
.auth-tabs {
  display: flex;
  gap: 0;
  flex: 1;
  background: #f5f5f5;
  border-radius: 10px;
  padding: 3px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: #999;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: white;
  color: #ff6b6b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.auth-panel {
  flex-direction: column;
  padding: 18px 20px 22px;
  gap: 12px;
  display: flex;
}
.auth-icon {
  font-size: 2rem;
  text-align: center;
}
.auth-desc {
  font-size: 0.82rem;
  color: #888;
  text-align: center;
  line-height: 1.4;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.auth-field label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #555;
}
.auth-input {
  padding: 11px 14px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  color: #333;
  transition: border-color 0.2s;
}
.auth-input:focus {
  border-color: #ff6b6b;
}
.auth-error {
  font-size: 0.78rem;
  color: #ff6b6b;
  font-weight: 700;
  min-height: 16px;
  text-align: center;
}
.auth-submit-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
  transition: transform 0.15s;
}
.auth-submit-btn:active {
  transform: scale(0.97);
}
.auth-note {
  font-size: 0.72rem;
  color: #aaa;
  text-align: center;
  line-height: 1.4;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(255, 107, 107, 0.3);
  flex-shrink: 0;
}
.header-logo {
  font-size: 1.5rem;
}
.header-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  flex: 1;
  margin-left: 8px;
  letter-spacing: -0.3px;
}
.header-greeting {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  padding: 5px 13px;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.header-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  margin-right: 6px;
  flex-shrink: 0;
}
.header-back:active {
  transform: scale(0.92);
}

/* ===== PROFILE CARD ===== */
.profile-card {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 22px 16px;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 10px;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
}
.profile-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}
.profile-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
}
.profile-status.premium {
  background: linear-gradient(135deg, #ffd166, #f9a825);
  color: white;
}

/* ===== SENTENCE BAR (mini card mode) ===== */
.sentence-bar {
  background: var(--bg-card);
  margin: 8px 10px 0;
  border-radius: 16px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  border: 2px solid #ffd166;
  flex-shrink: 0;
}

.sentence-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sentence-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.sentence-bar-btns {
  display: flex;
  gap: 5px;
}

.btn-speak-small {
  padding: 4px 10px;
  background: linear-gradient(135deg, #06d6a0, #118ab2);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-speak-small:active {
  transform: scale(0.95);
}

.btn-clear-small {
  padding: 4px 8px;
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-clear-small:active {
  transform: scale(0.95);
}

/* Mini cards row */
.sentence-mini-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 46px;
  align-items: flex-start;
  align-content: flex-start;
}

.sentence-placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  align-self: center;
}

/* Each mini card in sentence bar */
.mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: linear-gradient(135deg, #fff5ee, white);
  border: 1.5px solid #ffd166;
  border-radius: 10px;
  padding: 3px 5px;
  cursor: pointer;
  position: relative;
  animation: popIn 0.18s ease;
  transition: transform 0.12s;
  min-width: 44px;
  max-width: 56px;
}
.mini-card:active {
  transform: scale(0.9);
}
@keyframes popIn {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.mini-card-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.mini-card-emoji {
  font-size: 1.1rem;
  line-height: 1;
  height: 28px;
  display: flex;
  align-items: center;
}

.mini-card-label {
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.1;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-card-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: #ff6b6b;
  color: white;
  border-radius: 50%;
  font-size: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.mini-card:hover .mini-card-remove {
  opacity: 1;
}

/* ===== STICKY TABS ===== */
.sticky-tabs {
  flex-shrink: 0;
  background: var(--bg);
}

/* ===== CATEGORY TABS ===== */
.cat-tabs {
  display: flex;
  gap: 5px;
  padding: 7px 10px 5px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
  color: var(--text-muted);
}
.cat-tab.active {
  color: white;
  border-color: transparent;
}
.cat-tab[data-cat="kata"].active {
  background: linear-gradient(135deg, #7b4fbf, #118ab2);
}

.cat-tab[data-cat="aktivitas"].active {
  background: linear-gradient(135deg, #ff9a3c, #ffd166);
  color: #7a4500;
}

.cat-tab[data-cat="makanan"].active {
  background: linear-gradient(135deg, #ff9a3c, #ffd166);
  color: #7a4500;
}

.cat-tab[data-cat="favorit"].active {
  background: linear-gradient(135deg, #ff9a3c, #ffd166);
  color: #7a4500;
}
.cat-tab[data-cat="buatSendiri"].active {
  background: linear-gradient(135deg, #ff9a3c, #ffd166);
  color: #7a4500;
}
.cat-tab[data-cat="minuman"].active {
  background: linear-gradient(135deg, #06d6a0, #118ab2);
}
.cat-tab[data-cat="buah"].active {
  background: linear-gradient(135deg, #06d6a0, #7b4fbf);
}
.cat-tab[data-cat="perasaan"].active {
  background: linear-gradient(135deg, #ff6bb3, #7b4fbf);
}
.cat-tab[data-cat="kendaraan"].active {
  background: linear-gradient(135deg, #118ab2, #06d6a0);
}
.cat-tab[data-cat="benda"].active {
  background: linear-gradient(135deg, #ff6b6b, #7b4fbf);
}
.cat-tab[data-cat="tempat"].active {
  background: linear-gradient(135deg, #ff9a3c, #ff6b6b);
}

/* ===== CARDS SCROLL WRAPPER ===== */
.cards-scroll-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ===== CARDS GRID — 4 columns ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 6px 10px 90px;
}

.word-card {
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  transition:
    transform 0.12s,
    box-shadow 0.12s;
  user-select: none;
  animation: fadeSlideIn 0.25s ease both;
  overflow: hidden;
  width: 100%;
}
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.word-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.word-card:active {
  transform: scale(0.92);
}
.word-card.speaking {
  animation: cardPulse 0.35s ease;
}
@keyframes cardPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

.word-card.cat-makanan {
  border-color: #ffd166;
  background: linear-gradient(145deg, #fff9ee, white);
}

.word-card.cat-aktivitas {
  border-color: #ffd166;
  background: linear-gradient(145deg, #fff9ee, white);
}

.word-card.cat-minuman {
  border-color: #06d6a0;
  background: linear-gradient(145deg, #eefff9, white);
}
.word-card.cat-buah {
  border-color: #06d6a0;
  background: linear-gradient(145deg, #eefff9, white);
}
.word-card.cat-perasaan {
  border-color: #ff6bb3;
  background: linear-gradient(145deg, #fff0f8, white);
}
.word-card.cat-kata {
  border-color: #7b4fbf;
  background: linear-gradient(145deg, #f5f0ff, white);
}
.word-card.cat-kendaraan {
  border-color: #118ab2;
  background: linear-gradient(145deg, #eef5ff, white);
}
.word-card.cat-benda {
  border-color: #ff6b6b;
  background: linear-gradient(145deg, #fff0f0, white);
}
.word-card.cat-tempat {
  border-color: #ff9a3c;
  background: linear-gradient(145deg, #fff5ee, white);
}

.card-emoji {
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}
.card-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  width: 100%;
  padding: 0 2px;
}

/* image inside card */
.card-image-webp {
  width: 82%;
  height: 82%;
  object-fit: contain;
  background: transparent;
  display: block;
  margin: 0 auto;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-top: 1.5px solid rgba(0, 0, 0, 0.07);
  justify-content: space-around;
  padding: 6px 2px 12px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s;
  border: none;
  background: none;
  font-family: inherit;
  flex: 1;
  min-width: 0;
}
.nav-item .nav-icon {
  font-size: 1.35rem;
}
.nav-item .nav-label {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  word-break: keep-all;
}
.nav-item.active .nav-label {
  color: var(--primary);
}
.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(255, 107, 107, 0.6));
}

/* ===== KEYBOARD PAGE ===== */
#page-keyboard {
  overflow-y: auto;
  padding: 0 0 90px;
}

/* KB sub-tabs */
.kb-tabs {
  display: flex;
  gap: 0;
  padding: 10px 10px 0;
  flex-shrink: 0;
}
.kb-tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  border-radius: 0;
}
.kb-tab:first-child {
  border-radius: 12px 0 0 0;
}
.kb-tab:last-child {
  border-radius: 0 12px 0 0;
}
.kb-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-card);
}

.kb-subpanel {
  padding: 10px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== KEYBOARD CARD ===== */
.keyboard-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.keyboard-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.keyboard-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 2px solid #ffd166;
  border-radius: 14px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  resize: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.keyboard-textarea:focus {
  border-color: var(--primary);
}
.keyboard-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.btn-keyboard-speak {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, #06d6a0, #118ab2);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.15s;
  box-shadow: 0 4px 14px rgba(6, 214, 160, 0.35);
}
.btn-keyboard-speak:active {
  transform: scale(0.97);
}
.btn-keyboard-add {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform 0.15s;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
}
.btn-keyboard-add:active {
  transform: scale(0.97);
}
.btn-keyboard-clear {
  padding: 12px 14px;
  background: var(--bg);
  border: 2px solid #ddd;
  color: var(--text-muted);
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn-keyboard-clear:active {
  transform: scale(0.97);
}

/* ===== QUICK PHRASES ===== */
.keyboard-quick-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.quick-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-chip {
  padding: 7px 13px;
  background: var(--bg);
  border: 2px solid #ffd166;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.quick-chip:hover {
  background: #fff9ee;
  border-color: var(--primary);
  color: var(--primary);
}
.quick-chip:active {
  transform: scale(0.94);
}

/* delete btn on custom chips */
.chip-del {
  background: none;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  font-family: inherit;
}
.chip-del:hover {
  opacity: 1;
}

.empty-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== SETTINGS PAGE ===== */
/* (lihat bagian bawah untuk definisi lengkap) */
.settings-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.settings-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.settings-row:last-child {
  margin-bottom: 0;
}
.settings-row label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
}
.settings-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #ffd166;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.settings-input:focus {
  border-color: var(--primary);
}
.save-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
  transition: transform 0.15s;
}
.save-btn:active {
  transform: scale(0.97);
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
  cursor: pointer;
}
.slider-val {
  font-weight: 800;
  color: var(--primary);
  font-size: 0.9rem;
  min-width: 30px;
  text-align: right;
}
.test-voice-btn {
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}
.test-voice-btn:hover {
  background: rgba(255, 107, 107, 0.06);
}
.theme-btns {
  display: flex;
  gap: 10px;
}
.theme-btn {
  flex: 1;
  padding: 11px;
  border-radius: 14px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-btn.light-btn {
  background: #fff5f0;
  color: #ff6b6b;
  border-color: #ff6b6b;
}
.theme-btn.dark-btn {
  background: #1a1a2e;
  color: #ffd166;
  border-color: #ffd166;
}
.theme-btn.active {
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.25);
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-box {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.stat-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* ===== SPEAKING INDICATOR ===== */
.speaking-indicator {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 107, 107, 0.95);
  color: white;
  padding: 9px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 9999;
  display: none;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}
.speaking-indicator.show {
  display: block;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* scrollbar */
.cards-scroll-wrapper::-webkit-scrollbar {
  width: 4px;
}
.cards-scroll-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 107, 0.3);
  border-radius: 4px;
}

/* ===== BUAT SENDIRI CARD ===== */
.word-card.cat-buatSendiri {
  border-color: #ff6bb3;
  background: linear-gradient(145deg, #fff0f8, white);
  position: relative;
}
.add-card-btn {
  border: 2.5px dashed #ff6bb3 !important;
  background: transparent !important;
  opacity: 0.7;
}
.add-card-btn:hover {
  opacity: 1;
}

/* hapus tombol di sudut kartu buatan */
.card-del-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 0.5rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.word-card:hover .card-del-btn {
  opacity: 1;
}

/* bintang di kartu yang sudah favorit */
.word-card.is-fav::after {
  content: "⭐";
  position: absolute;
  top: -4px;
  left: -4px;
  font-size: 0.65rem;
  line-height: 1;
}

/* empty cat message */
.empty-cat-msg {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* kelola favorit bar */
.manage-fav-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}
.btn-manage-fav {
  padding: 8px 20px;
  background: linear-gradient(135deg, #ffd166, #ff9a3c);
  color: #7a4500;
  border: none;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(255, 154, 60, 0.35);
  transition: transform 0.15s;
}
.btn-manage-fav:active {
  transform: scale(0.95);
}

/* ===== MODAL BASE ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0;
}
.modal-overlay.show {
  display: flex;
  animation: fadeInOverlay 0.2s ease;
}
@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-box {
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: slideUpModal 0.25s ease;
  overflow: hidden;
}
@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-box-fav {
  max-height: 92vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1.5px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.modal-close {
  width: 28px;
  height: 28px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 800;
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 16px 20px;
  display: flex;
  gap: 8px;
  border-top: 1.5px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
.modal-btn-cancel {
  flex: 1;
  padding: 12px;
  background: var(--bg);
  border: 2px solid #ddd;
  color: var(--text-muted);
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}
.modal-btn-save {
  flex: 2;
  padding: 12px;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.35);
  transition: transform 0.15s;
}
.modal-btn-save:active {
  transform: scale(0.97);
}

/* ===== BUAT KARTU MODAL ===== */
.buat-preview {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.buat-preview-card {
  width: 80px;
  height: 80px;
  background: linear-gradient(145deg, #fff0f8, white);
  border: 2.5px solid #ff6bb3;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 3px 12px rgba(255, 107, 107, 0.15);
}
.buat-preview-emoji {
  font-size: 2rem;
  line-height: 1;
}
.buat-preview-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.buat-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.buat-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}
.buat-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #ffd166;
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}
.buat-input:focus {
  border-color: var(--primary);
}
.buat-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===== FAVORIT MODAL ===== */
.fav-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fav-current-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: flex-start;
  align-content: flex-start;
}
.fav-current-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1.5px solid #ffd166;
  border-radius: 20px;
  padding: 4px 8px 4px 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
}
.mini-fav-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.mini-fav-emoji {
  font-size: 0.9rem;
  line-height: 1;
}
.fav-chip-label {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* tabs di modal favorit */
.fav-modal-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  padding: 2px 0;
}
.fav-modal-tab {
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  border: 2px solid #ddd;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.fav-modal-tab.active {
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  border-color: transparent;
}

/* grid kartu di modal favorit */
.fav-modal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.fav-pick-card {
  aspect-ratio: 1/1;
  background: var(--bg-card);
  border-radius: 12px;
  border: 2px solid #ddd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.12s,
    border-color 0.15s;
  overflow: hidden;
  padding: 4px;
}
.fav-pick-card:active {
  transform: scale(0.9);
}
.fav-pick-card.picked {
  border-color: #ffd166;
  background: linear-gradient(145deg, #fff9ee, white);
}
.fav-pick-emoji {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}
.fav-pick-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}
.fav-pick-check {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #ff9a3c;
  line-height: 1;
}

/* ===== PAGE INNER SCROLL (favorit & buat sendiri pages) ===== */
.page-inner-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 10px 90px;
  display: flex;
  flex-direction: column;
}

.page-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding: 0 2px;
}

/* favorit card color */
.word-card.cat-favorit {
  border-color: #ff6bb3;
  background: linear-gradient(145deg, #fff9ee, white);
}

/* scrollbar for page-inner-scroll */
.page-inner-scroll::-webkit-scrollbar {
  width: 4px;
}
.page-inner-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 107, 107, 0.3);
  border-radius: 4px;
}

/* ===== SETTINGS FIX — pastikan bisa scroll sampai bawah ===== */
#page-settings {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.settings-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 12px env(safe-area-inset-bottom, 0px);
  padding-bottom: max(env(safe-area-inset-bottom, 0px) + 80px, 100px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

/* ===== WELCOME DESC ===== */
.welcome-desc {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  max-width: 280px;
  margin: -6px auto 14px;
  line-height: 1.5;
  font-style: italic;
}

/* ===== SETTINGS SELECT (Jenis Suara, Jeda) ===== */
.settings-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  background: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  margin-top: 4px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.dark-mode .settings-select {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: #2a2a2a;
}

/* ===== TENTANG MODAL ===== */
.tentang-box {
  padding: 0;
  max-height: 80vh;
  overflow-y: auto;
}
.tentang-body {
  padding: 20px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.tentang-logo {
  font-size: 3rem;
  margin-bottom: 4px;
}
.tentang-appname {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 10px;
}
.tentang-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.tentang-divider {
  width: 40px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  margin: 0 auto 14px;
  opacity: 0.4;
}
.tentang-p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}
.tentang-contact {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-main);
  border-radius: 10px;
  margin-bottom: 8px;
}
.tentang-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.tentang-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}
a.tentang-value {
  color: var(--primary);
}

/* ===== TOAST ANIMATIONS ===== */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.92);
  }
}

.stat-divider {
  height: 1px;
  background: var(--bg);
  margin: 14px 0;
}
.stat-sub-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* ===== HALAMAN ORANG TUA ===== */
.parent-section {
  margin-bottom: 0;
}

.parent-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.parent-section-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg);
}
.parent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 0.82rem;
}
.parent-row:last-child {
  border-bottom: none;
}
.parent-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ff9a3c);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.parent-item {
  flex: 1;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.3;
}
.parent-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}
.parent-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 64px;
}
.parent-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 0;
}

/* ===== CHART 7 HARI ===== */
.activity-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 90px;
  padding-top: 4px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: 100%;
}
.chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(to top, #667eea, #764ba2);
  transition: height 0.4s ease;
}
.chart-num {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  min-height: 12px;
}
.chart-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== JAM AKTIF ===== */
.hour-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.hour-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  transition: background 0.2s;
}
.hour-box.hour-active {
  background: linear-gradient(135deg, #667eea22, #764ba222);
}
.hour-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}
.hour-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 2px 0;
}
.hour-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: #667eea;
}

/* ===== TOMBOL LOGOUT ===== */
.logout-btn {
  width: 100%;
  padding: 13px;
  margin-bottom: 12px;
  background: none;
  border: 2px solid #ff6b6b;
  border-radius: 14px;
  color: #ff6b6b;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:active {
  background: #ff6b6b;
  color: white;
}
