/* === pochitayte.ru — teletype-style design === */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --bg-card: #ffffff;
  --bg-hover: #fafafa;
  --text: #1a1a1a;
  --text-2: #555555;
  --text-3: #999999;
  --border: #ebebeb;
  --accent: #1a8917;
  --accent-hover: #156d13;
  --link: #1a8917;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --max-w: 680px;
  --header-h: 52px;
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --bg: #141414;
  --bg-alt: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-hover: #242424;
  --text: #e6e6e6;
  --text-2: #a0a0a0;
  --text-3: #666666;
  --border: #2a2a2a;
  --accent: #2ea043;
  --accent-hover: #3fb950;
  --link: #3fb950;
  --shadow: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-hover: 0 2px 8px rgba(0,0,0,0.3);
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background var(--transition), color var(--transition);
}

a { color: inherit; text-decoration: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; color: inherit; }

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 0; }

/* === HEADER === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 120px;
}

.header-right { justify-content: flex-end; }

.header-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--transition);
}
.header-link:hover, .header-link.active { color: var(--text); }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  max-width: 140px;
}
.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.header-user-avatar-img {
  display: block;
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
}
.header-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo-dot { color: var(--text-3); font-weight: 400; }

.theme-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-3);
  transition: all var(--transition);
}
.theme-btn:hover { color: var(--text); background: var(--bg-alt); }

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* === TABS === */
.tabs {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  transition: background var(--transition), border-color var(--transition);
}

