:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-elevated: #1a1a1a;
  --text: #e5e5e5;
  --text-muted: #888888;
  --text-dim: #3a3a3a;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-glow: rgba(124,58,237,0.22);
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --border: #1e1e1e;
  --border-light: #2a2a2a;
  --r: 1rem;
  --rl: 1.5rem;
  --rxl: 2rem;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.35s ease;
}
body.ready { opacity: 1; }
button { touch-action: manipulation; }
.hidden { display: none !important; }

/* ===== LOADING ===== */
#loadScreen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1.2rem;
  z-index: 9999;
  transition: opacity 0.3s ease;
}
#loadScreen.out { opacity: 0; pointer-events: none; }
.load-logo { width: 64px; height: 64px; object-fit: contain; border-radius: 14px; }
.load-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== AUTH ===== */
.auth-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at 50% -5%, rgba(124,58,237,0.14) 0%, transparent 55%);
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--rxl);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.55);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo-img {
  width: 72px; height: 72px; object-fit: contain; border-radius: 18px;
  margin-bottom: 0.9rem; display: block; margin-left: auto; margin-right: auto;
}
.auth-logo h1 {
  font-size: 1.85rem; font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-logo p { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.25rem; }
.auth-tabs {
  display: flex; background: var(--bg-elevated);
  border-radius: var(--r); padding: 0.3rem; gap: 0.25rem; margin-bottom: 1.5rem;
}
.auth-tab-btn {
  flex: 1; background: transparent; border: none;
  color: var(--text-muted); font-family: inherit;
  font-size: 0.9rem; font-weight: 500;
  padding: 0.65rem; border-radius: calc(var(--r) - 4px);
  cursor: pointer; transition: all 0.2s; min-height: 44px;
}
.auth-tab-btn.active { background: var(--accent); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field label {
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.form-field input {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.85rem 1rem;
  font-size: 1rem; font-family: inherit; color: var(--text); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; min-height: 52px;
}
.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-submit-btn {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border: none; color: white; font-family: inherit;
  font-size: 1rem; font-weight: 600; padding: 0.9rem;
  border-radius: var(--r); cursor: pointer; margin-top: 0.5rem;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 4px 18px var(--accent-glow); min-height: 52px;
}
.auth-submit-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.auth-submit-btn:active { transform: scale(0.98); }
.auth-error {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.28);
  border-radius: var(--r); padding: 0.7rem 1rem;
  font-size: 0.85rem; color: #fca5a5; display: none;
  animation: shake 0.35s ease;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}

/* ===== MAIN APP ===== */
.app { min-height: 100vh; padding: 1.25rem; max-width: 900px; margin: 0 auto; }
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 1.75rem; padding: 0.85rem 1.25rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl);
  position: sticky; top: 0.75rem; z-index: 100;
  backdrop-filter: blur(12px);
}
.app-header-logo {
  display: flex; align-items: center; gap: 0.55rem;
  font-size: 1.15rem; font-weight: 800;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.header-logo-img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.app-header-right { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.app-username { font-size: 0.8rem; color: var(--text-muted); }
.app-username strong { color: var(--text); }
.header-btn {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-muted); font-family: inherit;
  font-size: 0.78rem; font-weight: 500;
  padding: 0.45rem 1rem; border-radius: 2rem;
  cursor: pointer; transition: all 0.2s;
  min-height: 36px; white-space: nowrap;
}
.header-btn:hover { color: var(--text); }
.header-btn.logout:hover { border-color: var(--red); color: #fca5a5; }
.header-btn.admin-btn { color: #fcd34d; border-color: rgba(252,211,77,0.2); }
.header-btn.admin-btn:hover { background: rgba(252,211,77,0.07); color: #fde68a; }

/* ===== ADMIN PANEL ===== */
.admin-wrap {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.38s cubic-bezier(0.2,0.9,0.4,1), opacity 0.3s ease;
  margin-bottom: 0;
}
.admin-wrap.open { max-height: 6000px; opacity: 1; margin-bottom: 1.5rem; }
.admin-panel {
  background: var(--bg-card); border: 1px solid rgba(252,211,77,0.18);
  border-radius: var(--rxl); padding: 1.6rem;
}
.admin-title { font-size: 1.05rem; font-weight: 700; color: #fcd34d; margin-bottom: 1.25rem; }
.admin-tabs {
  display: flex; gap: 0.4rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light); padding-bottom: 0;
}
.admin-tab {
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-family: inherit; font-size: 0.82rem; font-weight: 500;
  padding: 0.5rem 1rem; cursor: pointer; transition: all 0.2s;
  margin-bottom: -1px;
}
.admin-tab.active { color: #fcd34d; border-bottom-color: #fcd34d; }
.admin-tab:hover:not(.active) { color: var(--text); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
.admin-empty { text-align: center; color: var(--text-muted); padding: 2rem; font-size: 0.9rem; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 0.6rem 0.85rem; text-align: left;
  border-bottom: 1px solid var(--border-light);
}
.users-table td {
  padding: 0.85rem 0.85rem; font-size: 0.84rem;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr { transition: background 0.15s; }
.users-table tr:hover td { background: rgba(255,255,255,0.02); }
.status-badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 2rem;
  font-size: 0.68rem; font-weight: 600;
}
.status-badge.active { background: rgba(16,185,129,0.1); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.18); }
.status-badge.suspended { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.18); }
.uact {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-muted); font-family: inherit; font-size: 0.68rem;
  padding: 0.22rem 0.55rem; border-radius: 2rem; cursor: pointer;
  transition: all 0.18s; margin-left: 0.2rem; min-height: 28px;
}
.uact.s:hover { border-color: #f59e0b; color: #fcd34d; }
.uact.r:hover { border-color: var(--green); color: #6ee7b7; }
.uact.d:hover { border-color: var(--red); color: #fca5a5; }

/* ===== CONTENT MANAGEMENT ===== */
.cm-section { margin-bottom: 1.5rem; }
.cm-section-title {
  font-size: 0.85rem; font-weight: 600; color: var(--accent-light);
  margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.cm-list { display: flex; flex-direction: column; gap: 0.4rem; }
.cm-item {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.65rem 0.9rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem;
}
.cm-item-name { font-weight: 500; }
.cm-item-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.1rem; }
.cm-btn {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-muted); font-family: inherit; font-size: 0.68rem;
  padding: 0.22rem 0.55rem; border-radius: 2rem; cursor: pointer;
  transition: all 0.18s; min-height: 28px; white-space: nowrap;
}
.cm-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.cm-add-btn {
  background: rgba(124,58,237,0.1); border: 1px dashed rgba(124,58,237,0.35);
  color: var(--accent-light); font-family: inherit; font-size: 0.8rem;
  padding: 0.5rem 1rem; border-radius: var(--r); cursor: pointer;
  transition: all 0.2s; width: 100%; margin-top: 0.5rem;
}
.cm-add-btn:hover { background: rgba(124,58,237,0.15); }
.cm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.cm-modal {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--rxl); padding: 1.75rem; width: 100%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
}
.cm-modal-title { font-size: 1rem; font-weight: 700; color: #fcd34d; margin-bottom: 1.25rem; }
.cm-field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.cm-field label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.cm-field input, .cm-field textarea {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.7rem 0.9rem;
  font-size: 0.9rem; font-family: inherit; color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.cm-field input:focus, .cm-field textarea:focus { border-color: var(--accent); }
.cm-field textarea { min-height: 80px; resize: vertical; }
.cm-modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }
.cm-save-btn {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border: none; color: white; font-family: inherit; font-size: 0.85rem; font-weight: 600;
  padding: 0.6rem 1.4rem; border-radius: 2rem; cursor: pointer;
}
.cm-cancel-btn {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-muted); font-family: inherit; font-size: 0.85rem;
  padding: 0.6rem 1.2rem; border-radius: 2rem; cursor: pointer;
}

/* ===== VIEWS ===== */
.view { will-change: opacity, transform; }

/* ===== SUBJECTS GRID ===== */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.subject-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 1.5rem 1rem;
  text-align: center; cursor: pointer; transition: all 0.22s;
}
.subject-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.subject-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.subject-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.25rem; }
.subject-status { font-size: 0.7rem; color: var(--text-muted); }
.subject-card.coming-soon { opacity: 0.5; cursor: not-allowed; }
.subject-card.coming-soon:hover { transform: none; border-color: var(--border); box-shadow: none; }

/* ===== SECTIONS ===== */
.sections-grid { display: grid; gap: 0.6rem; }
.section-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 1rem 1.3rem;
  display: flex; align-items: center; justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.section-card.clickable {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(59,130,246,0.06));
  border-color: rgba(124,58,237,0.28);
}
.section-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); border-color: var(--accent-light); }
.section-card.clickable:active { transform: scale(0.99); }
.section-card.inactive { opacity: 0.35; cursor: not-allowed; }
.section-info { display: flex; align-items: center; gap: 0.85rem; }
.section-num {
  width: 2.3rem; height: 2.3rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0.65rem; font-weight: 800; font-size: 0.95rem;
}
.section-card.clickable .section-num { background: linear-gradient(135deg, var(--accent), var(--blue)); color: white; }
.section-card.inactive .section-num { background: var(--bg-elevated); color: var(--text-dim); }
.section-title { font-weight: 600; font-size: 0.93rem; }
.section-sub { font-size: 0.73rem; color: var(--text-muted); margin-top: 0.1rem; }
.section-badge { font-size: 0.68rem; padding: 0.2rem 0.62rem; border-radius: 2rem; font-weight: 500; white-space: nowrap; }
.section-card.clickable .section-badge { background: rgba(124,58,237,0.16); color: var(--accent-light); }
.section-card.inactive .section-badge { background: var(--bg-elevated); color: var(--text-dim); }

