:root {
  --bg: #0d0d0d;
  --bg-rgb: 13, 13, 13;
  --card: #161616;
  --card-2: #1d1d1f;
  --text: #fbf7f2;
  --muted: #a4b3b6;
  --soft: #ebe9e1;
  --line: rgba(255, 255, 255, 0.08);
  --purple-dark: #2a1b3d;
  --purple: #44318d;
  --lilac: #9b82c8;
  --rose: #d6536d;
  --blush: #ffa2b6;
  --flame: #e43d12;
  --gold: #efb11d;
  --peach: #e98074;
  --radius: 8px;
  --reader-size: 20px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(228, 61, 18, 0.1) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 18% 0%, rgba(68, 49, 141, 0.32), transparent 28rem),
    radial-gradient(circle at 92% 24%, rgba(214, 83, 109, 0.16), transparent 24rem),
    linear-gradient(180deg, rgba(42, 27, 61, 0.44), transparent 42rem),
    var(--bg);
  background-size: auto, auto, auto, auto;
  color: var(--text);
  font-family: "Noto Sans Kannada", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

body.is-reader {
  background:
    radial-gradient(circle at 50% -10%, rgba(68, 49, 141, 0.24), transparent 34rem),
    var(--bg);
}

body.is-reader.reader-light {
  --bg: #f5efe6;
  --bg-rgb: 245, 239, 230;
  --card: #fff8ef;
  --card-2: #ebe9e1;
  --text: #201914;
  --muted: #745f55;
  --soft: #38271f;
  --line: rgba(42, 27, 61, 0.14);
  background:
    radial-gradient(circle at 50% -8%, rgba(255, 162, 182, 0.28), transparent 28rem),
    linear-gradient(180deg, rgba(235, 233, 225, 0.94), rgba(245, 239, 230, 1) 38rem),
    var(--bg);
}

::selection {
  background: rgba(255, 162, 182, 0.34);
  color: var(--text);
}

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

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.progress {
  position: fixed;
  z-index: 30;
  inset: 0 auto auto 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--rose), var(--flame), var(--gold));
  box-shadow: 0 0 18px rgba(214, 83, 109, 0.7);
  transition: width 120ms linear;
}

.home-view,
.reader-view,
.admin-view {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 18px 18px 48px;
}

.site-header,
.reader-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 10px 0;
  background: linear-gradient(180deg, rgba(var(--bg-rgb), 0.98), rgba(var(--bg-rgb), 0.72), transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: grid;
  gap: 4px;
  width: max-content;
}

.brand-logo {
  width: clamp(164px, 22vw, 260px);
  height: auto;
  filter: none;
}

.brand-tagline {
  color: var(--blush);
  font-size: 13px;
  font-weight: 600;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(42, 27, 61, 0.72), rgba(22, 22, 22, 0.72));
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.featured-shell {
  padding: 22px 0 34px;
}

.section-kicker {
  margin: 0 0 12px;
  color: var(--flame);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.featured-card,
.story-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  outline: none;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.featured-card:hover,
.featured-card:focus-visible,
.story-card:hover,
.story-card:focus-visible {
  transform: scale(1.015);
  border-color: color-mix(in srgb, var(--story-accent, var(--purple)), var(--blush) 16%);
  box-shadow: 0 18px 70px color-mix(in srgb, var(--story-accent, var(--purple)) 30%, transparent);
}

.featured-card {
  display: grid;
  min-height: 560px;
  isolation: isolate;
}

.featured-card img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(13, 13, 13, 0.94), rgba(42, 27, 61, 0.62) 46%, rgba(13, 13, 13, 0.2)),
    linear-gradient(0deg, rgba(13, 13, 13, 0.92), transparent 48%);
}

.featured-copy {
  align-self: end;
  width: min(100%, 680px);
  padding: clamp(22px, 5vw, 46px);
}

.story-type {
  margin: 0 0 12px;
  color: color-mix(in srgb, var(--story-accent, var(--rose)) 64%, var(--blush));
  font-size: 13px;
  font-weight: 800;
}

