/* ============================================================= */
/*  Yomikaze – stílusok                                          */
/* ============================================================= */

:root {
  color-scheme: dark;

  --bg: #0b0b12;
  --bg-elev: #12121c;
  --surface: #16161f;
  --surface-2: #1e1e2b;
  --surface-3: #262636;
  --border: #2a2a3d;
  --border-soft: #22222f;

  --text: #ecedf5;
  --muted: #9a9ab4;
  --faint: #6b6b85;

  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --accent-grad: linear-gradient(100deg, #7c3aed, #db2777);
  --accent-soft: rgba(139, 92, 246, 0.14);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

  --header-h: 64px;
  --bottomnav-h: 62px;
  --maxw: 1200px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* Görgetősáv */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 20px; border: 2px solid var(--bg); }

/* ============================================================= */
/*  Fejléc                                                        */
/* ============================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: rgba(11, 11, 18, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: #fff; background: var(--accent-grad); border-radius: 12px;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.04); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name {
  font-size: 20px; font-weight: 750; letter-spacing: -0.02em;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Kereső */
.search {
  position: relative;
  flex: 1;
  max-width: 520px;
  margin: 0 auto;
  min-width: 120px;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--faint); pointer-events: none;
}
#search-input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s var(--ease);
}
#search-input::-webkit-search-decoration,
#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-results-button,
#search-input::-webkit-search-results-decoration { display: none; }
#search-input::placeholder { color: var(--faint); }
#search-input:focus {
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transform: translateY(-1px);
}
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted); line-height: 1;
  transition: background 0.18s, color 0.18s, transform 0.18s var(--ease);
}
.search-clear svg { width: 15px; height: 15px; }
.search-clear:hover { background: var(--accent); color: #fff; transform: translateY(-50%) rotate(90deg); }

.quick-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; z-index: 60; padding: 6px;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}
.quick-results.open { opacity: 1; transform: translateY(0) scale(1); }
.quick-results[hidden] { display: none; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-sm); transition: background 0.15s, transform 0.15s var(--ease); }
.quick-item:hover, .quick-item.active { background: var(--surface-2); transform: translateX(2px); }
.quick-item img { width: 38px; height: 54px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: var(--surface-3); }
.quick-item .qi-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.quick-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

.top-nav { display: flex; gap: 4px; flex-shrink: 0; }
.top-nav a {
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted);
  transition: color 0.2s, background 0.2s, transform 0.18s var(--ease);
}
.top-nav a:hover { color: var(--text); background: var(--surface-2); transform: translateY(-1px); }
.top-nav a.active { color: #fff; background: var(--accent-soft); }

/* ============================================================= */
/*  Fő elrendezés                                                */
/* ============================================================= */
.app {
  --px: clamp(14px, 3vw, 28px);
  --pt: clamp(16px, 3vw, 28px);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--pt) var(--px) 60px;
  min-height: calc(100vh - var(--header-h));
}

.section { margin-bottom: 42px; animation: sectionIn 0.4s var(--ease) both; }
@keyframes sectionIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-title { font-size: clamp(18px, 2.4vw, 23px); font-weight: 750; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.section-title .dot { width: 8px; height: 22px; border-radius: 6px; background: var(--accent-grad); }
.section-sub { color: var(--muted); font-size: 14px; }

/* Chip szűrők */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  transition: all 0.18s;
}
.chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.chip.active { background: var(--accent-soft); color: #fff; border-color: var(--accent); }

/* ============================================================= */
/*  Manga rács + kártyák                                          */
/* ============================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(12px, 2vw, 20px);
}

.card { display: block; cursor: pointer; animation: cardIn 0.36s var(--ease) both; }
.grid .card:nth-child(2n) { animation-delay: 0.03s; }
.grid .card:nth-child(3n) { animation-delay: 0.06s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease), opacity 0.4s; }
.card:hover .card-cover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card:hover .card-cover img { transform: scale(1.06); }
.card-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent 45%);
  opacity: 0; transition: opacity 0.3s;
}
.card:hover .card-cover::after { opacity: 1; }
.card-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); color: #fff;
}
.card-badge.rank { background: var(--accent-grad); }
.card-title {
  margin-top: 9px; font-size: 13.5px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

/* Skeleton töltés */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; border-radius: 6px; margin-top: 8px; }