/* ===== CATEGORIES ===== */
.view-header { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.back-btn {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-muted); font-family: inherit; font-size: 0.82rem;
  padding: 0.5rem 1rem; border-radius: 2rem; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; min-height: 40px;
}
.back-btn:hover { color: var(--text); border-color: var(--accent); }
.back-btn:active { transform: scale(0.97); }
.view-title { font-size: 1.15rem; font-weight: 700; }
.categories-grid { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 1rem 1.15rem;
  cursor: pointer; transition: all 0.22s;
  flex: 1 1 190px; max-width: calc(50% - 0.35rem);
}
.category-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 20px var(--accent-glow); }
.category-card:active { transform: scale(0.98); }
.cat-en { font-weight: 600; font-size: 0.9rem; }
.cat-pl { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.12rem; }
.cat-count { font-size: 0.66rem; color: var(--accent-light); margin-top: 0.45rem; }

/* ===== QUIZ ===== */
.quiz-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rxl); padding: 1.75rem;
}
.stats-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 0.9rem; margin-bottom: 1.5rem;
  padding-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.progress-area { flex: 2; min-width: 130px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 0.45rem;
}
.progress-bar-bg { background: var(--bg-elevated); border-radius: 40px; height: 6px; overflow: hidden; }
.progress-fill {
  background: linear-gradient(90deg, var(--accent), var(--blue));
  width: 0%; height: 100%; border-radius: 40px; transition: width 0.45s ease;
}
.score-box {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 2rem; padding: 0.35rem 1.1rem;
  font-weight: 700; font-size: 0.88rem;
}
.score-box span { color: var(--accent-light); font-size: 1.1rem; }
.cat-badge-pill {
  display: inline-block;
  background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.22);
  border-radius: 2rem; padding: 0.25rem 0.9rem;
  font-size: 0.7rem; font-weight: 500; color: var(--accent-light);
  margin-bottom: 0.65rem;
}
.question-container {
  text-align: center; margin: 1.1rem 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.polish-word {
  font-size: 1.95rem; font-weight: 800;
  background: linear-gradient(135deg, #e5e5e5, var(--accent-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 0.5rem; line-height: 1.2;
}
.question-prompt { font-size: 0.86rem; color: var(--text-muted); }
.answers-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem; margin: 1.1rem 0;
}
.answer-btn {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--rl); padding: 0.9rem 0.7rem;
  font-size: 0.9rem; font-weight: 500; font-family: inherit;
  color: var(--text); cursor: pointer; transition: all 0.18s ease;
  text-align: center; min-height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.answer-btn:hover:not(:disabled) { border-color: var(--accent); background: rgba(124,58,237,0.09); transform: translateY(-1px); }
.answer-btn:active:not(:disabled) { transform: scale(0.97); }
.answer-btn.correct-hl { background: rgba(16,185,129,0.1); border-color: var(--green); color: #6ee7b7; box-shadow: 0 4px 12px rgba(16,185,129,0.12); }
.answer-btn.wrong-hl { background: rgba(239,68,68,0.1); border-color: var(--red); color: #fca5a5; text-decoration: line-through; }
.answer-btn:disabled { cursor: default; }
.feedback-msg {
  text-align: center; font-size: 0.86rem; padding: 0.65rem 1rem;
  border-radius: var(--r); margin: 0.2rem 0 0.65rem;
  font-weight: 500; min-height: 2.5rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.feedback-msg.correct { background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.18); color: #6ee7b7; }
.feedback-msg.wrong { background: rgba(239,68,68,0.07); border: 1px solid rgba(239,68,68,0.18); color: #fca5a5; }
.feedback-msg.empty { background: transparent; border: 1px solid transparent; }
.next-btn-wrap {
  text-align: center; margin-top: 0.2rem;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease; pointer-events: none;
}
.next-btn-wrap.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.next-btn {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  border: none; color: white; font-family: inherit;
  font-size: 1rem; font-weight: 600; padding: 0.8rem 2.5rem;
  border-radius: 3rem; cursor: pointer; min-height: 52px;
  transition: opacity 0.18s, transform 0.18s;
  box-shadow: 0 4px 18px var(--accent-glow);
}
.next-btn:hover { opacity: 0.9; transform: translateY(-2px); }
.next-btn:active { transform: scale(0.97); }
.result-container { text-align: center; padding: 1.25rem 0; }
.result-score {
  font-size: 3rem; font-weight: 800;
  background: linear-gradient(120deg, #e5e5e5, var(--accent-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 0.65rem 0;
}
.result-label { font-size: 0.95rem; color: var(--text-muted); }
.result-btns { display: flex; justify-content: center; gap: 0.7rem; margin-top: 1.4rem; flex-wrap: wrap; }
.play-again-btn, .back-cats-btn {
  border: none; font-family: inherit; font-size: 0.9rem; font-weight: 600;
  padding: 0.8rem 1.75rem; border-radius: 3rem; cursor: pointer;
  transition: all 0.2s; min-height: 52px;
}
.play-again-btn { background: linear-gradient(135deg, var(--accent), var(--blue)); color: white; box-shadow: 0 4px 18px var(--accent-glow); }
.play-again-btn:hover { opacity: 0.9; transform: translateY(-2px); }
.back-cats-btn { background: var(--bg-elevated); border: 1px solid var(--border-light); color: var(--text-muted); }
.back-cats-btn:hover { color: var(--text); border-color: var(--accent); }

/* ===== POLISH CONTENT ===== */
.polish-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.polish-category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 1.5rem 1.2rem;
  cursor: pointer; transition: all 0.22s; text-align: center;
}
.polish-category-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }
.polish-category-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.polish-category-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.4rem; }
.polish-category-desc { font-size: 0.75rem; color: var(--text-muted); }
.polish-content {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 1.5rem;
}
.polish-content h2 { color: var(--accent-light); margin-bottom: 1rem; font-size: 1.4rem; }
.polish-content h3 { color: var(--text); margin: 1.2rem 0 0.6rem; font-size: 1.1rem; }
.polish-content p { line-height: 1.6; margin-bottom: 0.8rem; }
.character-card {
  background: var(--bg-elevated); border-left: 3px solid var(--accent);
  padding: 1rem; margin-bottom: 0.75rem; border-radius: var(--r);
}
.essay-example {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  padding: 1rem; margin: 0.75rem 0; border-radius: var(--r);
}
.motif-card {
  background: var(--bg-elevated); border-left: 3px solid var(--blue);
  padding: 0.75rem 1rem; margin-bottom: 0.5rem; border-radius: var(--r);
}

/* list view for lektury/epoki */
.list-item-card {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--rl); padding: 1rem 1.2rem; margin-bottom: 0.6rem;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: space-between;
}
.list-item-card:hover { border-color: var(--accent); transform: translateX(3px); }
.list-item-title { font-weight: 600; font-size: 0.95rem; }
.list-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }

/* definition cards */
.def-card {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 1rem; margin-bottom: 0.6rem;
}
.def-term { font-weight: 700; color: var(--accent-light); margin-bottom: 0.35rem; }
.def-text { font-size: 0.88rem; line-height: 1.6; color: var(--text); }

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeSlideDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-8px); } }
@keyframes fadeIn        { from { opacity: 0; } to { opacity: 1; } }