.featured-copy h1,
.section-head h1,
.reader-meta h1 {
  margin: 0;
  font-family: "Noto Serif Kannada", "Noto Sans Kannada", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.featured-copy h1 {
  max-width: 11ch;
  font-size: clamp(42px, 10vw, 86px);
  line-height: 1.08;
}

.featured-copy p:not(.story-type),
.section-head p,
.card-body p,
.reader-meta p {
  color: var(--muted);
}

.featured-copy .teaser {
  max-width: 560px;
  margin: 14px 0 20px;
  font-size: clamp(16px, 3vw, 22px);
  line-height: 1.65;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 700;
}

.read-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(228, 61, 18, 0.16), rgba(214, 83, 109, 0.12));
  box-shadow: 0 0 28px color-mix(in srgb, var(--story-accent, var(--purple)) 38%, transparent);
  font-size: 24px;
}

.collection-shell {
  padding: 8px 0 34px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}

.section-head h1 {
  font-size: clamp(28px, 6vw, 48px);
}

.section-head p {
  max-width: 320px;
  margin: 0;
  text-align: right;
  line-height: 1.7;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.story-card {
  min-width: 0;
}

.story-card img {
  width: 100%;
  aspect-ratio: 2 / 2.8;
  object-fit: cover;
  background: #101010;
}

.card-body {
  padding: 14px;
}

.card-body h2 {
  min-height: 2.7em;
  margin: 0 0 7px;
  font-family: "Noto Serif Kannada", "Noto Sans Kannada", serif;
  font-size: clamp(19px, 5vw, 26px);
  line-height: 1.32;
  letter-spacing: 0;
}

.card-body p {
  display: -webkit-box;
  min-height: 3.35em;
  margin: 0 0 12px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px;
  line-height: 1.65;
}

.back-link,
.reader-brand,
.icon-btn,
.tool-btn,
.floating-bookmark {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(22, 22, 22, 0.78);
  color: var(--text);
}

body.reader-light .back-link,
body.reader-light .reader-brand,
body.reader-light .icon-btn,
body.reader-light .tool-btn,
body.reader-light .floating-bookmark {
  background: rgba(255, 248, 239, 0.82);
  color: var(--text);
}

.back-link,
.icon-btn,
.tool-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.reader-brand {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 999px;
}

.reader-brand img {
  width: 104px;
  height: auto;
  filter: none;
}

.reader-actions {
  display: flex;
  gap: 8px;
}

.icon-btn,
.tool-btn,
.floating-bookmark {
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease, background 180ms ease;
}

.icon-btn:hover,
.tool-btn:hover,
.floating-bookmark:hover,
.icon-btn.is-active,
.tool-btn.is-active,
.floating-bookmark.is-active {
  border-color: rgba(255, 162, 182, 0.62);
  background: rgba(214, 83, 109, 0.12);
  box-shadow: 0 0 26px rgba(214, 83, 109, 0.24);
}

.reader-hero {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: end;
  padding: 22px 0 28px;
}

.reader-hero img {
  width: 120px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 70px rgba(68, 49, 141, 0.32);
}

body.reader-light .reader-hero img {
  box-shadow: 0 18px 70px rgba(68, 49, 141, 0.16);
}

.reader-meta {
  min-width: 0;
}

.reader-meta h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 9vw, 72px);
  line-height: 1.12;
}

.reader-meta p:not(.story-type) {
  margin: 0 0 12px;
  font-size: clamp(16px, 3.5vw, 20px);
  line-height: 1.7;
}

.reader-toolbar {
  position: sticky;
  top: 74px;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 26px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(var(--bg-rgb), 0.78);
  backdrop-filter: blur(16px);
}

.tool-btn {
  font-weight: 800;
}

.part-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: min(700px, 100%);
  margin: 0 auto 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.part-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.74);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

body.reader-light .part-tab {
  background: rgba(255, 248, 239, 0.82);
}

.part-tab.is-active,
.part-tab:hover {
  border-color: rgba(255, 162, 182, 0.62);
  background: rgba(214, 83, 109, 0.12);
  color: var(--text);
  box-shadow: 0 0 24px rgba(214, 83, 109, 0.18);
}