/* ============================================================= */
/*  Series részletek                                             */
/* ============================================================= */
/* Hero bleeds edge-to-edge exactly as far as the page padding (no overflow bug). */
.series-hero { position: relative; margin: calc(var(--pt) * -1) calc(var(--px) * -1) 24px; padding: var(--pt) var(--px); overflow: hidden; }
.series-hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(40px) saturate(1.3); opacity: 0.28; transform: scale(1.2);
}
.series-hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(11,11,18,0.5), var(--bg) 92%); }
.series-top { position: relative; z-index: 1; display: flex; gap: clamp(16px, 3vw, 30px); align-items: flex-start; }
.series-cover {
  width: clamp(130px, 26vw, 220px); flex-shrink: 0; aspect-ratio: 2/3;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg);
  background: var(--surface-2);
}
.series-cover img { width: 100%; height: 100%; object-fit: cover; }
.series-info { flex: 1; min-width: 0; padding-top: 4px; }
.series-info h1 { margin: 0 0 10px; font-size: clamp(21px, 3.5vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.series-meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: #d9c9ff; border-color: transparent; }
.pill.ongoing { color: #6ee7b7; }
.pill.adult { color: #fca5a5; border-color: #7f1d1d; }
.series-author { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.series-author b { color: var(--text); font-weight: 600; }
.series-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.tag { padding: 4px 11px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-soft); transition: 0.15s; }
.tag:hover { color: #fff; border-color: var(--accent); }
.series-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 14.5px;
  transition: all 0.2s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn:disabled { opacity: 0.58; cursor: wait; transform: none; }
.btn svg { width: 18px; height: 18px; }
.rtool:active, .reader-back:active, .modal-close:active { transform: scale(0.92); }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(124,58,237,0.4); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-icon { padding: 12px; }
.btn.active-fav { background: var(--accent-soft); border-color: var(--accent); color: #d9c9ff; }

.series-desc { position: relative; z-index: 1; margin: 22px 0; color: #c9cad8; font-size: 15px; line-height: 1.7; max-width: 820px; white-space: pre-wrap; }
.series-desc.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.desc-toggle { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 14px; padding: 4px 0; }

/* Fejezetlista */
.chapters-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; flex-wrap: wrap; }
.chapters-count { color: var(--muted); font-size: 14px; }
.ch-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; height: 38px; }
.ch-search span { display: flex; color: var(--faint); }
.ch-search span svg { width: 16px; height: 16px; }
.ch-search input { background: none; border: 0; outline: none; color: var(--text); font-size: 14px; width: 130px; }
.chapter-list { display: flex; flex-direction: column; gap: 6px; }
.chapter-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px;
  transition: all 0.15s;
}
.chapter-row:hover { background: var(--surface-2); border-color: var(--accent); transform: translateX(3px); }
.chapter-row.read { opacity: 0.55; }
.chapter-row .ch-ic { display: flex; color: var(--accent); flex-shrink: 0; }
.chapter-row .ch-ic svg { width: 18px; height: 18px; }
.chapter-row .ch-name { font-weight: 600; flex: 1; }
.chapter-row .ch-date { color: var(--faint); font-size: 12.5px; }
.chapter-row .ch-read-mark { color: var(--accent); font-size: 12px; font-weight: 700; }
.load-more { display: block; margin: 24px auto; }

/* ============================================================= */
/*  Üres állapotok, üzenetek                                     */
/* ============================================================= */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon {
  width: 76px; height: 76px; margin: 0 auto 16px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--accent);
}
.empty-icon svg { width: 34px; height: 34px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 19px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 40px auto; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: calc(var(--bottomnav-h) + 18px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); color: var(--text); padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-lg); z-index: 200; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); opacity: 0; transition: all 0.3s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================= */
/*  Alsó navigáció (mobil)                                       */
/* ============================================================= */
.bottomnav { display: none; }

/* ============================================================= */
/*  Auth / header chip                                            */
/* ============================================================= */
#auth-slot { display: inline-flex; align-items: center; margin-left: 6px; }
.auth-btn {
  padding: 8px 16px; border-radius: 999px; font-weight: 650; font-size: 14px;
  background: var(--accent-grad); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,0.4);
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 600; font-size: 14px; max-width: 170px;
}
.auth-chip:hover { border-color: var(--accent); }
.auth-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-3); flex-shrink: 0; }
.avatar-fallback { display: grid; place-items: center; color: var(--muted); }
.avatar-fallback svg { width: 60%; height: 60%; }