footer { text-align: center; font-size: 0.68rem; color: var(--text-dim); margin-top: 2rem; padding-bottom: 1.5rem; }

/* ===== MOBILE ===== */
@media (max-width: 600px) {
  .app { padding: 0.75rem; }
  .app-header { padding: 0.7rem 0.9rem; top: 0.5rem; border-radius: var(--r); }
  .app-header-logo { font-size: 1rem; }
  .header-logo-img { width: 24px; height: 24px; }
  .app-username { display: none; }
  .quiz-panel { padding: 1.1rem; }
  .polish-word { font-size: 1.55rem; }
  .answers-grid { grid-template-columns: 1fr; }
  .answer-btn { min-height: 56px; font-size: 0.95rem; }
  .next-btn { width: 100%; }
  .result-score { font-size: 2.4rem; }
  .play-again-btn, .back-cats-btn { flex: 1 1 140px; }
  .category-card { max-width: 100%; flex: 1 1 100%; }
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .users-table th:nth-child(2),
  .users-table td:nth-child(2) { display: none; }
  .users-table th, .users-table td { padding: 0.6rem 0.5rem; font-size: 0.75rem; }
  .auth-card { padding: 2rem 1.3rem; }
  .auth-logo-img { width: 60px; height: 60px; }
}
@media (max-width: 380px) {
  .users-table th:nth-child(4),
  .users-table td:nth-child(4) { display: none; }
  .subjects-grid { grid-template-columns: 1fr; }
}