.reader-content {
  max-width: 700px;
  margin: 0 auto;
  padding: 8px 0 92px;
  font-family: "Noto Serif Kannada", "Noto Sans Kannada", serif;
  font-size: var(--reader-size);
  line-height: 2.05;
}

body.reader-light .reader-content {
  color: var(--text);
}

body.reader-light .reader-content p:first-child::first-letter {
  color: var(--rose);
}

.admin-shell {
  width: min(100%, 840px);
  margin: 28px auto 0;
}

.admin-login {
  width: min(100%, 560px);
  margin: 0 auto;
}

.cms-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.cms-summary div {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(42, 27, 61, 0.4), rgba(22, 22, 22, 0.82));
}

.cms-summary span {
  display: block;
  color: var(--blush);
  font-size: 12px;
  font-weight: 800;
}

.cms-summary strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: clamp(20px, 4vw, 30px);
  line-height: 1.2;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(42, 27, 61, 0.34), transparent 46%),
    var(--card);
}

.admin-form label {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-form span {
  color: var(--blush);
  font-size: 13px;
  font-weight: 800;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101010;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.admin-form textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.8;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: rgba(255, 162, 182, 0.62);
  box-shadow: 0 0 0 3px rgba(214, 83, 109, 0.14);
}

.admin-form input[type="color"] {
  padding: 5px;
}

.full-field,
.form-actions,
.admin-status {
  grid-column: 1 / -1;
}

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

.submit-btn,
.ghost-btn {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

.submit-btn {
  border: 1px solid rgba(255, 162, 182, 0.42);
  background: linear-gradient(135deg, var(--flame), var(--rose));
  color: #fff;
  box-shadow: 0 14px 38px rgba(228, 61, 18, 0.2);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
}

.admin-logout {
  min-height: 38px;
}

.admin-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 40;
  transform: translateX(-50%);
  max-width: min(90vw, 460px);
  padding: 12px 16px;
  border: 1px solid rgba(255, 162, 182, 0.3);
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.92);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(214, 83, 109, 0.26);
  backdrop-filter: blur(16px);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

body.reader-light .toast {
  background: rgba(255, 248, 239, 0.94);
  color: var(--text);
}

.reader-content p {
  margin: 0 0 1.45em;
}

.reader-content p:first-child::first-letter {
  float: left;
  margin: 0.12em 0.14em 0 0;
  color: var(--flame);
  font-size: 4em;
  line-height: 0.82;
}

.floating-bookmark {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 24px;
}

[hidden] {
  display: none !important;
}

@media (min-width: 720px) {
  .home-view,
  .reader-view,
  .admin-view {
    padding-inline: 28px;
  }

  .story-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }

  .reader-hero {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 34px;
    padding-top: 42px;
  }

  .reader-hero img {
    width: 220px;
  }

  .floating-bookmark {
    display: none;
  }
}

@media (max-width: 719px) {
  .featured-card {
    min-height: 72vh;
  }

  .featured-card::after {
    background:
      linear-gradient(180deg, rgba(13, 13, 13, 0.12), rgba(13, 13, 13, 0.96)),
      linear-gradient(90deg, rgba(42, 27, 61, 0.84), rgba(13, 13, 13, 0.18));
  }

  .section-head {
    display: block;
  }

  .section-head p {
    margin-top: 5px;
    text-align: left;
  }

  .card-body {
    padding: 12px;
  }

  .reader-top {
    min-height: 64px;
  }

  .reader-toolbar {
    top: 66px;
  }

  .admin-form {
    grid-template-columns: 1fr;
  }

  .cms-summary {
    grid-template-columns: 1fr;
  }

  .header-actions {
    gap: 6px;
  }

  .admin-logout {
    padding-inline: 14px;
  }
}

@media (max-width: 390px) {
  .story-grid {
    gap: 10px;
  }

  .card-body h2 {
    font-size: 18px;
  }

  .card-body p {
    font-size: 13px;
  }

  .reader-hero {
    grid-template-columns: 92px 1fr;
    gap: 14px;
  }

  .reader-hero img {
    width: 92px;
  }
}
