@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&display=swap');

:root { color-scheme: dark; font-family: "DM Sans", sans-serif; background: #181522; color: #efceff; --muted: #d2b9e4; --line: #453852; --accent: #E8C6FF; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #efd0ff; outline-offset: 4px; }
.top { max-width: 1160px; margin: auto; padding: 20px clamp(16px, 5vw, 52px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 12px; }
.logo { text-decoration: none; font: 52px/1 "Instrument Serif", Georgia, serif; }
.logo span, .label { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px clamp(12px, 4vw, 28px); }
nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-underline-offset: 7px; }
main, footer { max-width: 1160px; margin: 0 auto; padding: 36px clamp(16px, 5vw, 52px); }
main { min-height: 64vh; }
footer { color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
footer span { padding: 0 8px; }
.welcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.preview-story { max-width: 72ch; }
h1 { font: clamp(42px, 7vw, 76px)/.99 "Instrument Serif", Georgia, serif; margin: 12px 0 22px; }
h2 { margin: 0 0 14px; font-size: 23px; }
p { color: var(--muted); line-height: 1.6; }
.label { letter-spacing: .13em; font-size: 11px; font-weight: 700; }
.plan, .panel, .story { border-radius: 18px; background: #241d30; border: 1px solid var(--line); padding: clamp(19px, 4vw, 28px); }
.panel { margin-top: 20px; }
.plan > small { margin-top: 10px; display: block; color: var(--muted); }
.price { color: var(--accent); font-size: 34px; margin: 0; }
.price small { font-size: 15px; color: var(--muted); }
button, .button { color: #22142d; background: var(--accent); border: 1px solid transparent; border-radius: 11px; padding: 11px 16px; font: inherit; font-weight: 700; cursor: pointer; display: inline-block; text-decoration: none; }
.categories { display: flex; gap: 8px; flex-wrap: wrap; margin: 15px 0; }
.chip, .secondary { border: 1px solid var(--line); background: #221a2e; color: var(--muted); border-radius: 999px; padding: 8px 13px; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--accent); color: #22142d; }
.feed-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.feed-heading h1 { margin-bottom: 12px; }
.form { max-width: 690px; display: grid; gap: 14px; }
label, legend { font-weight: 700; }
input:not([type="checkbox"], [type="radio"]), select, textarea { display: block; width: 100%; margin-top: 7px; font: inherit; padding: 12px; color: inherit; border-radius: 9px; background: #181522; border: 1px solid var(--line); }
textarea { resize: vertical; min-height: 180px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; padding: 13px; }
fieldset label { display: block; margin: 6px 0; font-weight: 400; }
.form button { justify-self: start; }
.hint, .meta { font-size: 14px; color: var(--muted); }
.story { margin-top: 12px; }
.story p { white-space: pre-wrap; overflow-wrap: anywhere; }
.discussion { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.discussion textarea { min-height: 92px; }
.comment { border-left: 2px solid var(--line); margin: 12px 0; padding-left: 12px; }
.comment p { margin: 5px 0 0; }
.install-dialog { width: min(450px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #241d30; color: inherit; }
.install-dialog::backdrop { background: #100c17bd; }
[hidden] { display: none !important; }
@media (max-width: 650px) { main { padding-top: 24px; } }

.top .home-login { display: none; }
.top nav a > span { display: none; }
body:has(.home-landing) {
  --muted: #E9D8FD;
  background: radial-gradient(ellipse at 50% 0, #2b1d38 0, #181522 64rem);
}
body:has(.home-landing) .top .home-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding-inline: 20px;
}
.home-landing {
  display: grid;
  gap: clamp(30px, 5vw, 52px);
  animation: home-arrive 360ms ease-out both;
}
.home-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 14px;
  overflow: hidden;
  padding: 20px 20px 25px;
  border: 1px solid #604568;
  border-radius: 20px;
  background: radial-gradient(ellipse at 65% 5%, #4a2b60, #281d35 55%, #21192b);
}
.home-emblem {
  display: block;
  width: 108px;
  height: auto;
  justify-self: start;
  border: 1px solid #705380;
  border-radius: 20px;
  box-shadow: 0 16px 32px #10091955;
}
.home-hero h1 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(47px, 7.1vw, 86px);
  line-height: .96;
  letter-spacing: -.025em;
}
.home-hero h1 em { color: var(--accent); font-weight: inherit; }
.home-hero p { max-width: 45ch; margin: 15px 0 0; }
.home-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.home-landing .button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.home-landing .button:hover, .home-login:hover { outline: 1px solid var(--accent); outline-offset: 2px; }
.home-actions .secondary {
  border: 1px solid #9774aa;
  border-radius: 11px;
  background: transparent;
  font-size: inherit;
}
.home-hero .home-note { margin-top: 14px; font-size: 14px; }
.home-landing h2 { margin: 0 0 14px; font: 36px/1.08 "Instrument Serif", Georgia, serif; }
.home-topics { min-width: 0; }
.home-category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 10px;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: #9774aa #281d35;
}
.home-category-strip li {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: #241d30;
  color: var(--muted);
  white-space: nowrap;
}
.home-category-strip .home-age { gap: 6px; }
.home-steps {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.home-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #241d30;
}
.home-step-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  height: 38px;
  border-radius: 11px;
  background: #392749;
  color: var(--accent);
  font-size: 21px;
}
.home-plan {
  display: grid;
  gap: 17px;
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid #62486e;
  border-radius: 20px;
  background: linear-gradient(120deg, #39264a, #251c32);
}
.home-plan h2 { margin-bottom: 12px; }
.home-plan h2 span { color: var(--accent); white-space: nowrap; }
.home-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.home-benefits span { color: var(--accent); }
body:has(.home-landing) #install-elos { min-height: 48px; }
@keyframes home-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .home-landing { animation: none; } }
@media (min-width: 700px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 31%);
    align-items: center;
    gap: clamp(24px, 5vw, 66px);
    padding: clamp(28px, 5vw, 58px);
    background: radial-gradient(ellipse at 82% 40%, #503169, #2d203d 58%, #231b2f);
  }
  .home-emblem { width: 100%; max-width: 292px; grid-column: 2; grid-row: 1; border-radius: 20px; }
  .home-intro { grid-column: 1; grid-row: 1; }
  .home-actions { flex-direction: row; flex-wrap: wrap; }
  .home-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-plan { grid-template-columns: 1fr auto; align-items: center; }
}

body:has(.top nav:not([hidden])) { --muted: #E9D8FD; }
#app:has(.internal-list, #compose, .compose-success, .profile-details) {
  max-width: 880px;
  animation: home-arrive 280ms ease-out both;
}
#app:has(.internal-list, #compose, .compose-success, .profile-details) :is(button, .button) {
  min-height: 48px;
  transition: background-color 160ms ease, border-color 160ms ease;
}
#app:has(.internal-list, #compose, .compose-success, .profile-details) .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.categories {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 6px 5px 10px;
  scrollbar-width: thin;
  scrollbar-color: #795995 transparent;
}
.categories .chip { flex: 0 0 auto; white-space: nowrap; }
.internal-empty, .reader-offer {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #241d30;
  padding: clamp(20px, 4vw, 32px);
}
.internal-empty { text-align: center; margin-top: 22px; }
.internal-empty p { margin: 0 0 18px; }
.reader-card { margin-top: 14px; scroll-margin-top: 16px; min-width: 0; }
.reader-card summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.reader-card summary::-webkit-details-marker { display: none; }
.reader-card summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.story-category, .story-status {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #3b2b4a;
  color: #E9D8FD;
}
.story-title, .profile-stories .story h3 {
  font: 36px/1.04 "Instrument Serif", Georgia, serif;
  overflow-wrap: anywhere;
}
.story-title, .story-excerpt, .story-category { grid-column: 1 / -1; }
.story-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.55;
  color: var(--muted);
  mask-image: linear-gradient(180deg, #000 55%, #0004);
}
.story-duration { font-size: 13px; color: var(--muted); }
.story-open { color: var(--accent); font-weight: 700; min-height: 48px; display: inline-grid; align-items: center; }
.story-back { display: none; }
.reader-card[open] .story-back {
  grid-column: 1 / -1;
  min-height: 48px;
  display: grid;
  align-items: center;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  font-size: 14px;
}
.reader-card[open] :is(.story-excerpt, .story-open) { display: none; }
.reader-card[open] .story-duration::after { content: " · Anônimo"; }
#app:has(.reader-card[open]) > :not(.internal-list),
.internal-list:has(.reader-card[open]) > :not(.reader-card[open]) { display: none; }
.reader-content { margin-top: 18px; }
.reader-content > p:empty { display: none; }
.reader-preview { margin-bottom: 0; padding-bottom: 12px; mask-image: linear-gradient(180deg, #000 calc(100% - 2.4em), transparent); }
.reader-offer, .profile-plan { background: linear-gradient(135deg, #39264a, #281e35); border-color: #62486e; }
.reader-offer h2 { font: 36px/1 "Instrument Serif", Georgia, serif; }
.reader-offer > .button { width: 100%; }
.shared-login { margin-inline-start: 8px; }
.reader-benefits { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); }
.reader-benefits li::before { content: "✔ "; color: var(--accent); }
.reader-actions { gap: 8px; }
#compose { max-width: none; }
#compose :is(input:not([type="checkbox"]), select), .profile-details input { min-height: 48px; }
#compose textarea { min-height: 180px; font-weight: 400; }
#compose :is(input, textarea)::placeholder { color: #E9D8FD; opacity: .83; }
.character-count { margin: -8px 0 0; text-align: right; }
.compose-confirm {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  cursor: pointer;
}
.compose-confirm input { width: 23px; height: 23px; flex: 0 0 23px; accent-color: var(--accent); margin: 0; }
.compose-privacy { padding: 14px; margin: 0; background: #362646; border-radius: 12px; font-size: 14px; }
.compose-success { text-align: center; padding-block: 42px; }
.compose-success h1 { margin: 0 0 14px; }
.profile-details .hint { margin: -7px 0 0; }
.profile-price { font-size: 24px; color: var(--accent); margin: 12px 0; }
.profile-stories .story h3 { margin: 16px 0 8px; }
.profile-stories .story .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.story-status.pending { background: #4b391c; color: #ffe397; }
.story-status.approved { background: #233f33; color: #a8efc2; }
.story-status.rejected { background: #4e2934; color: #ffb5c6; }
.profile-footer { margin-top: 20px; }
.logout-link { color: var(--muted); background: transparent; text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 768px) {
  body:has(.top nav:not([hidden])) { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .top nav:not([hidden]) {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    background: #21182b;
    border-top: 1px solid var(--line);
  }
  .top nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    font-size: 12px;
    border-radius: 12px;
  }
  .top nav a > span { display: block; font-size: 18px; line-height: 1; }
  .top nav .nav-bookmark { width: 12px; height: 18px; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
  .top nav a[aria-current="page"] { background: #39264a; text-decoration: none; }
  .top nav a[href="#contar"] { color: #22142d; background: var(--accent); font-weight: 700; }
  .top nav a[href="#contar"][aria-current="page"] { box-shadow: inset 0 0 0 3px #a074bf; }
  #app:has(.internal-list) .feed-heading > .button { display: none; }
  #compose > button { justify-self: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  #app:has(.internal-list, #compose, .compose-success, .profile-details) { animation: none; }
  #app:has(.internal-list, #compose, .compose-success, .profile-details) :is(button, .button) { transition: none; }
}
.subscription-pix :is(button, .button) { min-height: 48px; }
.subscription-qr { display: block; width: min(100%, 230px); height: auto; margin: 0 0 18px; }
.subscription-pix input { margin-bottom: 12px; }