.tabs-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
}
.tab:hover { color: var(--text-2); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab svg { opacity: 0.6; }
.tab.active svg { opacity: 1; }

/* === MAIN === */
.main {
  min-height: calc(100vh - var(--header-h) - 60px);
}

/* === FEED === */
.feed {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* === POST CARD with cover preview === */
.post-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition);
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.post-card-content {
  flex: 1;
  min-width: 0;
}

.post-cover-link {
  flex-shrink: 0;
  display: block;
  margin-top: 8px;
}

.post-cover {
  width: 120px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.post-cover-link:hover .post-cover img {
  transform: scale(1.04);
  opacity: 0.9;
}

.post-cover-placeholder {
  opacity: 0.3;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-author:hover .post-author-name { color: var(--accent); }

.post-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.post-avatar--photo {
  padding: 0;
  background: transparent !important;
  overflow: hidden;
  border-radius: 50%;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
}

.post-avatar-img {
  display: block;
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.post-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-author-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: color var(--transition);
}

.post-date {
  font-size: 13px;
  color: var(--text-3);
}

.post-body { display: block; }
.post-body:hover .post-title { color: var(--text-2); }

.post-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

.post-excerpt {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.post-read-time {
  font-size: 13px;
  color: var(--text-3);
}

.post-views {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-3);
}
.post-views svg { opacity: 0.5; }

/* Infinite scroll loader */
.feed-loader {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

.loader-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.feed-loader.hidden { display: none; }

.feed-end {
  text-align: center;
  padding: 24px 0 32px;
  font-size: 13px;
  color: var(--text-3);
}

/* Post card animation */
.post-card {
  animation: fadeUp 0.35s ease both;
}

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

/* === AUTHOR CARD === */
.author-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.author-card:hover { opacity: 0.8; }

.author-card-avatar {
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  align-self: flex-start;
  isolation: isolate;
}

.author-card-info { flex: 1; min-width: 0; }

.author-card-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
}

.author-card-bio {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.author-card-stats {
  font-size: 13px;
  color: var(--text-3);
}

/* Аватар авторов: только px, без % у img — иначе на iOS/WebKit картинка разъезжается на ширину экрана */
.author-card-avatar-wrap {
  display: block;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  align-self: flex-start;
}

.author-card-avatar-img {
  display: block;
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: cover;
  object-position: center;
  border: 0;
  border-radius: 50%;
}

a.author-card {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* === PROFILE === */
.profile {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.profile-header {
  text-align: center;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin: 0 auto 16px;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.profile-bio {
  font-size: 15px;
  color: var(--text-2);
  max-width: 440px;
  margin: 0 auto 12px;
}

.profile-stats-row {
  font-size: 14px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.profile-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.profile-stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.profile-stat-label {
  font-size: 12px;
  color: var(--text-3);
}
.profile-avatar--photo {
  padding: 0;
  overflow: hidden;
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  max-width: 72px;
  max-height: 72px;
  margin-left: auto;
  margin-right: auto;
}
.profile-avatar--photo img {
  display: block;
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}
.meta-dot { color: var(--text-3); opacity: 0.4; }

.profile-posts { }

.profile-post {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity var(--transition);
}
.profile-post:hover { opacity: 0.75; }

.profile-post-content {
  flex: 1;
  min-width: 0;
}

.profile-post-cover {
  width: 100px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.profile-post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-post-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.profile-post-excerpt {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-post-meta {
  font-size: 13px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === ARTICLE === */
.article {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.article-head { margin-bottom: 24px; }

.article-author-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.article-author-link:hover .article-author-name { color: var(--accent); }

.article-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.article-avatar--photo {
  padding: 0;
  background: transparent !important;
  overflow: hidden;
  border-radius: 50%;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
}

.article-avatar--photo img {
  display: block;
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
}

.article-author-name {
  font-size: 15px;
  font-weight: 600;
  transition: color var(--transition);
}

.article-meta {
  font-size: 13px;
  color: var(--text-3);
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

/* Article Cover */
.article-cover {
  margin-bottom: 32px;
  border-radius: var(--radius);
  overflow: hidden;
}

.article-cover img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: cover;
}

/* Article Content */
.article-content {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
}

.article-content p {
  margin-bottom: 1.2em;
}

.article-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 1.8em 0 0.6em;
  letter-spacing: -0.02em;
}

.article-content blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--text-2);
}

.article-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.article-content a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1.2em 0;
}

/* Article Footer */
.article-foot {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all var(--transition);
  cursor: pointer;
}
.share-btn:hover {
  color: var(--text);
  border-color: var(--text-3);
  background: var(--bg-hover);
}
.share-btn svg { opacity: 0.6; flex-shrink: 0; }
.share-btn:hover svg { opacity: 1; }

.share-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}
.share-btn.copied svg { opacity: 1; }

/* Нативный share недоступен — панель как в iOS (MAX / VK / копировать) */
.share-fallback {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.share-fallback[hidden] {
  display: none !important;
}
.share-fallback__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.share-fallback__sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}
.share-fallback__title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 4px;
}
.share-fallback__lead {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 16px;
  line-height: 1.4;
}
.share-fallback__btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.share-fallback__btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-3);
}
.share-fallback__btn-main {
  display: block;
  width: 100%;
}
.share-fallback__btn-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  line-height: 1.35;
}
.share-fallback__btn--max {
  border-color: color-mix(in srgb, #7c3aed 35%, var(--border));
  background: color-mix(in srgb, #7c3aed 10%, var(--bg-alt));
}
.share-fallback__btn--vk {
  border-color: color-mix(in srgb, #0077ff 35%, var(--border));
  background: color-mix(in srgb, #0077ff 8%, var(--bg-alt));
}
.share-fallback__cancel {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.share-fallback__cancel:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%) translateY(12px);
  z-index: 320;
  max-width: min(90vw, 360px);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: rgba(30, 30, 30, 0.92);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.share-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 640px) {
  .share-fallback {
    align-items: center;
    padding: 24px;
  }
  .share-fallback__sheet {
    border-radius: 16px;
    padding: 22px 20px 18px;
  }
}

/* Related */
.related {
  margin-top: 32px;
  padding-top: 24px;
  padding-bottom: 24px;
  border-top: 1px solid var(--border);
}

.related-heading {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text-2);
}

/* Те же карточки, что на главной (.post-card); без лишних отступов контейнера ленты */
.related-feed {
  margin: 0;
  padding: 0;
  max-width: none;
}

/* После последней рекомендации не дублируем линию — граница уже у подвала */
.related-feed .post-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Без лишнего «воздуха» перед подвалом: нижний padding статьи обычно 64px */
.article:has(.related) {
  padding-bottom: 28px;
}

/* Reading bar */
.reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 200;
  transition: width 80ms linear;
}

/* === ABOUT === */
.about {
  max-width: 640px;
  margin: 0 auto;
  padding: 60px 20px 80px;
  text-align: center;
}

.about-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.about-subtitle {
  font-size: 17px;
  color: var(--text-2);
  margin-bottom: 48px;
}

.about-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  text-align: left;
  margin-bottom: 48px;
}

.about-feature-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: 10px;
  color: var(--accent);
  margin-bottom: 12px;
}

.about-feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.about-feature p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* === LOGIN === */
.login {
  max-width: 400px;
  margin: 0 auto;
  padding: 80px 20px;
  text-align: center;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 16px;
}

.login-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}

/* === 404 === */
.not-found {
  text-align: center;
  padding: 100px 20px;
}
.not-found h1 {
  font-size: 72px;
  font-weight: 200;
  color: var(--text-3);
  margin-bottom: 8px;
}
.not-found p {
  font-size: 16px;
  color: var(--text-2);
  margin-bottom: 24px;
}
.not-found a {
  font-size: 14px;
  color: var(--accent);
  font-weight: 500;
}

.post-author--link {
  border-radius: 8px;
  transition: opacity var(--transition);
}
.post-author--link:hover {
  opacity: 0.85;
}
.post-author--link:hover .post-author-name {
  color: var(--accent);
}

/* === AUTH (вход / регистрация) === */
.auth-page {
  max-width: 420px;
  margin: 0 auto;
  padding: 48px 20px 72px;
}
.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  text-align: center;
  background: none;
  cursor: pointer;
}
.auth-tab:hover { color: var(--text-2); }
.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.auth-form.hidden { display: none; }
.auth-field { margin-bottom: 16px; }
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.auth-optional { font-weight: 400; color: var(--text-3); }
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-family: var(--font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 137, 23, 0.08);
}
.auth-field input::placeholder { color: var(--text-3); }
.auth-error {
  color: #ef4444;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}
.auth-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s ease, transform 0.15s ease;
}
.auth-btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-password-wrap { position: relative; }
.auth-password-wrap input { padding-right: 40px; }
.auth-toggle-pw {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 6px;
}
.auth-toggle-pw:hover { color: var(--text); }
.auth-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 14px;
  padding: 8px;
  background: var(--bg-alt);
  border-radius: 6px;
}

