:root {
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --accent: #3b5bfd;
  --accent-dark: #2c46c7;
  --border: #d9deeb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.page {
  min-height: 100vh;
  padding: 24px 16px 48px;
  max-width: 920px;
  margin: 0 auto;
}

.site-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.08);
}

.site-header.warning {
  background: #fff7f0;
  border-color: #fcd9bd;
  box-shadow: 0 8px 20px rgba(191, 72, 0, 0.12);
}

.site-header.warning .site-title h1 {
  color: #b34100;
}

.site-header.warning .tagline {
  color: #c25a17;
}

.site-title h1 {
  margin: 0;
  font-size: 1.8rem;
}

.tagline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.user-nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.welcome {
  font-weight: 600;
  color: var(--accent);
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(59, 91, 253, 0.1);
  color: var(--accent);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
}

.story-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.story-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.story-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.story-title {
  margin: 0;
  font-size: 1.4rem;
}

.story-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.story-author {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.story-author:hover,
.story-author:focus {
  text-decoration: underline;
}

.story-body {
  margin: 0;
  white-space: pre-wrap;
}

.story-link {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.button:hover,
.button:focus {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.button.link {
  background: rgba(59, 91, 253, 0.12);
  color: var(--accent);
}

.button.link:hover,
.button.link:focus {
  background: rgba(59, 91, 253, 0.2);
}

.button.danger {
  background: #e53935;
}

.button.danger:hover,
.button.danger:focus {
  background: #c62828;
}

.story-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .site-header {
    padding: 20px;
  }

  .site-title h1 {
    font-size: 1.5rem;
  }

  .user-nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .story-card {
    padding: 18px;
  }
}

.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.08);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-card h2,
.form-card h3 {
  margin: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 600;
  color: var(--text);
}

.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.16);
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions .button.link {
  background: transparent;
}

.confirm-card {
  gap: 16px;
}

.confirm-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.status-card {
  text-align: center;
  align-items: center;
}

.comment-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(31, 41, 51, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-body {
  margin: 0;
}

.comment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-author a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.comment-author a:hover,
.comment-author a:focus {
  text-decoration: underline;
}

.comment-actions {
  display: inline-flex;
  gap: 12px;
}

.comment-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.comment-link:hover,
.comment-link:focus {
  text-decoration: underline;
}

.empty-state {
  margin: 0;
  padding: 18px;
  background: rgba(59, 91, 253, 0.08);
  border-radius: 12px;
  color: var(--muted);
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-basics {
  display: flex;
  gap: 16px;
  align-items: center;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(59, 91, 253, 0.15);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
}

.profile-username {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 700;
}

.profile-bio {
  margin: 0;
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.profile-stats {
  display: flex;
  gap: 18px;
  margin: 0;
}

.profile-stats div {
  background: rgba(59, 91, 253, 0.08);
  padding: 16px 20px;
  border-radius: 12px;
  text-align: center;
  min-width: 120px;
}

.profile-stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-stats dd {
  margin: 4px 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.message {
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 600;
}

.message.error {
  background: #ffe3e3;
  border: 1px solid #ffb3b3;
  color: #7f1d1d;
}

.message.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
}
