.topbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.topbar-member {
  flex-shrink: 0;
}

.topbar-member-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  background: var(--gradient-card);
  box-shadow: 4px 4px 0 var(--ink);
  transition: 0.18s ease;
  white-space: nowrap;
}

.topbar-member-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
  background: var(--yellow);
}

.topbar-member-btn--guest {
  background: linear-gradient(135deg, var(--yellow), #ffe566);
}

.topbar-member-btn--profile {
  background: linear-gradient(135deg, #fff, #f0f0ff);
}

@media (max-width: 980px) {
  .topbar-member-btn {
    padding: 10px 14px;
    font-size: 11px;
  }

  .topbar-member-btn--guest {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.auth-page-body,
.profile-page-body {
  overflow-y: auto !important;
  height: auto;
  min-height: 100vh;
  background: #fff5dc;
}

/* --- Profil stranica --- */
.profile-page-body {
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink, #10131a);
}

.profile-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.profile-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: rgba(255, 245, 220, 0.92);
  border-bottom: 4px solid var(--ink, #10131a);
  backdrop-filter: blur(12px);
}

.profile-topbar-nav {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.profile-topbar-nav a {
  border: 3px solid var(--ink, #10131a);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.7);
}

.profile-topbar .topbar-end {
  margin-left: auto;
}

@media (min-width: 720px) {
  .profile-topbar-nav {
    display: flex;
    margin-left: 0;
  }

  .profile-topbar .topbar-end {
    margin-left: auto;
  }
}

.profile-main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  padding-bottom: max(3rem, env(safe-area-inset-bottom));
}

.profile-loading {
  text-align: center;
  color: var(--muted, #555);
  padding: 3rem 1rem;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 5px solid var(--ink, #10131a);
  border-radius: 28px;
  background: linear-gradient(135deg, var(--yellow, #ffd24d), #ffe566);
  box-shadow: var(--shadow, 8px 8px 0 var(--ink, #10131a));
}

.profile-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--ink, #10131a);
  background: #fff;
  display: grid;
  place-items: center;
  font-family: Bangers, cursive;
  font-size: 1.75rem;
  letter-spacing: 0.04em;
  box-shadow: 4px 4px 0 var(--ink, #10131a);
}

.profile-hero-copy {
  min-width: 0;
}

.profile-hero-name {
  margin: 0;
  font-family: Bangers, cursive;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  line-height: 1;
  letter-spacing: 0.03em;
}

.profile-hero-email {
  margin: 0.35rem 0 0;
  font-weight: 700;
  word-break: break-all;
}

.profile-hero-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.85;
}

.profile-card {
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.5rem;
  border: 5px solid var(--ink, #10131a);
  border-radius: 26px;
  background: var(--gradient-card, linear-gradient(145deg, #fff, #f7f4ff));
  box-shadow: var(--shadow, 8px 8px 0 var(--ink, #10131a));
}

.profile-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.profile-card-head h2 {
  margin: 0;
  font-family: Bangers, cursive;
  font-size: 1.75rem;
  letter-spacing: 0.04em;
}

.profile-chip {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 2px solid var(--ink, #10131a);
  border-radius: 999px;
  background: var(--yellow, #ffd24d);
}

.profile-link {
  font-weight: 800;
  font-size: 0.9rem;
  color: inherit;
}

.profile-continue-title {
  margin: 0 0 0.25rem;
  font-weight: 900;
  font-size: 1.1rem;
}

.profile-continue-meta {
  margin: 0 0 1rem;
  color: var(--muted, #555);
  font-weight: 700;
}

.profile-form .profile-field {
  display: block;
  margin-bottom: 1rem;
}

.profile-form .profile-field > span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 800;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.profile-form .profile-field > span small {
  font-weight: 700;
  color: var(--muted, #555);
}

.profile-form input,
.profile-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.85rem;
  border: 3px solid var(--ink, #10131a);
  border-radius: 14px;
  font: inherit;
  background: #fff;
}

.profile-form textarea {
  resize: vertical;
  min-height: 96px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.profile-actions .cta {
  flex: 1 1 160px;
  text-align: center;
  justify-content: center;
}

.profile-alert {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  margin-bottom: 1rem;
}

.profile-alert--err {
  background: #ffebee;
  color: #b71c1c;
  border: 2px solid #ef9a9a;
}

.profile-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  border: 3px dashed var(--ink, #10131a);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
}

.profile-empty p {
  margin: 0.35rem 0;
  line-height: 1.5;
}

.profile-empty .cta {
  margin-top: 1rem;
  display: inline-flex;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.fav-card-wrap {
  position: relative;
}

.fav-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 4px solid var(--ink, #10131a);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  box-shadow: 4px 4px 0 var(--ink, #10131a);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fav-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink, #10131a);
}

.fav-card-cover {
  aspect-ratio: 3 / 4;
  background: #e8e8f0;
  overflow: hidden;
}

.fav-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fav-card-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  font-family: Bangers, cursive;
  font-size: 2.5rem;
  color: var(--muted, #888);
}

.fav-card-body {
  padding: 0.75rem 0.85rem 1rem;
  flex: 1;
}

.fav-card-issue {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #555);
  margin-bottom: 0.25rem;
}

.fav-card-body h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
}

.fav-card-body p {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted, #555);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 3px solid var(--ink, #10131a);
  border-radius: 50%;
  background: #fff;
  color: var(--ink, #10131a);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink, #10131a);
}

.fav-remove:hover {
  background: var(--red, #ff4d4d);
  color: #fff;
}

.profile-toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(420px, calc(100% - 2rem));
  padding: 0.85rem 1.25rem;
  border: 3px solid var(--ink, #10131a);
  border-radius: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 6px 6px 0 var(--ink, #10131a);
}

.profile-toast--ok {
  background: var(--yellow, #ffd24d);
}

.profile-toast--err {
  background: #ffcdd2;
  color: #b71c1c;
}

.profile-toast[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .profile-hero {
    flex-direction: column;
    text-align: center;
  }

  .profile-actions .cta {
    flex: 1 1 100%;
  }
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  border: 5px solid var(--ink);
  border-radius: 28px;
  background: var(--gradient-card);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.auth-tabs button {
  flex: 1;
  padding: 0.65rem;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.active {
  background: var(--yellow);
}

.auth-form label {
  display: block;
  margin-bottom: 1rem;
}

.auth-form span {
  display: block;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font: inherit;
}

.auth-error {
  color: #c62828;
  font-weight: 700;
  margin: 0.75rem 0 0;
}

/* legacy .profile-page klasa uklonjena — koristi .profile-main */

.btn-favorite {
  border: 3px solid var(--ink);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.btn-favorite.is-on {
  background: var(--yellow);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Komentari na čitaču — stilovi u reader-page.css */