/* === FOOTER === */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  transition: all var(--transition);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
}
.footer-inner a { transition: color var(--transition); }
.footer-inner a:hover { color: var(--text-2); }
.footer-dot { opacity: 0.3; }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .header-left { min-width: auto; gap: 10px; }
  .header-right { min-width: auto; }
  .header-logo { font-size: 16px; }
  .header-link { font-size: 13px; }

  .tab { padding: 10px 12px; font-size: 13px; }

  /* Авторы на главной: те же px, что и в базе — дублируем img, иначе iOS оставляет 48px */
  .author-card {
    gap: 12px;
    padding: 16px 0;
  }
  .author-card-avatar-wrap {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
  }
  .author-card-avatar-img {
    width: 44px;
    height: 44px;
    max-width: 44px;
    max-height: 44px;
  }
  .author-card-avatar {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    font-size: 15px;
  }

  .post-card { gap: 14px; }
  .post-cover { width: 96px; height: 64px; }
  .post-title { font-size: 16px; }
  .post-excerpt { font-size: 14px; -webkit-line-clamp: 2; }
  .post-avatar { width: 24px; height: 24px; font-size: 11px; min-width: 24px; min-height: 24px; }
  .post-avatar--photo {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    max-width: 24px;
    max-height: 24px;
  }
  .post-avatar-img {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
  }

  .article-title { font-size: 24px; }
  .article-content { font-size: 16px; }
  .article-content h2 { font-size: 20px; }
  .article-cover img { max-height: 240px; }

  .about-features { grid-template-columns: 1fr; gap: 24px; }
  .about-title { font-size: 28px; }

  .profile-name { font-size: 20px; }
  .profile-post-cover { width: 80px; height: 54px; }

  .article:has(.related) {
    padding-bottom: 24px;
  }
}

@media (max-width: 380px) {
  .header-inner { padding: 0 12px; }
  .feed { padding: 0 12px; }
  .profile { padding: 0 12px; }
  .article { padding: 24px 12px 48px; }
  .article:has(.related) {
    padding-bottom: 20px;
  }

  .post-cover { width: 80px; height: 54px; }
}
