:root {
  color-scheme: light dark;
  --font-title: "Cinzel", "Times New Roman", serif;
  --ink-strong: #f5f3f8;
  --ink-medium: #ccd3e5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
}

.topbar .wrap {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar nav {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.lang-link {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.15rem 0.48rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.lang-link.is-active {
  border-color: rgba(147, 197, 253, 0.85);
  color: #dbeafe;
}

.topbar a {
  color: #93c5fd;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  height: 60px;
  width: auto;
  padding-top: 8px;
}

.brand-text {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}

main.wrap {
  padding-block: 1.2rem 2rem;
}

.card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.75);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

h1, h2 {
  margin-top: 0;
}

.form-grid {
  display: grid;
  gap: 0.8rem;
  justify-items: end;
}

.form-grid label {
  justify-self: stretch;
}


label {
  display: grid;
  gap: 0.3rem;
}

input,
select,
textarea,
button,
.button {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 0.62rem 0.75rem;
  font: inherit;
}

button,
.button {
  width: fit-content;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.button.muted {
  background: #334155;
}

.actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.auth-link {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: #94a3b8;
  text-align: right;
}

.auth-link a {
  color: #93c5fd;
}

.auth-link--register {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  text-align: center;
}

.message {
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}

.message.error {
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid rgba(252, 165, 165, 0.45);
}

.message.success {
  background: rgba(22, 163, 74, 0.2);
  border: 1px solid rgba(134, 239, 172, 0.45);
}

.message.info {
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(147, 197, 253, 0.45);
}

.badge {
  font-size: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}

.mini-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 0.7rem;
  background: rgba(30, 41, 59, 0.6);
}

.response-box {
  white-space: pre-wrap;
  margin: 0;
  font-family: inherit;
  line-height: 1.5;
}

.hint {
  color: #93c5fd;
}

.password-hint {
  display: block;
  font-size: 0.82rem;
  color: #94a3b8;
}

ul {
  margin-bottom: 0;
}

.reading-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
}

.reading-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: rgba(30, 41, 59, 0.45);
}

.reading-table th,
.reading-table td {
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  text-align: left;
  vertical-align: middle;
}

.reading-table th {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: #cbd5e1;
}

.reading-table th:last-child,
.reading-table td:last-child {
  width: 120px;
  text-align: right;
}

.reading-table tr:last-child td {
  border-bottom: 0;
}

.reading-download-link {
  font-size: 0.84rem;
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reading-download-link:hover {
  color: #bfdbfe;
}

.pagination {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: center;
}

.pagination-link {
  border: 1px solid rgba(148, 163, 184, 0.46);
  border-radius: 8px;
  padding: 0.35rem 0.58rem;
  font-size: 0.85rem;
  text-decoration: none;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.6);
}

.pagination-link.is-current {
  border-color: rgba(147, 197, 253, 0.72);
  color: #dbeafe;
}

.pagination-link.is-disabled {
  opacity: 0.44;
  cursor: default;
}

@media (max-width: 640px) {
  .pagination {
    gap: 0.35rem;
  }
}

/* Hamburger button — hidden on desktop */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: #93c5fd;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 640px) {
  .menu-toggle {
    display: flex;
  }

  .topbar {
    position: relative;
  }

  .topbar-right {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(3, 7, 17, 0.97);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    padding: 0.5rem 0;
    z-index: 100;
  }

  .topbar-right.is-open {
    display: flex;
  }

  .top-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .top-links a,
  .top-links .badge {
    display: block;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    font-size: 0.95rem;
    color: #f1f5f9;
    text-decoration: none;
  }

  .top-links a:hover {
    background: rgba(148, 163, 184, 0.08);
    color: #ffffff;
  }

  .top-links .badge {
    color: #7dd3fc;
    font-weight: 600;
    font-size: 0.85rem;
    background: rgba(125, 211, 252, 0.08);
  }

  .lang-switch {
    padding: 0.6rem 1.25rem;
    gap: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
  }

  .lang-switch .lang-link {
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.3);
  }

  .lang-switch .lang-link.is-active {
    color: #ffffff;
    border-color: rgba(147, 197, 253, 0.7);
    background: rgba(147, 197, 253, 0.12);
  }
}

/* Credits purchase modal */
.spread-credit-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.spread-credit-modal[hidden] {
  display: none;
}

.spread-credit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(3px);
}

.spread-credit-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  border-radius: 16px;
  border: 1px solid rgba(169, 184, 215, 0.34);
  background: linear-gradient(160deg, rgba(9, 14, 28, 0.98), rgba(10, 18, 35, 0.95));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
  padding: 1rem;
}

.spread-credit-modal-x {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(169, 184, 215, 0.3);
  border-radius: 50%;
  background: rgba(8, 14, 28, 0.7);
  color: var(--ink-strong);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.spread-credit-modal-x:hover {
  border-color: rgba(202, 166, 106, 0.6);
  background: rgba(20, 30, 55, 0.9);
}

.spread-credit-modal-panel h2 {
  margin: 0;
  padding-right: 2rem;
  font-family: var(--font-title);
  font-size: 1.15rem;
}

.spread-credit-modal-panel p {
  margin: 0.65rem 0 0;
  color: var(--ink-medium);
  line-height: 1.5;
}

.spread-credit-form-grid {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.58rem;
}

.spread-credit-field {
  display: grid;
  gap: 0.38rem;
  margin-top: 0.58rem;
}

.spread-credit-field span {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-medium);
  font-weight: 600;
}

