:root {
  --bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(148, 163, 184, 0.25);
  --primary: #0f766e;
  --primary-deep: #115e59;
  --accent: #ea580c;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 28%),
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 24%),
    linear-gradient(180deg, #eff6ff 0%, #f8fafc 40%, #fff7ed 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

textarea,
input,
select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
}

textarea {
  resize: vertical;
}

.shell {
  width: min(1280px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 4rem;
}

.topbar,
.hero-panel,
.news-auth-grid,
.admin-grid,
.admin-books,
.detail-header,
.feedback-grid {
  display: grid;
  gap: 1.2rem;
}

.topbar,
.hero-panel {
  align-items: center;
}

.topbar {
  grid-template-columns: 1fr auto;
  margin-bottom: 1.4rem;
}

.topbar h1,
.hero-panel h2,
.section-heading h3,
.detail-copy h3 {
  margin: 0;
}

.topbar-actions,
.inline-actions,
.book-topline,
.hero-meta,
.genre-strip,
.star-picker,
.comment-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.layout {
  display: grid;
  gap: 1.3rem;
}

.hero-panel {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 2rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 118, 110, 0.92)),
    linear-gradient(120deg, #082f49, #164e63);
  color: #f8fafc;
}

.hero-copy p,
.hero-card p,
.hint,
.book-body p,
.news-item p,
.comment-card p {
  color: var(--muted);
}

.hero-copy p,
.hero-copy .hero-meta span {
  color: rgba(248, 250, 252, 0.86);
}

.hero-card,
.panel {
  padding: 1.4rem;
  border-radius: var(--radius-lg);
}

.news-auth-grid,
.admin-grid,
.admin-books,
.feedback-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel h4,
.panel h5 {
  margin: 0 0 0.8rem;
}

.eyebrow,
.card-label,
.news-date {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--accent);
}

.pill,
.badge,
.genre-chip {
  border-radius: 999px;
  font-size: 0.82rem;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.8rem;
}

.pill {
  background: rgba(255, 255, 255, 0.16);
  color: #fff7ed;
}

.badge {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.badge.success {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

.badge.warning {
  background: rgba(249, 115, 22, 0.14);
  color: #9a3412;
}

.badge.muted {
  background: rgba(100, 116, 139, 0.14);
  color: #334155;
}

.primary-button,
.ghost-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
}

.ghost-button {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.primary-button:hover,
.ghost-button:hover,
.link-button:hover,
.genre-chip:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.thumbnail-preview-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.preview-cover {
  min-height: 260px;
}

.stack-form label,
.feedback-card label,
.approval-card label {
  display: grid;
  gap: 0.45rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.news-list,
.comment-list,
.admin-book-list {
  display: grid;
  gap: 0.9rem;
}

.news-item,
.signed-in-card,
.comment-card,
.approval-card,
.feedback-card,
.mini-book-row,
.empty-card,
.warning-panel {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.warning-panel {
  background: rgba(255, 247, 237, 0.9);
  border-color: rgba(249, 115, 22, 0.22);
}

.genre-strip {
  margin-bottom: 1.2rem;
}

.genre-chip {
  padding: 0.7rem 1rem;
  background: rgba(15, 23, 42, 0.05);
}

.genre-chip.active {
  color: white;
  background: linear-gradient(135deg, #0f172a, #0f766e);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.library-grid.locked {
  filter: saturate(0.7);
}

.book-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.82);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.14);
}

.book-cover,
.detail-cover {
  display: grid;
  place-items: end start;
  min-height: 220px;
  padding: 1rem;
  border-radius: 22px;
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 700;
}

.detail-cover {
  min-height: 260px;
}

.book-body h4,
.comment-card strong {
  margin: 0;
}

.book-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.detail-header {
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
}

.detail-copy p,
.reader-pane pre {
  margin: 0;
}

.reader-pane {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.reader-pane pre {
  white-space: pre-wrap;
  line-height: 1.7;
}

.star-picker {
  gap: 0.35rem;
}

.star {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.star.active {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.star input {
  display: none;
}

.form-note,
.hint,
.mini-book-row p {
  margin: 0;
  font-size: 0.92rem;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

.mini-book-row,
.comment-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

@media (max-width: 1040px) {
  .hero-panel,
  .news-auth-grid,
  .admin-grid,
  .admin-books,
  .detail-header,
  .feedback-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 1rem, 100%);
  }

  .topbar,
  .section-heading,
  .book-footer,
  .mini-book-row,
  .comment-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 22px;
  }
}
