:root {
  --teal: #1A7A8A; --teal-dark: #0B4450; --bg: #FFFDF5; --surface: #FFFFFF; --text: #1A1A2E;
  --muted: #5A5A6E; --border: rgba(0, 0, 0, .12); --selected: rgba(26, 122, 138, .14);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121218; --surface: #1E1E2A; --text: #F5F5F5; --muted: #B5B5C5; --border: rgba(255,255,255,.14); --teal: #5BB5C0; --selected: rgba(91,181,192,.2); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; color: var(--teal); }
.icon-btn { font-size: 22px; background: none; border: 0; color: var(--text); min-width: 48px; min-height: 48px; cursor: pointer; }
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { background: var(--selected); color: var(--text); }
.lang-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; min-width: 170px; z-index: 5; }
.lang-menu .menu button { display: flex; justify-content: space-between; width: 100%; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: 10px; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.lang-menu .menu button:hover, .lang-menu .menu button[aria-checked="true"] { background: var(--selected); }
.lang-menu .menu button[aria-checked="true"] { font-weight: 600; color: var(--teal); }
h1 { font-family: Georgia, serif; font-size: clamp(24px, 6vw, 30px); line-height: 1.2; margin: 8px 0; }
h2 { font-size: 20px; margin: 0 0 12px; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.label { font-weight: 600; margin: 16px 0 8px; color: var(--muted); }
button, a.primary, a.secondary { font: inherit; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.card { position: relative; aspect-ratio: 6 / 5; border: 0; border-radius: 20px; padding: 0; overflow: hidden; cursor: pointer;
  background-size: cover; background-position: center; text-align: left; color: #fff; }
.card.wide { grid-column: span 2; aspect-ratio: 2 / 1; }
.card-text { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px;
  background: linear-gradient(transparent 35%, rgba(0,0,0,.8)); }
.card-text strong { font-size: 20px; } .card-text small { font-size: 13px; opacity: .92; }
.card:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.progress { height: 8px; border-radius: 4px; background: var(--selected); overflow: hidden; margin: 6px 0 16px; }
.progress span { display: block; height: 100%; background: var(--teal); }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.options .option:last-child:nth-child(odd) { grid-column: span 2; }
.option { min-height: 96px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; cursor: pointer; font-weight: 600; text-align: center; }
.option.selected { border: 2px solid var(--teal); background: var(--selected); }
.emoji { font-size: 28px; }
textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; resize: vertical; }
.counter { text-align: right; margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.chips, .tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.chip.selected { background: var(--selected); border-color: var(--teal); font-weight: 600; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 20px; border-radius: 16px;
  font-weight: 600; text-decoration: none; cursor: pointer; width: 100%; margin-top: 12px; }
.primary { background: var(--teal); color: #fff; border: 0; }
.primary:disabled { opacity: .45; cursor: default; }
.secondary { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.text-btn { background: none; border: 0; color: var(--teal); font-weight: 600; min-height: 48px; padding: 0 12px; cursor: pointer; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 60vh; gap: 8px; }
.narrow { max-width: 480px; margin: 0 auto; }
.big-emoji { font-size: 48px; margin: 0; }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 4px solid var(--selected); border-top-color: var(--teal); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.quote-frame { aspect-ratio: 9 / 16; height: min(52vh, 560px); max-width: 100%; margin-inline: auto; border-radius: 20px; overflow: hidden; background: var(--surface); margin-top: 4px; }
.quote-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tabs { margin: 14px 0 8px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumb { flex: none; width: 56px; aspect-ratio: 4 / 5; border-radius: 12px; border: 1px solid var(--border); background-size: cover; background-position: center; cursor: pointer; }
.thumb.selected { border: 3px solid var(--teal); }
.actions { display: flex; justify-content: space-around; margin: 8px 0; }
.share-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 4px 16px 16px; }
.app-banner { display: block; text-align: center; margin: 20px 0 0; padding: 14px; border-radius: 16px; background: var(--selected); color: var(--teal); font-weight: 600; text-decoration: none; }
.help { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin: 12px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row > * { flex: 1; } .row.end { justify-content: flex-end; } .row.end > * { flex: none; width: auto; }
dialog { border: 0; border-radius: 20px; padding: 20px; background: var(--surface); color: var(--text); max-width: 92vw; width: 400px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
.radio { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #222; color: #fff;
  padding: 12px 18px; border-radius: 12px; max-width: 90vw; text-align: center; z-index: 10; }

/* Home: search, featured cards, smaller tiles by group */
.search input { width: 100%; min-height: 48px; padding: 0 16px 0 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23888' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px center; color: var(--text); font: inherit; margin: 8px 0 4px; }
.search input:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
h2.group { font-size: 15px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; letter-spacing: .02em; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { display: flex; align-items: center; gap: 10px; min-height: 68px; padding: 8px 10px 8px 8px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; font: inherit; min-width: 0; }
.tile:hover { border-color: var(--teal); }
.tile .thumb { flex: none; width: 42px; height: 42px; border-radius: 10px; background-size: cover; background-position: center; }
.tile-text { display: flex; flex-direction: column; min-width: 0; }
.tile-text strong { font-size: 14px; line-height: 1.25; } .tile-text small { font-size: 12px; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile.create { grid-column: 1 / -1; justify-content: center; margin-top: 10px; font-weight: 600; color: var(--teal); width: 100%; }
.card.wide.custom { grid-column: auto; aspect-ratio: auto; min-height: 96px; width: 100%; margin-top: 18px; }
[data-results] .tiles { margin-top: 8px; }
/* Result: refine chips */
.refine { margin-top: 10px; }
.refine .label { margin: 4px 0 6px; font-size: 13px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-bottom: 6px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
/* Featured: always 4 cards in one row. */
.featured { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.featured .card { aspect-ratio: 3 / 4; min-width: 0; border-radius: 16px; }
.featured .card-text { padding: 8px 2px; align-items: center; text-align: center; gap: 2px; } .featured .card-text .emoji { font-size: 22px; line-height: 1; } .featured .card-text strong { font-size: clamp(11px, 3vw, 14px); letter-spacing: -0.2px; line-height: 1.2; overflow-wrap: normal; word-break: keep-all; }
/* "Para o seu momento" and "Do seu jeito": one full row each, under the featured cards. */
.banners { display: grid; gap: 8px; margin-top: 8px; }
.card.wide.banner { grid-column: auto; aspect-ratio: auto; min-height: 84px; width: 100%; }
.card.wide.banner .card-text { justify-content: center; padding: 12px 16px; background: linear-gradient(90deg, rgba(0,0,0,.7), rgba(0,0,0,.15)); }
.card.wide.banner strong { font-size: 18px; } .card.wide.banner small { font-size: 13px; }

/* Clean home: photos only on the 4 featured cards; the rest is light. */
:root { --tint-day: #FFF1D6; --tint-faith: #EDE7FB; --tint-inspiration: #E3F4EC; --tint-relations: #FDE6EA; --tint-celebrate: #E4F0FB; }
@media (prefers-color-scheme: dark) {
  :root { --tint-day: #3A3122; --tint-faith: #2E2A40; --tint-inspiration: #22352D; --tint-relations: #3B2A2F; --tint-celebrate: #23303D; }
}
h2.group { margin: 26px 0 10px; }
.tile { min-height: 60px; gap: 12px; }
.tile .icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--selected); }
.tile.day .icon { background: var(--tint-day); } .tile.faith .icon { background: var(--tint-faith); }
.tile.inspiration .icon { background: var(--tint-inspiration); } .tile.relations .icon { background: var(--tint-relations); }
.tile.celebrate .icon { background: var(--tint-celebrate); }
.tile-text small { -webkit-line-clamp: 1; }
.shortcut { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 16px; border-radius: 18px; border: 1px solid var(--border); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.shortcut .icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--surface); }
.shortcut strong { font-size: 16px; } .shortcut .tile-text small { -webkit-line-clamp: 1; }
.shortcut .arrow { margin-left: auto; font-size: 26px; color: var(--muted); }
.shortcut.moment { background: linear-gradient(120deg, var(--tint-inspiration), var(--surface)); }
.shortcut.own { background: linear-gradient(120deg, var(--tint-celebrate), var(--surface)); }
.shortcut:hover { border-color: var(--teal); }
.banners { gap: 10px; margin-top: 12px; }
.tile { min-height: 56px; } .tile-text strong { font-size: 15px; }
/* Featured: name only, on a stronger dark fade so it reads on light photos. */
.featured .card-text { background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.82) 100%); padding: 10px 4px; }
.featured .card-text strong { text-shadow: 0 1px 3px rgba(0,0,0,.6); }
/* Three cards in one row, icon above the name. */
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.three .tile { flex-direction: column; justify-content: center; text-align: center; gap: 6px; padding: 12px 6px; min-height: 92px; }
.tiles.three .tile-text strong { font-size: 14px; }
/* A smaller title, so the content starts higher. */
h1.home-title { font-size: clamp(22px, 5.4vw, 26px); }
/* Result: share always in view at the bottom; one options panel at a time. */
.result { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.result .actions { margin: 6px 0 4px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--selected); margin: 4px 0 10px; }
.segmented button { min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.panel .tabs { margin: 0 0 8px; }
.panel .refine { margin-top: 0; }
.share-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.share-bar .primary { flex: 1; margin: 0; }
.share-bar .secondary.icon-only { flex: none; width: 56px; margin: 0; font-size: 22px; }
.result .actions .text-btn { white-space: nowrap; font-size: 14px; padding: 6px 8px; min-height: 40px; }
/* Result: modern selection controls. Soft pills (filled when chosen), round actions. */
.result .chip { border: 0; background: color-mix(in srgb, var(--text) 7%, transparent); min-height: 38px; padding: 8px 16px; font-weight: 500; }
.result .chip.selected { background: var(--teal); color: #fff; font-weight: 600; }
.result .tabs .chip { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.actions.round { display: flex; justify-content: space-evenly; margin: 8px 0 6px; }
.actions.round .action { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 72px; padding: 4px 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; border-radius: 14px; }
.actions.round .action span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); font-size: 18px; }
.actions.round .action:hover span { background: color-mix(in srgb, var(--teal) 26%, transparent); }
.segmented { border-radius: 999px; padding: 4px; }
.segmented button { border-radius: 999px; }
.thumb { border-radius: 14px; }
/* Compact share bar. */
.share-bar { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.share-bar .primary, .share-bar .secondary { min-height: 46px; border-radius: 14px; }
.share-bar .secondary.icon-only { width: 50px; font-size: 20px; }
.result { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
/* Refine tiles: like background thumbnails (emoji and name; the chosen one with a colored border). */
.opt { flex: none; width: 76px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 4px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); font: inherit; cursor: pointer; }
.opt span { font-size: 20px; line-height: 1; } .opt small { font-size: 11px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt.selected { border: 3px solid var(--teal); }
.refine .tabs { margin: 0 0 8px; }
.opt { width: 86px; height: 72px; } .opt small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; text-align: center; }