/* ===== SEARCH BAR ===== */
.search-bar-wrap { margin-bottom: 1rem; position: relative; }
.search-bar {
  width: 100%; background: var(--bg-elevated);
  border: 1px solid var(--border-light); border-radius: var(--rl);
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  font-size: 0.9rem; font-family: inherit; color: var(--text);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar-icon {
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.search-no-results { text-align: center; color: var(--text-muted); padding: 2rem; font-size: 0.9rem; }

/* ===== ADMIN DASHBOARD (full-page view) ===== */
.admin-view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; padding: 1rem 1.3rem;
  background: var(--bg-card); border: 1px solid rgba(252,211,77,0.2);
  border-radius: var(--rl);
}
.admin-view-title { font-size: 1.15rem; font-weight: 700; color: #fcd34d; }
.admin-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.admin-tile {
  background: var(--bg-card); border: 1px solid rgba(252,211,77,0.15);
  border-radius: var(--rl); padding: 1.5rem 1.1rem;
  cursor: pointer; transition: all 0.22s; text-align: center;
}
.admin-tile:hover {
  border-color: #fcd34d; transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(252,211,77,0.1);
}
.admin-tile.blue { border-color: rgba(59,130,246,0.2); }
.admin-tile.blue:hover { border-color: var(--blue); box-shadow: 0 8px 24px rgba(59,130,246,0.12); }
.admin-tile.coming { opacity: 0.45; cursor: default; }
.admin-tile.coming:hover { transform: none; box-shadow: none; border-color: rgba(252,211,77,0.15); }
.admin-tile-icon { font-size: 2.2rem; margin-bottom: 0.65rem; }
.admin-tile-name { font-weight: 700; font-size: 0.98rem; margin-bottom: 0.2rem; }
.admin-tile-desc { font-size: 0.68rem; color: var(--text-muted); }
.admin-tile-badge {
  display: inline-block; margin-top: 0.4rem;
  background: rgba(124,58,237,0.12); color: var(--accent-light);
  border-radius: 2rem; padding: 0.15rem 0.6rem; font-size: 0.65rem; font-weight: 500;
}
.admin-tile.blue .admin-tile-badge { background: rgba(59,130,246,0.12); color: #93c5fd; }

/* ===== ADMIN SUBJECT EDITOR ===== */
.chapter-list { display: flex; flex-direction: column; gap: 0.65rem; }
.chapter-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--rl); padding: 1.1rem 1.25rem;
  transition: border-color 0.2s;
}
.chapter-card:hover { border-color: rgba(252,211,77,0.25); }
.chapter-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.chapter-title { font-weight: 600; font-size: 0.95rem; flex: 1; }
.chapter-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.chapter-content-preview {
  font-size: 0.79rem; color: var(--text-muted); margin-top: 0.5rem; line-height: 1.5;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.chapter-files { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; align-items: center; }
.file-chip {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 2rem; padding: 0.22rem 0.65rem;
  font-size: 0.7rem; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.file-chip-del {
  cursor: pointer; color: #fca5a5; background: none; border: none;
  font-family: inherit; font-size: 0.8rem; padding: 0; line-height: 1; margin-left: 0.1rem;
}
.file-chip-del:hover { color: var(--red); }
.upload-label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: rgba(124,58,237,0.08); border: 1px dashed rgba(124,58,237,0.3);
  border-radius: 2rem; padding: 0.22rem 0.75rem;
  font-size: 0.7rem; color: var(--accent-light); cursor: pointer;
  transition: all 0.2s;
}
.upload-label:hover { background: rgba(124,58,237,0.14); }
.upload-label input[type=file] { display: none; }

/* ===== CONTENT SUBJECT (user view) ===== */
.content-subject-chapter {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--rl); margin-bottom: 0.6rem; overflow: hidden;
}
.content-chapter-header {
  padding: 1rem 1.25rem; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: background 0.18s;
}
.content-chapter-header:hover { background: rgba(255,255,255,0.025); }
.content-chapter-title { font-weight: 600; font-size: 0.95rem; }
.content-chapter-arrow { color: var(--text-muted); font-size: 0.9rem; transition: transform 0.28s; }
.content-chapter-arrow.open { transform: rotate(180deg); }
.content-chapter-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.38s cubic-bezier(0.2,0.9,0.4,1);
}
.content-chapter-inner { padding: 0 1.25rem 1.25rem; }
.content-chapter-text { font-size: 0.88rem; line-height: 1.75; white-space: pre-wrap; margin-bottom: 1rem; }
.file-download-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.download-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.5rem 1rem;
  font-size: 0.82rem; color: var(--text-muted);
  text-decoration: none; transition: all 0.2s; cursor: pointer;
}
.download-btn:hover { border-color: var(--accent); color: var(--accent-light); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 0.9rem; }
.empty-state-text { font-size: 0.9rem; line-height: 1.6; }

