:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #622322;
  background: #f9dfdb;
  font-synthesis: none;
  --paper: #fff8f5;
  --pink-50: #f9dfdb;
  --pink-100: #f3bcc1;
  --pink-200: #e6a8ad;
  --rose: #d05f70;
  --rose-2: #d77687;
  --wine: #a93248;
  --deep: #622322;
  --muted: #936f70;
  --line: rgba(98, 35, 34, .16);
  --shadow: 0 18px 50px rgba(98, 35, 34, .10);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--pink-50); }
body { margin: 0; min-width: 320px; min-height: 100%; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--pink-50);
  background-image:
    linear-gradient(rgba(208,95,112,.11) 50%, transparent 50%),
    linear-gradient(90deg, rgba(208,95,112,.11) 50%, transparent 50%);
  background-size: 64px 64px;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(255,255,255,.25);
  pointer-events: none;
}

.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 48px; }
.brand { text-align: center; margin: 4px 0 22px; }
.brand-bow { font-size: clamp(36px, 7vw, 58px); line-height: 1; filter: saturate(.8); }
.brand h1 { margin: 4px 0 2px; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(34px, 7vw, 58px); letter-spacing: -.03em; color: var(--deep); }
.brand p { margin: 0; font-family: Georgia, "Times New Roman", serif; font-style: italic; color: var(--wine); font-size: clamp(17px, 3vw, 23px); }

.panel { background: rgba(255,248,245,.94); border: 1px solid rgba(169,50,72,.20); border-radius: 28px; box-shadow: var(--shadow); }
.home-card { max-width: 680px; margin: 0 auto; padding: clamp(24px, 5vw, 46px); text-align: center; position: relative; overflow: hidden; }
.home-card::before, .home-card::after { content: "♥"; position: absolute; color: var(--pink-200); font-size: 46px; opacity: .55; transform: rotate(-10deg); }
.home-card::before { left: 24px; top: 24px; }
.home-card::after { right: 24px; bottom: 20px; transform: rotate(12deg); }
.kicker { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; color: var(--wine); }
.home-card h2 { margin: 12px auto 8px; max-width: 520px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(26px, 5vw, 38px); }
.home-card .intro { margin: 0 auto 26px; max-width: 520px; color: var(--muted); line-height: 1.55; }
.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 500px; margin: 0 auto; }

