:root {
  color-scheme: only light;
  --bg: #f8fafc;
  --bg-alt: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #d0d7e3;
  --accent: #1e293b;
}

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

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav a {
  margin-left: 1.5rem;
  font-weight: 500;
}

.nav-profile {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.2;
}

.nav-profile strong {
  color: var(--accent);
}

.nav-switch-group {
  display: inline-flex;
  gap: 0.5rem;
  margin-left: 1.5rem;
}

.nav-switch {
  margin: 0;
  display: inline;
}

.nav-switch-button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.nav-switch-button:hover {
  background: var(--accent);
  color: #fff;
}

.nav-brand a {
  font-size: 1.1rem;
  font-weight: 600;
}

.nav-region {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile {
  display: flex;
  justify-content: center;
}

.profile-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.profile-card h1 {
  margin-top: 0;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.profile-row dt {
  font-weight: 600;
  color: var(--muted);
}

.profile-row dd {
  margin: 0;
  font-weight: 500;
}

.profile-hint {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  margin-bottom: 3rem;
}

.hero h1 {
  margin-top: 0;
  font-size: 2rem;
}

.search-form,
.search-inline {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

input[type="search"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

button:hover,
.button:hover {
  background: #111827;
}

.button.secondary {
  background: transparent;
  color: var(--accent);
}

.card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.card .description {
  color: var(--muted);
  font-size: 0.95rem;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price {
  font-weight: 600;
}

.flash-container {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}

.flash.success {
  border-color: #4caf50;
}

.flash.warning {
  border-color: #fbbf24;
}

.flash.error {
  border-color: #f87171;
}

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

.cart-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.cart-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cart-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cart-summary {
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.detail {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

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

.detail .actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

.chip-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.chip-list li {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--muted);
}

.pagination {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  align-items: center;
}

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

.reader-container {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  height: 75vh;
  background: #1e293b;
}

.reader-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #111827;
}

.reader-container.epub {
  background: var(--bg-alt);
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
}

.reader-placeholder {
  margin-top: 1.5rem;
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
  color: var(--muted);
  line-height: 1.7;
}

.reader-placeholder h2 {
  margin-top: 0;
  color: var(--text);
}

.signin {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.signin-card {
  max-width: 420px;
  width: 100%;
  padding: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-alt);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.signin-card h1 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.signin-lead {
  color: var(--muted);
  margin-bottom: 2rem;
}

.signin-form {
  display: grid;
  gap: 1.25rem;
}

.signin-form label {
  display: grid;
  gap: 0.5rem;
  font-weight: 500;
}

.signin-form input[type="email"],
.signin-form input[type="password"] {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.signin-form button {
  margin-top: 0.5rem;
}

.signin-alt {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 720px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .nav a {
    margin-left: 0;
    margin-right: 1.25rem;
  }

  .hero {
    padding: 2rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