/* ===== ADMIN USERS VIEW ===== */
.admin-users-panel {
  background: var(--bg-card); border: 1px solid rgba(252,211,77,0.15);
  border-radius: var(--rxl); padding: 1.4rem;
}

/* ===== CHAPTER FORMAT SELECTOR ===== */
.cm-format-select { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cm-format-opt {
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 2rem; padding: 0.45rem 1rem;
  font-size: 0.8rem; cursor: pointer; transition: all 0.18s;
  user-select: none;
}
.cm-format-opt input[type=radio] { display: none; }
.cm-format-opt.active {
  background: rgba(124,58,237,0.15); border-color: var(--accent);
  color: var(--accent-light);
}

/* ===== CUSTOM FIELDS ===== */
.cm-add-field-btn {
  width: 100%; background: transparent;
  border: 1px dashed rgba(124,58,237,0.35); border-radius: var(--r);
  padding: 0.55rem 1rem; font-size: 0.78rem;
  color: var(--accent-light); cursor: pointer;
  font-family: inherit; transition: all 0.18s; margin-top: 0.25rem;
}
.cm-add-field-btn:hover { background: rgba(124,58,237,0.08); border-color: var(--accent); }
.cm-custom-field {
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.75rem 0.85rem; margin-bottom: 0.5rem;
}
.cm-cf-header { display: flex; gap: 0.5rem; margin-bottom: 0.45rem; align-items: center; }
.cm_cf_label {
  flex: 1; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.45rem 0.7rem;
  font-size: 0.82rem; color: var(--text-primary); font-family: inherit;
  transition: border-color 0.2s;
}
.cm_cf_label:focus { border-color: var(--accent); outline: none; }
.cm_cf_value {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--r); padding: 0.6rem 0.8rem;
  font-size: 0.82rem; color: var(--text-primary); font-family: inherit;
  min-height: 80px; resize: vertical; box-sizing: border-box;
  transition: border-color 0.2s;
}
.cm_cf_value:focus { border-color: var(--accent); outline: none; }
.cm-del-field-btn {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--r); padding: 0.4rem 0.65rem;
  font-size: 0.68rem; color: #fca5a5; cursor: pointer;
  font-family: inherit; transition: all 0.18s; white-space: nowrap;
}
.cm-del-field-btn:hover { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.4); }