.spread-credit-field input {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(169, 184, 215, 0.34);
  background: rgba(8, 13, 26, 0.95);
  color: var(--ink-strong);
  padding: 0.56rem 0.75rem;
  font: inherit;
}

.spread-credit-field input:focus {
  outline: none;
  border-color: rgba(110, 157, 242, 0.62);
  box-shadow: 0 0 0 2px rgba(110, 157, 242, 0.18);
}

.spread-credit-field input.is-invalid {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.spread-credit-modal-actions {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.55rem;
}

.spread-credit-modal-actions[hidden],
.spread-credit-modal-summary[hidden] {
  display: none !important;
}

.spread-credit-option-btn,
.spread-credit-modal-close {
  border: 1px solid rgba(169, 184, 215, 0.35);
  border-radius: 14px;
  background: rgba(8, 14, 28, 0.85);
  color: var(--ink-strong);
  min-height: 42px;
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  position: relative;
  width: 100%;
}

.spread-credit-option-btn.is-popular {
  border-color: rgba(202, 166, 106, 0.55);
}

.spread-credit-option-main {
  font-size: 0.92rem;
}

.spread-credit-option-desc {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-medium);
  opacity: 0.8;
}

.spread-credit-option-btn:hover,
.spread-credit-modal-close:hover {
  border-color: rgba(202, 166, 106, 0.56);
}

.spread-credit-option-btn.is-selected {
  border-color: rgba(202, 166, 106, 0.8);
  background: linear-gradient(145deg, rgba(32, 49, 86, 0.92), rgba(33, 54, 96, 0.82));
}

.spread-credit-modal-close {
  border-radius: 999px;
  display: block;
}

/* Coupon input row */
.spread-credit-coupon-row {
  margin-top: 0.7rem;
}

.spread-credit-coupon-row .spread-credit-field {
  margin-top: 0;
}

.spread-credit-coupon-input-wrap {
  display: flex;
  gap: 0.4rem;
}

.spread-credit-coupon-input-wrap input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.spread-credit-coupon-btn {
  border: 1px solid rgba(202, 166, 106, 0.5);
  border-radius: 10px;
  background: rgba(202, 166, 106, 0.15);
  color: #caa66a;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.spread-credit-coupon-btn:hover {
  background: rgba(202, 166, 106, 0.25);
}

.spread-credit-coupon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.spread-credit-coupon-msg {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  min-height: 0.9rem;
  color: var(--ink-medium);
}

.spread-credit-coupon-msg.is-success {
  color: #8be6b8;
}

.spread-credit-coupon-msg.is-error {
  color: #f6c5c5;
}

.spread-credit-coupon-msg.is-info {
  color: var(--ink-medium);
}

.spread-credit-validation {
  margin: 0.7rem 0 0;
  min-height: 1.15rem;
  font-size: 0.82rem;
  color: #f6c5c5;
}

.spread-credit-validation.is-info {
  color: var(--ink-medium);
}

.spread-credit-validation.is-success {
  color: #8be6b8;
}

.spread-paypal-container {
  margin-top: 0.75rem;
  min-height: 46px;
}

.spread-credit-modal-close {
  margin-top: 0.82rem;
  width: 100%;
}

body.spread-credit-modal-open {
  overflow: hidden;
}

/* Credit packages grid (dashboard section) */
.credit-packages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.9rem;
}

@media (max-width: 480px) {
  .credit-packages-grid {
    grid-template-columns: 1fr;
  }
}

.credit-package-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border: 1px solid rgba(169, 184, 215, 0.25);
  border-radius: 14px;
  background: rgba(8, 14, 28, 0.7);
  text-align: center;
}

.credit-package-card.is-popular {
  border-color: rgba(202, 166, 106, 0.55);
  background: linear-gradient(160deg, rgba(22, 36, 66, 0.85), rgba(14, 22, 42, 0.85));
}

.credit-package-badge {
  position: absolute;
  top: -0.55rem;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #caa66a, #b8914e);
  color: #0a0e1c;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.credit-package-credits {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-strong);
}

.credit-package-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: #caa66a;
}

.credit-package-desc {
  font-size: 0.78rem;
  color: var(--ink-medium);
  opacity: 0.85;
}

.credit-package-buy {
  margin-top: 0.5rem;
  width: auto;
  border: none;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 1.2rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.credit-package-buy:hover {
  background: #15803d;
}

/* Modal summary for direct purchase */
.spread-credit-modal-summary {
  margin-top: 0.9rem;
  padding: 0.7rem;
  border: 1px solid rgba(202, 166, 106, 0.5);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(32, 49, 86, 0.92), rgba(33, 54, 96, 0.82));
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-strong);
}

.spread-credit-modal-summary[hidden] {
  display: none;
}

.paypal-button-container{
  padding: 20px !important;
  background: transparent !important;
}

.paypal-button-container .paypal-button {
  background: transparent !important;
}