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

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable] {
  user-select: text;
  -webkit-user-select: text;
}

html {
  height: 100%;
  font-size: 16px;
}

body {
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ─── App container ─────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  position: relative;
}

/* ─── Screens ────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 100dvh;
  padding: 0;
  animation: screenIn 0.25s ease;
}

.screen.active {
  display: flex;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Typography ─────────────────────────────────────────── */
h1 { font-family: 'Fredoka One', cursive; font-size: 2.4rem; line-height: 1.1; }
h2 { font-family: 'Fredoka One', cursive; font-size: 1.7rem; }
h3 { font-family: 'Nunito', sans-serif; font-size: 1.1rem; font-weight: 700; }

.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.text-sm     { font-size: 0.85rem; }
.font-bold   { font-weight: 700; }
.font-title  { font-family: 'Fredoka One', cursive; }

/* ─── Layout helpers ─────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }

.p-4  { padding: 1rem; }
.p-5  { padding: 1.25rem; }
.p-6  { padding: 1.5rem; }
.px-4 { padding-inline: 1rem; }
.py-3 { padding-block: 0.75rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }

/* ─── Screen padding helper ─────────────────────────────── */
.screen-body {
  flex: 1;
  padding: 1rem 1rem 6rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Header ─────────────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.screen-header h2 {
  font-size: 1.25rem;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Gradient text ──────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-input);
  color: var(--text-muted);
}

/* ─── Divider ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

/* ─── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 360px;
  width: calc(100% - 2rem);
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success { border-color: var(--color-success); color: var(--color-success); }
.toast.error   { border-color: var(--color-danger);  color: var(--color-danger); }
.toast.info    { border-color: var(--color-primary);  color: var(--color-primary); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ── Credits footer ─────────────────────────────────────────── */
.credits {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.credits a {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.credits a:hover { color: var(--color-primary); }

.credits svg {
  width: 1rem;
  height: 1rem;
}