/* Login / register */
.auth-wrap { min-height: 60vh; display: grid; place-items: center; padding: 20px 0; }
.auth-card {
  width: min(94vw, 380px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-lg); text-align: center;
  animation: pop 0.25s var(--ease);
}
.auth-logo { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-grad); }
.auth-logo svg { width: 28px; height: 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.field {
  width: 100%; height: 46px; padding: 0 16px; margin-bottom: 12px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 15px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.btn.block { width: 100%; margin-top: 4px; }
.form-err { color: #f87171; font-size: 13.5px; min-height: 1.2em; margin-top: 8px; }
.auth-switch { margin-top: 18px; color: var(--muted); font-size: 14px; }
.auth-switch a { color: var(--accent); font-weight: 600; }

/* Profile */
.profile { max-width: 640px; margin: 0 auto; }
.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.profile-avatar { position: relative; border: 0; background: none; padding: 0; border-radius: 50%; cursor: pointer; flex-shrink: 0; }
.profile-avatar .avatar { width: 104px; height: 104px; border: 3px solid var(--surface-3); }
.profile-avatar:hover .avatar { border-color: var(--accent); }
.avatar-edit {
  position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center; border: 3px solid var(--bg);
}
.avatar-edit svg { width: 16px; height: 16px; color: #fff; }
.profile-name { margin: 0 0 2px; font-size: 26px; font-weight: 800; }
.profile-handle { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.profile-stats { display: flex; gap: 18px; font-size: 14px; color: var(--muted); }
.profile-stats b { color: var(--text); }

.settings-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.settings-card-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-weight: 700; margin-bottom: 14px; }
.field-row { display: flex; gap: 10px; align-items: center; }
.field-row .field { margin-bottom: 0; }
.field-row .btn { flex-shrink: 0; }
.inline-msg { font-size: 13px; }
.inline-msg.ok { color: #6ee7b7; }
.inline-msg.err { color: #f87171; }
.profile-actions { margin-top: 6px; }
.btn-danger { background: rgba(220,38,38,0.12); border-color: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: rgba(220,38,38,0.22); }

/* Modal + avatar picker */
.modal-overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: fadein 0.2s var(--ease);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(96vw, 760px); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.25s var(--ease);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border-soft); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 22px; line-height: 1; transition: 0.15s; }
.modal-close:hover { background: var(--accent); color: #fff; }

/* Avatar picker: category tabs + per-anime groups with character names */
.avatar-tabs { flex-shrink: 0; display: flex; gap: 8px; padding: 14px 22px 12px; overflow-x: auto; border-bottom: 1px solid var(--border-soft); }
.avatar-tab {
  flex-shrink: 0; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600;
  white-space: nowrap; transition: 0.15s;
}
.avatar-tab:hover { color: var(--text); border-color: var(--accent); }
.avatar-tab.active { background: var(--accent-soft); color: #fff; border-color: var(--accent); }

.avatar-body { flex: 1; overflow-y: auto; padding: 8px 22px 26px; }
.avatar-group { margin-top: 20px; }
.avatar-group-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 14.5px; font-weight: 700; margin-bottom: 12px;
}
.avatar-group-title .dot { width: 6px; height: 17px; border-radius: 4px; background: var(--accent-grad); }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 14px 8px; }

.avatar-pick {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  border: 0; padding: 4px 2px; background: none; cursor: pointer; border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.avatar-pick:hover { background: var(--surface-2); }
.avatar-pick-img {
  width: 68px; height: 68px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--surface-3);
  transition: border-color 0.15s, transform 0.2s var(--ease);
}
.avatar-pick:hover .avatar-pick-img { border-color: var(--accent); transform: scale(1.06); }
.avatar-pick-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.avatar-pick-name {
  font-size: 11.5px; line-height: 1.25; color: var(--muted); text-align: center;
  max-width: 92px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.avatar-pick:hover .avatar-pick-name { color: var(--text); }

/* ============================================================= */
/*  Badges, notices, 2FA, misc form polish                        */
/* ============================================================= */
.badge {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle;
}
.badge.ok { background: rgba(16,185,129,0.14); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.35); }
.badge.warn { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.35); }

.notice { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; line-height: 1.5; }
.notice.warn { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.notice.ok { background: rgba(16,185,129,0.09); border: 1px solid rgba(16,185,129,0.28); color: #6ee7b7; }

.settings-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.card-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 12px; }
.settings-card .field { margin-bottom: 12px; }

.btn-ghost { background: none; border-color: var(--border); color: var(--muted); margin-top: 10px; }
.btn-ghost:hover { color: var(--text); }
.code-input { letter-spacing: 0.35em; text-align: center; font-size: 19px; font-weight: 700; }

.qr-box {
  width: 216px; padding: 12px; margin: 4px 0 14px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow);
}
.qr-box svg { display: block; width: 100%; height: auto; }
.secret-code {
  display: inline-block; padding: 3px 9px; border-radius: 8px; background: var(--bg-elev);
  border: 1px solid var(--border); font-size: 12.5px; letter-spacing: 0.06em; color: #d9c9ff;
  word-break: break-all; user-select: all;
}
.profile-email { color: var(--muted); }

/* ============================================================= */
/*  Community: rating + comments                                  */
/* ============================================================= */
.social-body { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; }
.rating-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stars { display: flex; gap: 2px; }
.star { width: 34px; height: 34px; padding: 4px; border: 0; background: none; color: var(--faint); transition: color 0.12s, transform 0.12s; }
.star svg { width: 100%; height: 100%; }
.star:hover { transform: scale(1.15); }
.star.filled { color: #fbbf24; }
.star.filled svg { fill: #fbbf24; }
.rating-info { color: var(--muted); font-size: 14px; }
.star-mini { display: inline-flex; width: 13px; height: 13px; color: #fbbf24; vertical-align: -2px; margin-right: 2px; }
.star-mini svg { fill: #fbbf24; }

.comment-form { margin-bottom: 20px; }
.comment-input {
  width: 100%; padding: 12px 16px; margin-bottom: 10px; resize: vertical; min-height: 74px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); font: inherit; font-size: 14.5px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.comment-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.comment-list { display: flex; flex-direction: column; gap: 14px; }
.comment { display: flex; gap: 12px; padding: 13px 14px; background: var(--bg-elev); border: 1px solid var(--border-soft); border-radius: 12px; animation: sectionIn 0.3s var(--ease); }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.comment-name { font-weight: 700; font-size: 14px; }
.comment-time { color: var(--faint); font-size: 12px; }
.comment-del { margin-left: auto; width: 28px; height: 28px; padding: 5px; border: 0; border-radius: 8px; background: none; color: var(--faint); transition: 0.15s; }
.comment-del svg { width: 100%; height: 100%; }
.comment-del:hover { background: rgba(220,38,38,0.15); color: #fca5a5; }
.comment-body { font-size: 14.5px; line-height: 1.6; color: #c9cad8; white-space: pre-wrap; word-break: break-word; }

/* ============================================================= */
/*  Focus states (keyboard access, consistent everywhere)         */
/* ============================================================= */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible), input:focus:not(:focus-visible) { outline: none; }

/* ============================================================= */
/*  Reader                                                        */
/* ============================================================= */
.reader { position: fixed; inset: 0; z-index: 100; background: #07070b; display: flex; flex-direction: column; }
.reader:fullscreen { width: 100vw; height: 100vh; }
.reader.ui-hidden { cursor: none; }
.reader-viewport { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; -webkit-overflow-scrolling: touch; overflow-anchor: auto; }

/* Webtoon (hosszú csík) */
.reader-strip { display: flex; flex-direction: column; align-items: center; }
.reader-strip img, .reader-paged img { background: var(--surface); }
.reader-strip img { width: 100%; max-width: var(--reader-width, 720px); height: auto; animation: rImgIn 0.4s ease; }
/* Reserve space before load so lazy images don't collapse and jump the scroll. */
.reader-strip img:not(.loaded) { aspect-ratio: 70 / 100; }
@keyframes rImgIn { from { opacity: 0; } to { opacity: 1; } }
/* Page-turn animation (paged mode). */
.reader-paged img.turn { animation: pageTurn 0.28s var(--ease); }
@keyframes pageTurn { from { opacity: 0.35; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }

/* Lapozós mód */
.reader-paged { height: 100%; display: flex; align-items: center; justify-content: center; }
.reader-paged img { max-width: 100%; max-height: 100%; width: auto; height: auto; margin: 0 auto; }
.reader-paged.fit-width img { width: 100%; max-height: none; }
.reader-paged.fit-height img { height: 100%; }

.page-loader { width: 100%; max-width: var(--reader-width, 720px); aspect-ratio: 2/3; display: grid; place-items: center; color: var(--faint); }

/* Tap zónák */
.tap-zones { position: absolute; inset: 0; z-index: 5; display: flex; }
.tap-zone { flex: 1; }
.tap-zone.center { flex: 1.2; }

/* Reader fejléc/lábléc */
.reader-bar { position: absolute; left: 0; right: 0; z-index: 20; background: rgba(10,10,16,0.92); backdrop-filter: blur(12px); transition: transform 0.3s var(--ease), opacity 0.3s; }
.reader-bar.top { top: 0; border-bottom: 1px solid var(--border-soft); padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; }
.reader-bar.bottom { bottom: 0; border-top: 1px solid var(--border-soft); padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.reader.ui-hidden .reader-bar.top { transform: translateY(-100%); opacity: 0; }
.reader.ui-hidden .reader-bar.bottom { transform: translateY(100%); opacity: 0; }

.reader-back { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.reader-back svg { width: 20px; height: 20px; }
.reader-titles { flex: 1; min-width: 0; }
.reader-titles .rt-series { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-titles .rt-chapter { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-tools { display: flex; gap: 6px; flex-shrink: 0; }
.rtool { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface-2); display: grid; place-items: center; transition: 0.15s; }
.rtool:hover { background: var(--surface-3); }
.rtool svg { width: 20px; height: 20px; }

.reader-nav { display: flex; align-items: center; gap: 12px; }
.reader-nav .btn { padding: 10px 16px; flex-shrink: 0; }
.reader-progress { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.reader-progress .rp-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.reader-slider { width: 100%; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: var(--surface-3); outline: none; }
.reader-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer; }
.reader-slider::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer; }

/* Beolvasási sáv (folyamatjelző webtoon módban, felül) */
.read-progress-bar { position: absolute; top: 0; left: 0; height: 3px; background: var(--accent-grad); z-index: 25; transition: width 0.1s linear; }

/* Reader beállítások panel */
.reader-settings {
  position: absolute; z-index: 30; top: 64px; right: 12px; width: min(300px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 16px; transform-origin: top right; transition: opacity 0.2s, transform 0.2s;
}
.reader-settings[hidden] { display: none; }
.rs-group { margin-bottom: 16px; }
.rs-group:last-child { margin-bottom: 0; }
.rs-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin-bottom: 8px; font-weight: 700; }
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; transition: 0.15s; }
.seg button.active { background: var(--accent); color: #fff; }
.rs-range { display: flex; align-items: center; gap: 10px; }
.rs-range input { flex: 1; }

.chapter-select {
  position: absolute; z-index: 30; top: 64px; right: 12px; width: min(320px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.chapter-select[hidden] { display: none; }
.cs-item { display: block; padding: 11px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.cs-item:hover { background: var(--surface-2); color: var(--text); }
.cs-item.current { background: var(--accent-soft); color: #fff; }

/* Fejezet vége panel */
.chapter-end { padding: 60px 20px; text-align: center; background: var(--surface); margin-top: 20px; }
.chapter-end h3 { font-size: 20px; margin: 0 0 6px; }
.chapter-end p { color: var(--muted); margin: 0 0 20px; }
.chapter-end .btn { margin: 0 auto; }

/* ============================================================= */
/*  Reszponzív                                                    */
/* ============================================================= */
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .top-nav { display: none; }
  .brand-name { display: none; }
  .search { margin: 0; }
  body { padding-bottom: var(--bottomnav-h); }

  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; height: var(--bottomnav-h);
    background: rgba(12,12,20,0.94); backdrop-filter: blur(14px); border-top: 1px solid var(--border-soft);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a, .bottomnav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: 0; color: var(--faint); font-size: 11px; font-weight: 600;
    transition: color 0.18s, transform 0.18s var(--ease), background 0.18s;
  }
  .bottomnav svg { width: 24px; height: 24px; }
  .bottomnav a:hover, .bottomnav button:hover { transform: translateY(-2px); }
  .bottomnav .active { color: #fff; background: rgba(139,92,246,0.14); }

  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; }
  .series-top { gap: 14px; }
  .series-actions { width: 100%; }
  .series-actions .btn-primary { flex: 1; }
  .app { padding-bottom: 30px; }
  .chapter-row { align-items: flex-start; }
  .chapter-row .ch-date { margin-left: auto; white-space: nowrap; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .search { max-width: none; }
  #search-input { height: 40px; padding-left: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
