/*
  Cambia los colores principales aqui.
  La paleta usa crema, rosa suave, amarillo mantequilla y verde suave.
*/
:root {
  --cream: #fff8ec;
  --paper: #fffdf8;
  --paper-warm: #fff3df;
  --rose: #f8cfd8;
  --rose-deep: #a95f70;
  --butter: #ffe8a7;
  --butter-soft: #fff4cf;
  --mint: #d5ead1;
  --mint-deep: #6f9b79;
  --ink: #4f4541;
  --muted: #80736c;
  --line: #efdccc;
  --shadow: 0 18px 50px rgba(118, 83, 67, 0.12);
  --soft-shadow: 0 10px 24px rgba(118, 83, 67, 0.1);
  --radius: 24px;
  --radius-small: 16px;
  --max-read: 68ch;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, rgba(248, 207, 216, 0.45), transparent 30rem),
    radial-gradient(circle at 100% 12rem, rgba(213, 234, 209, 0.55), transparent 26rem),
    linear-gradient(180deg, var(--cream), #fffaf2 42%, #fff7eb);
  font-family: "Nunito", "Quicksand", "Hiragino Sans", "Yu Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.hidden {
  display: none !important;
}

.fade-in,
.page.is-active,
.fade-item {
  animation: fadeIn 360ms ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid rgba(239, 220, 204, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.decor-row {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 4px;
}

/* Cambia estos PNG por tus estrellas, flores, gatos o cintas en /assets. */
.decor-png {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(118, 83, 67, 0.12));
}

.decor-star {
  transform: rotate(-9deg);
}

.decor-ribbon {
  width: 68px;
  height: 68px;
}

.decor-flower {
  transform: rotate(8deg);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rose-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 9vw, 3rem);
}

h2 {
  font-size: clamp(1.45rem, 7vw, 2.2rem);
}

h3 {
  font-size: 1.08rem;
}

.soft-copy {
  margin: 14px 0 24px;
  color: var(--muted);
}

.soft-form {
  display: grid;
  gap: 10px;
}

.soft-form label,
.search-box span,
.select-box span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.soft-form input,
.soft-form select,
.soft-form textarea,
.search-box input,
.select-box select,
.reader-password {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf2;
  color: var(--ink);
  outline: none;
  padding: 0 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.soft-form textarea {
  min-height: 220px;
  border-radius: var(--radius-small);
  padding: 14px 16px;
  resize: vertical;
}

.soft-form input[type="file"] {
  padding: 12px 16px;
}

.soft-form input:focus,
.soft-form select:focus,
.soft-form textarea:focus,
.search-box input:focus,
.select-box select:focus,
.reader-password:focus {
  border-color: var(--rose-deep);
  box-shadow: 0 0 0 4px rgba(248, 207, 216, 0.45);
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--rose-deep);
  font-size: 0.9rem;
}

.primary-button,
.ghost-button,
.mini-button,
.favorite-button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  padding: 0 18px;
  background: linear-gradient(135deg, var(--rose), var(--butter));
  color: #5d4038;
  font-weight: 900;
  box-shadow: var(--soft-shadow);
}

.ghost-button,
.mini-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  color: var(--ink);
  font-weight: 800;
}

.primary-button:hover,
.ghost-button:hover,
.mini-button:hover,
.favorite-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 92px;
}

.app-shell.reader-mode {
  padding-bottom: 0;
}

.app-shell.reader-mode .tabbar {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(239, 220, 204, 0.68);
  background: rgba(255, 248, 236, 0.82);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 950;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.content-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 20px 16px 34px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.section-heading {
  margin: 8px 0 16px;
}

.section-heading.compact {
  margin-top: 0;
}

.library-heading {
  display: grid;
  gap: 12px;
}

.latest-slot,
.library-panel,
.profile-card,
.reader-lock,
.reader-article {
  border: 1px solid rgba(239, 220, 204, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--soft-shadow);
}

.latest-slot {
  padding: 16px;
}

.library-panel {
  margin-top: 18px;
  padding: 16px;
}

.latest-card,
.profile-card {
  position: relative;
  overflow: hidden;
}

.latest-card {
  display: grid;
  gap: 14px;
}

.latest-card::after,
.profile-card::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -28px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(213, 234, 209, 0.35);
  pointer-events: none;
}

.post-cover {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  object-fit: contain;
  padding: 12px;
  background: var(--butter-soft);
}