/* ===== CHAPTER CARD META ===== */
.chapter-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; align-items: center; }
.chapter-fmt-badge {
  font-size: 0.68rem; background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.22); border-radius: 2rem;
  padding: 0.1rem 0.6rem; color: var(--accent-light);
}
.chapter-meta-tag {
  font-size: 0.66rem; color: var(--text-muted);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 2rem; padding: 0.1rem 0.55rem;
}
.chapter-cf-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.45rem 0 0.5rem; }
.chapter-cf-chip {
  font-size: 0.68rem; background: rgba(34,211,238,0.07);
  border: 1px solid rgba(34,211,238,0.18); border-radius: 2rem;
  padding: 0.1rem 0.6rem; color: #67e8f9;
}

/* ===== CONTENT CUSTOM FIELDS (user view) ===== */
.content-chapter-format { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }
.content-custom-field { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.content-cf-label {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent-light); margin-bottom: 0.4rem;
}
.content-cf-value { font-size: 0.88rem; line-height: 1.75; white-space: pre-wrap; color: var(--text-secondary); }

@media (max-width: 600px) {
  .admin-dash-grid { grid-template-columns: repeat(2, 1fr); }
  .content-chapter-text { font-size: 0.85rem; }
  .cm-format-select { flex-direction: column; }
}
@media (max-width: 380px) {
  .admin-dash-grid { grid-template-columns: 1fr; }
}