.btn { min-height: 52px; border: 0; border-radius: 16px; padding: 13px 18px; font-weight: 800; cursor: pointer; transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; }
.btn:hover { filter: brightness(.98); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:focus-visible, .cell:focus-visible, input:focus-visible { outline: 3px solid rgba(208,95,112,.36); outline-offset: 2px; }
.btn-primary { background: var(--wine); color: #fff; box-shadow: 0 9px 22px rgba(169,50,72,.18); }
.btn-secondary { background: #fff; color: var(--wine); border: 1px solid rgba(169,50,72,.28); }
.btn-soft { background: var(--pink-50); color: var(--deep); border: 1px solid var(--line); }
.btn-danger { background: #fff; color: #8f2336; border: 1px solid rgba(143,35,54,.25); }
.btn:disabled { opacity: .48; cursor: not-allowed; box-shadow: none; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.topbar .mini-brand { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; }
.back { min-height: 44px; padding: 9px 13px; border-radius: 13px; }

.grid-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.section { padding: clamp(18px, 3.5vw, 30px); }
.section h2, .section h3 { margin: 0 0 14px; }
.section h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 4vw, 34px); }
.section h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .09em; color: var(--wine); }

.room-meta { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 18px; }
.pill { display: inline-flex; align-items: center; min-height: 34px; gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 700; }
.pill strong { color: var(--deep); }

.draw-stage { text-align: center; padding: 16px 0 4px; }
.ball-wrap { width: min(270px, 70vw); aspect-ratio: 1; margin: 6px auto 22px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 34% 27%, #fff 0 9%, #f6d6db 10% 23%, var(--rose-2) 53%, var(--wine) 100%); box-shadow: inset -18px -20px 35px rgba(98,35,34,.20), 0 16px 35px rgba(98,35,34,.16); border: 7px solid rgba(255,255,255,.72); position: relative; }
.ball-wrap::before { content: ""; position: absolute; width: 54%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,248,245,.95); box-shadow: inset 0 0 0 2px rgba(169,50,72,.14); }
.ball-number { position: relative; z-index: 1; font-family: Georgia, "Times New Roman", serif; font-weight: 800; color: var(--deep); font-size: clamp(64px, 16vw, 110px); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.ball-wrap.is-drawing { animation: bob .22s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-3px) rotate(-1deg); } to { transform: translateY(4px) rotate(1deg); } }

.draw-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.draw-actions .btn-primary { min-width: 190px; }
.host-draw-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 720px; margin: 0 auto; }
.host-draw-actions .btn { min-width: 0; width: 100%; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.host-draw-actions .btn-primary { min-width: 0; }

.number-board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.board-number { min-width: 0; aspect-ratio: 1; border-radius: 13px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); font-weight: 850; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-number.drawn { background: var(--pink-100); border-color: rgba(169,50,72,.28); color: var(--deep); }
.board-number.latest { background: var(--wine); color: #fff; transform: scale(1.04); box-shadow: 0 7px 16px rgba(169,50,72,.18); }

.history { display: flex; flex-wrap: wrap; gap: 8px; }
.history-chip { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--pink-50); border: 1px solid var(--line); font-weight: 800; }
.history-chip:first-child { background: var(--wine); color: white; }
.empty { color: var(--muted); font-size: 14px; line-height: 1.5; }

.form-card { max-width: 540px; margin: 0 auto; padding: clamp(22px, 5vw, 38px); }
.form-card h2 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 8px; font-size: clamp(28px, 5vw, 38px); }
.form-card p { color: var(--muted); line-height: 1.5; }
.form { display: grid; gap: 15px; margin-top: 22px; }
.field { display: grid; gap: 7px; text-align: left; }
.field label { font-size: 13px; font-weight: 800; color: var(--deep); }
.field input { width: 100%; min-height: 52px; border: 1px solid rgba(169,50,72,.22); border-radius: 15px; background: #fff; padding: 12px 14px; color: var(--deep); font-size: 16px; }
.pin-input { text-align: center; font-size: 28px !important; letter-spacing: .35em; font-weight: 900; font-variant-numeric: tabular-nums; padding-left: calc(14px + .35em) !important; }
.help { font-size: 12px; color: var(--muted); }
.error { background: #fff0f1; color: #8f2336; border: 1px solid rgba(143,35,54,.18); padding: 11px 13px; border-radius: 13px; font-size: 13px; }
.notice { background: #fff; color: var(--muted); border: 1px solid var(--line); padding: 11px 13px; border-radius: 13px; font-size: 13px; }

.guest-header { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; margin-bottom: 16px; }
.latest-card { min-width: 116px; text-align: center; padding: 12px 16px; border-radius: 18px; background: var(--wine); color: #fff; }
.latest-card span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.latest-card strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 42px; line-height: 1; margin-top: 5px; }

.card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(6px, 1.7vw, 11px); }
.cell { border: 1px solid rgba(169,50,72,.20); background: #fff; color: var(--deep); border-radius: clamp(11px, 2vw, 17px); aspect-ratio: 1; display: grid; place-items: center; font-weight: 900; font-size: clamp(18px, 5vw, 30px); cursor: pointer; position: relative; transition: transform .12s ease, background .16s ease, color .16s ease; }
.cell.marked { background: var(--rose-2); color: white; border-color: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.34); }
.cell.marked::after { content: "♥"; position: absolute; font-size: .56em; right: 7px; top: 5px; color: rgba(255,255,255,.86); }
.cell.drawn:not(.marked) { box-shadow: inset 0 0 0 2px rgba(208,95,112,.16); }

.status-banner { margin: 16px 0; border-radius: 17px; padding: 13px 15px; background: #fff; border: 1px solid var(--line); display: flex; gap: 11px; align-items: center; }
.status-banner .status-icon { font-size: 24px; }
.status-banner strong { display: block; }
.status-banner span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

.participant-list { display: grid; gap: 8px; }
.participant { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 13px; background: #fff; border: 1px solid var(--line); }
.participant span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.participant small { color: var(--muted); text-align: right; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(65,23,23,.42); display: grid; place-items: center; padding: 18px; }
.modal { width: min(430px, 100%); background: var(--paper); border: 1px solid rgba(169,50,72,.22); border-radius: 24px; padding: 24px; box-shadow: 0 30px 80px rgba(65,23,23,.22); }
.modal h3 { font-family: Georgia, "Times New Roman", serif; font-size: 25px; margin: 0 0 8px; }
.modal p { color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.celebrate { text-align: center; }
.celebrate .big { font-size: 58px; }
.celebrate h3 { font-size: 34px; color: var(--wine); }

.footer-note { text-align: center; color: rgba(98,35,34,.58); font-size: 12px; margin-top: 20px; }
.app-version { opacity: .58; margin-left: 5px; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  body::before, body::after { position: absolute; min-height: 100%; }
  .grid-layout { grid-template-columns: 1fr; }
  .host-side { order: 2; }
  .guest-header { grid-template-columns: 1fr; }
  .latest-card { min-width: 0; width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .latest-card strong { margin: 0; }
}
@media (max-width: 560px) {
  body::before { background-size: 46px 46px; }
  .app-shell { width: min(100% - 18px, 1180px); padding-top: 15px; }
  .home-actions { grid-template-columns: 1fr; }
  .home-card::before, .home-card::after { font-size: 30px; }
  .panel { border-radius: 22px; }
  .section { padding: 16px; }
  .number-board { gap: 6px; }
  .board-number { border-radius: 10px; font-size: 13px; }
  .host-draw-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .host-draw-actions .btn-primary { grid-column: 1 / -1; width: 100%; }
  .host-draw-actions .btn { min-height: 46px; padding: 10px 6px; font-size: 12px; }
  .btn { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

.section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.section-heading h3 { margin:0; }
.btn-small { min-height:36px; padding:8px 12px; border-radius:12px; font-size:13px; }

/* v0.2.0 — aniversariante + experiência estável */
.home-card-photo {
  max-width: 1100px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(300px, .72fr);
  align-items: stretch;
  text-align: left;
  isolation: isolate;
}
.home-card-photo::before { left: 26px; top: 24px; z-index: 0; }
.home-card-photo::after { right: 24px; bottom: 20px; z-index: 0; }
.home-copy {
  position: relative;
  z-index: 2;
  padding: clamp(30px, 5vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.home-card-photo h2,
.home-card-photo .intro { margin-left: 0; margin-right: 0; }
.home-card-photo h2 { max-width: 560px; }
.home-card-photo .intro { max-width: 570px; margin-bottom: 24px; }
.home-card-photo .home-actions { max-width: 560px; margin: 0; width: 100%; }
.home-card-photo .home-actions.has-host-resume { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 610px; gap: 9px; }
.home-card-photo .home-actions.has-host-resume .btn { min-width: 0; padding-left: 10px; padding-right: 10px; font-size: 13px; white-space: nowrap; }
.home-resume { margin-top: 12px; max-width: 520px; }
.home-resume .btn { width: 100%; }
.home-notice { margin: 0 0 16px; max-width: 520px; }
.home-config { margin-top: 16px; max-width: 520px; }
.home-photo {
  min-height: 470px;
  position: relative;
  display: grid;
  place-items: end center;
  overflow: hidden;
  padding: 28px 18px 0 0;
  background: linear-gradient(145deg, rgba(243,188,193,.28), rgba(255,248,245,.10));
}
.home-photo-glow {
  position: absolute;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.56);
  border: 1px solid rgba(169,50,72,.12);
  box-shadow: 0 24px 60px rgba(169,50,72,.10);
  top: 10%;
  left: 10%;
}
.home-photo img {
  position: relative;
  z-index: 2;
  width: min(100%, 365px);
  max-height: 455px;
  object-fit: contain;
  object-position: center bottom;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 18px 22px rgba(98,35,34,.12));
}
.home-photo-badge {
  position: absolute;
  z-index: 3;
  right: 22px;
  top: 28px;
  background: rgba(255,248,245,.92);
  color: var(--wine);
  border: 1px solid rgba(169,50,72,.18);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .02em;
  box-shadow: 0 8px 20px rgba(98,35,34,.08);
}

.guest-header {
  grid-template-columns: minmax(0, 1fr) 105px auto;
  align-items: center;
  gap: 14px;
}
.guest-title h2 { margin: 7px 0 7px; }
.guest-nair {
  width: 105px;
  height: 120px;
  display: grid;
  place-items: end center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(243,188,193,.18), rgba(255,255,255,.72));
  border: 1px solid rgba(169,50,72,.12);
  overflow: hidden;
}
.guest-nair img {
  width: 94px;
  height: 112px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 7px 10px rgba(98,35,34,.10));
  user-select: none;
  -webkit-user-drag: none;
}
.card-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.card-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend-marked { background: var(--rose-2); }
.legend-drawn { background: #fff; border: 2px solid rgba(208,95,112,.42); }
.cell.drawn:not(.marked)::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  left: 7px;
  top: 7px;
  background: var(--rose);
  opacity: .72;
}
.cell:disabled { cursor: default; }

.celebrate-photo {
  width: 112px;
  height: 138px;
  object-fit: contain;
  margin: -8px auto -6px;
  display: block;
  filter: drop-shadow(0 10px 14px rgba(98,35,34,.12));
}

@media (max-width: 820px) {
  .home-card-photo {
    grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr);
  }
  .home-card-photo .home-actions.has-host-resume { grid-template-columns: 1fr 1fr; }
  .home-card-photo .home-actions.has-host-resume #resumeHost { grid-column: 1 / -1; }
  .home-copy { padding: 30px; }
  .home-photo { min-height: 410px; padding-right: 8px; }
  .home-photo img { max-height: 395px; }
  .guest-header { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .guest-title { grid-column: 1 / -1; }
  .guest-nair { width: 92px; height: 102px; }
  .guest-nair img { width: 82px; height: 96px; }
  .latest-card { width: auto; min-width: 0; }
}

@media (max-width: 650px) {
  .home-card-photo { grid-template-columns: 1fr; text-align: center; }
  .home-copy { padding: 26px 22px 8px; }
  .home-card-photo h2,
  .home-card-photo .intro { margin-left: auto; margin-right: auto; }
  .home-card-photo .home-actions,
  .home-card-photo .home-actions.has-host-resume,
  .home-resume,
  .home-notice,
  .home-config { max-width: none; margin-left: 0; margin-right: 0; }

  .home-card-photo .home-actions.has-host-resume { grid-template-columns: 1fr; }
  .home-card-photo .home-actions.has-host-resume #resumeHost { grid-column: auto; }
  .home-photo {
    min-height: 290px;
    padding: 0 10px;
    background: transparent;
  }
  .home-photo-glow { width: 64%; top: 7%; left: 18%; }
  .home-photo img { width: min(74vw, 280px); max-height: 286px; }
  .home-photo-badge { top: 16px; right: 18px; }
}

@media (max-width: 420px) {
  .guest-header { gap: 10px; }
  .guest-nair { width: 74px; height: 86px; border-radius: 14px; }
  .guest-nair img { width: 68px; height: 82px; }
  .latest-card { padding: 10px 12px; }
  .latest-card strong { font-size: 36px; }
  .card-grid { gap: 6px; }
  .cell { font-size: clamp(17px, 6vw, 25px); }
}

/* v0.2.1 — alinhamento dos controles em desktop/mobile */