.post-card {
  display: grid;
  gap: 12px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(239, 220, 204, 0.95);
  border-radius: var(--radius-small);
  background: rgba(255, 253, 248, 0.84);
  box-shadow: 0 8px 20px rgba(118, 83, 67, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(248, 207, 216, 0.95);
  box-shadow: 0 12px 26px rgba(118, 83, 67, 0.12);
}

.post-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.post-card-body {
  min-width: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.post-excerpt {
  margin: 8px 0 0;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(248, 207, 216, 0.9);
  border-radius: 999px;
  background: rgba(255, 244, 207, 0.62);
  color: #72564e;
  font-size: 0.78rem;
  font-weight: 850;
}

.card-actions,
.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

.favorite-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 118px;
  padding: 0 12px;
  border: 1px solid rgba(239, 220, 204, 0.95);
  background: #fffaf2;
  color: var(--ink);
  font-weight: 900;
}

.favorite-button img {
  width: 20px;
  height: 20px;
}

.favorite-button.is-favorite {
  border-color: rgba(169, 95, 112, 0.34);
  background: rgba(248, 207, 216, 0.58);
}

.controls {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.search-box,
.select-box {
  display: grid;
  gap: 6px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.82);
}

.segmented-control button {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segmented-control button.is-selected {
  background: var(--mint);
  color: #415f49;
  box-shadow: 0 6px 14px rgba(111, 155, 121, 0.18);
}

.post-grid {
  display: grid;
  gap: 12px;
}

.empty-state {
  margin: 18px 0 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-small);
  background: rgba(255, 244, 207, 0.46);
  color: var(--muted);
  text-align: center;
}

.profile-card {
  padding: 18px;
}

.profile-hero {
  display: grid;
  gap: 14px;
}

.profile-avatar {
  width: 106px;
  height: 106px;
  padding: 14px;
  border-radius: 34px;
  background: var(--paper-warm);
  object-fit: contain;
}

.profile-facts {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.profile-facts li {
  padding: 10px 12px;
  border-radius: var(--radius-small);
  background: rgba(213, 234, 209, 0.34);
  color: #496150;
  font-weight: 800;
}

.profile-posts {
  margin-top: 18px;
}

.reader-lock,
.reader-article {
  padding: 18px;
}

.reader-lock {
  display: grid;
  gap: 14px;
}

.reader-lock form {
  display: grid;
  gap: 10px;
}

.reader-article {
  max-width: calc(var(--max-read) + 44px);
  margin: 0 auto;
}

.reader-heading {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.reader-heading h1 {
  font-size: clamp(2rem, 10vw, 3.8rem);
}

.reader-body {
  max-width: var(--max-read);
  margin: 0 auto;
  font-size: 1.04rem;
  line-height: 1.82;
}

.reader-body p {
  margin: 0 0 1.2em;
}

.reader-body h2 {
  margin: 1.7em 0 0.6em;
  font-size: 1.45rem;
}

.reader-image {
  margin: 1.8em auto;
}

.reader-image img {
  width: 100%;
  max-height: 460px;
  border-radius: 22px;
  object-fit: cover;
  background: var(--paper-warm);
  box-shadow: var(--soft-shadow);
}

.reader-image figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.reader-quote {
  margin: 1.5em 0;
  padding: 14px 16px;
  border-left: 4px solid var(--rose);
  border-radius: var(--radius-small);
  background: rgba(255, 244, 207, 0.48);
  color: #6d5a54;
}

.tabbar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(239, 220, 204, 0.9);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tab-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab-button img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.tab-button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-button.is-active {
  background: rgba(248, 207, 216, 0.54);
  color: #70404b;
}

noscript {
  display: block;
  margin: 24px;
  padding: 16px;
  border-radius: 16px;
  background: var(--paper);
}

@media (min-width: 720px) {
  .content-shell {
    padding: 30px 24px 56px;
  }

  .app-shell {
    padding-bottom: 42px;
  }

  .topbar {
    padding-inline: 24px;
  }

  .latest-card,
  .profile-hero {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .library-heading {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .controls {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 210px);
    align-items: end;
  }

  .segmented-control {
    grid-column: 1 / -1;
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabbar {
    right: 24px;
    bottom: 22px;
    left: 50%;
    width: min(440px, calc(100% - 48px));
    transform: translateX(-50%);
  }
}

@media (min-width: 940px) {
  .controls {
    grid-template-columns: minmax(260px, 1fr) minmax(180px, 220px) minmax(260px, 300px);
  }

  .segmented-control {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
