@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Space+Grotesk:wght@400;500;700&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green: #22c55e;
  --green-dark: #16a34a;
  --green-light: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #ef4444;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --surface: #f1f5f9;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
}

/* ---- LOGO ---- */
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--text);
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
}

.logo span {
  color: var(--green);
}

.logo-under {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.logo-under span {
  display: inline-block;
  width: 60px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.tagline {
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1.8rem;
}

/* ---- SCORE BAR ---- */
.score-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.score-chip {
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--text-muted);
}

.score-chip b {
  color: var(--text);
}

/* ---- CATEGORY BAR ---- */
.cat-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.cat-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  background: var(--card-bg);
  color: var(--text-muted);
  transition: all 0.15s;
}

.cat-btn:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.cat-btn.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* ---- GAME CARD ---- */
.game-card {
  width: 100%;
  max-width: 540px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.8rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: relative;
}

.help-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
  transition: all 0.15s;
}

.help-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ---- HINT BOX ---- */
.hint-box {
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  text-align: center;
}

.hint-label {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 5px;
}

.hint-text {
  font-size: 0.95rem;
  color: #15803d;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.5;
}

/* ---- CATEGORY BADGE ---- */
.cat-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: -6px;
}

/* ---- WORD DISPLAY ---- */
.word-display {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  padding: 1.2rem 1rem;
  background: var(--surface);
  border-radius: 14px;
  min-height: 72px;
}

.letter-slot {
  width: 34px;
  height: 42px;
  border-bottom: 2.5px solid var(--text-muted);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
  font-size: 1.35rem;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  transition: color 0.2s, border-color 0.2s;
}

.letter-slot.revealed {
  color: var(--green-dark);
  border-color: var(--green);
}

.letter-slot.space-slot {
  border: none;
  width: 14px;
}

/* ---- HEARTS ---- */
.hearts {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.heart {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s, opacity 0.2s;
}

.heart.lost {
  opacity: 0.18;
  transform: scale(0.8);
}

/* ---- INPUT ROW ---- */
.input-row {
  display: flex;
  gap: 8px;
}

.guess-input {
  flex: 1;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.guess-input:focus {
  border-color: var(--green);
}

.guess-input:disabled {
  opacity: 0.5;
}

.btn-submit {
  padding: 11px 22px;
  border-radius: 12px;
  background: var(--green);
  border: none;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.15s, transform 0.1s;
}

.btn-submit:hover {
  background: var(--green-dark);
}

.btn-submit:active {
  transform: scale(0.97);
}

/* ---- BOTTOM ROW ---- */
.bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.btn-buka {
  padding: 9px 18px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: all 0.15s;
}

.btn-buka:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green-dark);
}

.btn-buka:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.points-pill {
  background: var(--green-light);
  border: 1.5px solid var(--green-border);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--green-dark);
  white-space: nowrap;
}

/* ---- TOAST ---- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
  pointer-events: none;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--green);
  color: #fff;
}

.toast.error {
  background: var(--red);
  color: #fff;
}

.toast.info {
  background: var(--blue);
  color: #fff;
}

.toast.warn {
  background: var(--amber);
  color: #fff;
}

/* ---- RESULT OVERLAY ---- */
.result-overlay {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--card-bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
  z-index: 10;
  padding: 2rem;
}

.result-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.r-emoji {
  font-size: 4rem;
  line-height: 1;
}

.r-title {
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
}

.r-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.r-word {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-dark);
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 3px;
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 8px 24px;
}

.r-pts {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-next {
  margin-top: 4px;
  padding: 12px 32px;
  border-radius: 12px;
  background: var(--green);
  border: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.15s, transform 0.1s;
}

.btn-next:hover {
  background: var(--green-dark);
}

.btn-next:active {
  transform: scale(0.97);
}

/* ---- HELP MODAL ---- */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-bg.show {
  display: flex;
}

.modal {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  position: relative;
}

.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.modal ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal li b {
  color: var(--text);
}

.btn-close-modal {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--surface);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-close-modal:hover {
  background: var(--border);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  .letter-slot {
    width: 28px;
    font-size: 1.1rem;
  }

  .game-card {
    padding: 1.2rem;
  }
}