:root {
  color-scheme: light;
  --paper: #f9f6ef;
  --card: #fffdf8;
  --ink: #222d24;
  --muted: #576157;
  --pine: #173d31;
  --pine-dark: #102e24;
  --mint: #e6efe4;
  --red: #902d2e;
  --line: #ddd9cd;
  font: 16px/1.53 'Segoe UI', Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 290px; color: var(--ink); background: var(--paper); }
a { color: var(--pine); }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #b76b29; outline-offset: 3px; }
h1, h2 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-weight: 500; line-height: 1.05; }
h1 { font-size: clamp(2.4rem, 6vw, 4.3rem); letter-spacing: -.055em; }
h2 { font-size: clamp(1.55rem, 4vw, 2.05rem); letter-spacing: -.03em; }
p { margin: 0; }
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { max-width: 1200px; margin: auto; min-height: 76px; padding: 12px clamp(18px, 4vw, 46px); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 730; }
.brand-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #f9ead1; background: var(--pine); border-radius: 10px; font-size: 24px; line-height: 1; }
nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 7px 16px; font-size: .875rem; }
nav a { text-underline-offset: 3px; }
main { max-width: 1200px; margin: auto; padding: clamp(24px, 5vw, 62px) clamp(18px, 4vw, 46px) 70px; }
.hero { display: grid; grid-template-columns: 1.23fr .77fr; min-height: 450px; background: var(--pine); color: var(--card); border-radius: 27px; overflow: hidden; }
.hero-copy { align-self: center; padding: clamp(28px, 6vw, 72px); }
.hero h1 { color: #fff6e6; margin: 0 0 18px; font-size: clamp(3rem, 8vw, 6.55rem); }
.hero p { max-width: 400px; color: #e5ece2; font-size: 1.07rem; }
.scene { position: relative; display: grid; place-items: center; min-height: 220px; overflow: hidden; isolation: isolate; background: radial-gradient(ellipse at center, #41644b 0%, #173d31 68%); }
.orbit { position: absolute; width: min(88%, 340px); aspect-ratio: 1; border: 1px solid #d6d6ad45; border-radius: 50%; transform: rotate(-32deg) scaleY(.65); }
.orbit.second { transform: rotate(27deg) scaleY(.78); }
.gift { position: relative; width: 145px; height: 118px; transform: rotate(-10deg); margin-top: 20px; border-radius: 5px 5px 14px 14px; background: repeating-linear-gradient(122deg, #a43e3a 0 10px, #aa443d 10px 20px); box-shadow: 19px 24px 38px #0e251f80; }
.gift::before { content: ''; position: absolute; height: 32px; inset: -13px -8px auto; border-radius: 6px; background: #c0564d; box-shadow: 0 5px 0 #843333; }
.gift::after { content: ''; position: absolute; inset: -13px 59px 0; background: linear-gradient(90deg, #c59c63, #f5d7a3 30%, #edc88c 80%, #ba955f); }
.bow { position: absolute; z-index: 1; inset: -36px 0 auto; display: flex; justify-content: center; }
.bow::before, .bow::after { content: ''; width: 48px; height: 27px; border: 7px solid #ebca94; border-radius: 70% 60% 20% 70%; transform: rotate(26deg); }
.bow::after { border-radius: 60% 70% 70% 20%; transform: rotate(-26deg); }
.spark { position: absolute; color: #f2d5a2; line-height: 1; font-size: 2.5rem; }
.spark.one { top: 20%; right: 27%; } .spark.two { bottom: 22%; left: 17%; font-size: 1.4rem; } .spark.three { bottom: 25%; right: 18%; font-size: 1.15rem; }
.start-card { margin-top: 24px; display: grid; grid-template-columns: .8fr 1fr; align-items: end; gap: 18px; }
.start-card form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
#game-login { scroll-margin-top: 16px; }
.home-login-heading p { margin-top: 8px; }
#home-login .error-message { grid-column: 1 / -1; }
.home-games, #game-login + .error-message { margin-top: 24px; }
.game-list { list-style: none; padding: 0; margin: 0; }
.game-list-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; overflow-wrap: anywhere; }
.game-list-item h3 { margin: 0; font: 500 clamp(1.35rem, 3vw, 1.75rem)/1.15 Georgia, 'Times New Roman', serif; }
#profile { scroll-margin-top: 20px; }
.card { padding: clamp(18px, 3.5vw, 31px); background: var(--card); border: 1px solid var(--line); border-radius: 20px; min-width: 0; }
.card + .card { margin-top: 16px; }
.page-title { margin-bottom: 27px; max-width: 100%; overflow-wrap: anywhere; }
.page-title p, .muted { color: var(--muted); }
.page-title p { margin-top: 11px; }
.stack { display: grid; gap: 15px; }
.stack > .card { margin: 0; }
.compact { max-width: 610px; margin-inline: auto; }
.entry-switch { display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.entry-switch button { min-height: 44px; font-weight: 650; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 45px; padding: 8px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--pine); color: #fffdf8; font-weight: 650; text-decoration: none; line-height: 1.3; text-align: center; }
.button:hover { background: var(--pine-dark); }
.button.secondary { background: transparent; color: var(--pine); border-color: #a7b3a7; }
.button.secondary:hover { background: var(--mint); }
.button.secondary.danger { color: var(--red); border-color: #c99998; }
.button.secondary.danger:hover { background: #f7eae8; }
.button.accent { background: var(--red); }
.button.accent:hover { background: #762124; }
.button:disabled { opacity: .48; cursor: default; }
.text-button { appearance: none; padding: 0; background: none; border: 0; color: var(--pine); text-decoration: underline; text-underline-offset: 3px; }
.text-button.danger { color: var(--red); }
label { display: grid; gap: 5px; font-weight: 630; font-size: .9rem; min-width: 0; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: 9px 11px; border: 1px solid #bdbfb2; border-radius: 9px; color: var(--ink); background: #fffefa; font-size: 1rem; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--pine) 50%), linear-gradient(135deg, var(--pine) 50%, transparent 50%); background-position: calc(100% - 15px) 20px, calc(100% - 10px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 95px; }
label small { font-weight: 400; color: var(--muted); font-size: .875rem; }
.badge { display: inline-flex; align-items: center; gap: 7px; width: fit-content; padding: 4px 10px; border-radius: 99px; font-size: .875rem; font-weight: 640; color: #64541f; background: #f1e8ce; }
.badge.ok { color: var(--pine); background: var(--mint); }
.badge::before { content: ''; width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.section-heading, .person-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 15px; }
.invite-bar { display: flex; gap: 10px; }
.recovery { background: var(--mint); border-color: #c4d3c3; }
.recovery input, .player-code input { font-family: ui-monospace, monospace; }
.error-message { color: var(--red); font-weight: 600; }
.wishes { display: grid; gap: 10px; }
.wish-row { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 1.1fr 1fr .7fr auto; gap: 9px; align-items: end; }
.wish-row .text-button { min-height: 46px; font-size: .875rem; }
.wish-attachment { grid-column: 1 / -1; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 16px; }
.wish-attachment label { flex: 1 1 220px; max-width: 360px; }
.wish-preview { display: flex; align-items: center; gap: 10px; }
.wish-photo { display: block; max-width: min(100%, 144px); max-height: 120px; border: 1px solid var(--line); border-radius: 9px; }
.wish-preview .wish-photo { max-width: 88px; max-height: 72px; }
.wish-photo-link { display: block; width: fit-content; max-width: 100%; margin-top: 7px; }
.wish-list { list-style: none; padding: 0; margin: 0; }
.wish-list li, .pair { display: flex; justify-content: space-between; align-items: center; gap: 10px 15px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.wish-list li:last-child, .pair:last-child { border-bottom: 0; }
.wish-list li a { text-underline-offset: 3px; }
.wish-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.gift-choice { flex: none; width: 1.25rem; height: 1.25rem; min-height: 0; margin: .13rem 0 0; padding: 0; accent-color: var(--pine); cursor: pointer; }
.gift-total { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding-top: 12px; border-top: 1px solid #c4d3c3; }
.gift-total output { font-weight: 700; overflow-wrap: anywhere; }
.gift-selection-note { font-size: .875rem; }
.wish-price-heading { text-align: right; color: var(--muted); font-size: .875rem; font-weight: 650; }
.priced-wishes .wish-list li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 36%); }
.priced-wishes .wish-list strong { text-align: right; }
.avoid, .game-description { overflow-wrap: anywhere; white-space: pre-wrap; }
.recipient { background: var(--mint); border-color: #c4d3c3; }
.gift-status { border-top: 1px solid #c4d3c3; padding-top: 14px; gap: 10px; }
.gift-status h3 { margin: 0; font-size: 1rem; }
.gift-status .button[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--card); }
.chat-heading { gap: 6px; }
.chat-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chat-person:only-child { grid-column: 1 / -1; }
.chat-person { display: flex; gap: 11px; align-items: center; min-width: 0; padding: 10px 13px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 13px; text-align: left; }
.chat-person:hover, .chat-person[aria-pressed="true"] { background: var(--mint); border-color: #839e8a; }
.chat-person[aria-pressed="true"] { box-shadow: inset 0 0 0 1px #839e8a; }
.chat-person small { display: block; color: var(--muted); }
.chat-person strong { display: block; line-height: 1.25; overflow-wrap: anywhere; }
.chat-avatar { flex: none; width: 45px; height: 45px; }
.chat-thread { display: grid; gap: 10px; min-width: 0; }
.chat-history { height: clamp(200px, 35vh, 380px); overflow: auto; overflow-anchor: none; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.chat-earlier, .chat-empty { text-align: center; padding: 5px 0 10px; font-size: .9rem; }
.chat-messages { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chat-message { justify-self: start; min-width: 0; max-width: 85%; padding: 7px 11px; border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; background: var(--card); }
.chat-message.own { justify-self: end; border-color: #c4d3c3; border-radius: 12px 12px 3px 12px; background: var(--mint); }
.chat-author { display: flex; gap: 6px; align-items: center; margin-bottom: 3px; color: var(--pine); font-size: .8rem; overflow-wrap: anywhere; }
.chat-author .chat-avatar { width: 24px; height: 24px; }
.chat-message p { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message time { display: block; color: var(--muted); text-align: right; font-size: .75rem; }
.chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px 10px; }
.chat-compose textarea { min-height: 56px; }
.chat-compose .error-message { grid-column: 1 / -1; }
.people details { border-top: 1px solid var(--line); padding: 11px 0; }
.people details:first-child { border-top: 0; }
.people summary { overflow-wrap: anywhere; }
.people summary .badge { margin-left: 9px; }
.person-content { margin-top: 12px; padding-left: 15px; }
.pair > :first-child { flex: 1 1 180px; }
.pair select, .pair .recipient-name { flex: 1 1 200px; }
.tip { padding: 10px 13px; border-left: 3px solid #879d88; background: var(--mint); }
.loading { color: var(--muted); }
#notice { position: fixed; z-index: 5; bottom: 12px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: var(--pine-dark); color: white; padding: 11px 16px; border-radius: 10px; box-shadow: 0 4px 20px #12241c35; }
@media (max-width: 720px) {
  .chat-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-person[data-chat-role="group"] { grid-column: 1 / -1; }
  .hero, .start-card { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .hero-copy { padding-bottom: 12px; }
  .scene { min-height: 210px; }
  .orbit { width: min(63%, 235px); }
  .gift { scale: .83; }
  .wish-row { grid-template-columns: 1fr 1fr; }
  .wish-row > label:nth-child(2) { grid-column: 1 / -1; }
  .wish-row > [data-remove-wish] { min-height: 32px; grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 480px) {
  .start-card form, .wish-row { grid-template-columns: 1fr; }
  .invite-bar { flex-wrap: wrap; }
  .pair { display: grid; }
  .hero { border-radius: 19px; }
  .chat-options { gap: 6px; }
  .chat-person { padding: 8px 6px; gap: 5px; font-size: .82rem; }
  .chat-avatar { width: 32px; height: 32px; }
  .chat-compose { grid-template-columns: 1fr; }
  .chat-compose .button { justify-self: end; }
}
