:root {
  --paper: #fcf6ef;
  --surface: #fffaf5;
  --ink: #341628;
  --muted: #714f5d;
  --plum: #4e2341;
  --line: #decfc8;
  --gutter: clamp(16px, 4vw, 24px);
  --card-pad: clamp(16px, 4vw, 24px);
  --radius: 18px;
  --control-height: 44px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 "Avenir Next", system-ui, sans-serif;
}

header, main { max-width: 1040px; margin-inline: auto; }

header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

header > span, .eyebrow {
  color: #734658;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .1em;
}

header > span { text-align: right; }

.brand {
  display: grid;
  place-items: center;
  min-width: var(--control-height);
  flex-shrink: 0;
  padding: 0;
  background: transparent;
}

.brand img { width: 40px; height: 40px; border-radius: 50%; mix-blend-mode: multiply; }

h1, h2, h3 { margin: 0 0 12px; font: normal 1.5rem/1.18 Georgia, serif; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

.hero {
  display: flex;
  align-items: flex-end;
  min-height: 420px;
  margin: 20px var(--gutter) 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #301020 url(invitation.webp) center / cover;
  color: #fff8f1;
}

.hero div { width: 52%; padding: clamp(24px, 5vw, 40px); }
.hero h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); font-style: italic; line-height: 1.07; }
.hero .keep { white-space: nowrap; }
.hero p { max-width: 30ch; }

.wrap { max-width: 650px; margin-inline: auto; padding: 16px var(--gutter) 48px; }
.wrap > .eyebrow { margin-bottom: 8px; }
.panel .eyebrow { margin-bottom: 8px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; }
.homeActions { margin: 16px var(--gutter) 32px; }
.subtle { color: var(--muted); font-size: .875rem; }

button, select, input { font: inherit; }

button {
  min-height: var(--control-height);
  padding: 10px 16px;
  border: 0;
  border-radius: 100px;
  background: var(--plum);
  color: white;
  cursor: pointer;
  font-size: .9375rem;
  font-weight: 650;
  line-height: 1.35;
}

.secondary { background: #eee1df; color: #4b2039; }
.quiet { background: transparent; color: #633449; text-decoration: underline; }
.back { margin-bottom: 12px; padding-inline: 0; background: transparent; color: #633449; }
button:disabled { cursor: default; opacity: .65; }
:where(button, summary, input, select):focus-visible { outline: 3px solid #a55972; outline-offset: 3px; }

.panel, details {
  margin: 0 0 16px;
  padding: var(--card-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel details { margin-block: 12px; padding: 12px 16px; }
.featured { border-top: 4px solid #803e61; background: linear-gradient(135deg, #f7e7e9, #fffaf3); }
summary { min-height: 24px; cursor: pointer; font-size: 1rem; font-weight: 650; line-height: 1.45; }
details[open] > summary { margin-bottom: 12px; }

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: block; min-width: 0; margin: 0 0 12px; color: #614654; font-size: .875rem; font-weight: 650; }
.row > .field { margin: 0; }

select, #orientation-label {
  display: block;
  width: 100%;
  min-height: var(--control-height);
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #cdbab9;
  border-radius: 10px;
  background: var(--surface);
  color: #3e2032;
  font-size: 1rem;
  font-weight: 400;
}

.tile { padding: 8px 0; border-top: 1px solid #eadcd4; }
.check, .tile > label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-height);
  cursor: pointer;
}
input { accent-color: #682c4a; }
input[type=checkbox] { flex: 0 0 19px; width: 19px; height: 19px; margin: 0; }
#custom-orientation[hidden] { display: none; }

.age-range { grid-column: 1/-1; min-width: 0; margin: 0; padding: 8px 0 0; border: 0; border-top: 1px solid var(--line); }
.age-range legend { padding-right: 8px; font-size: .9375rem; font-weight: 650; }
.age-range output { float: right; font-variant-numeric: tabular-nums; }
.age-range input[type=range] { display: block; width: 100%; height: var(--control-height); margin: 0; }

.kink-panel { margin-block: 24px; padding: var(--card-pad); border-radius: var(--radius); background: var(--plum); color: #fff7f6; }
.kink-panel > p { color: #f3dce9; }
.kink-panel details { margin: 0 0 8px; padding: 12px 16px; border-color: #e5cede; background: #f8edf3; color: var(--ink); }
.kink-panel details:last-child { margin-bottom: 0; }
.kink-panel .tile { border-color: #e5cede; }

.seal { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 12px; border-radius: 50%; background: #60334e; color: #ffdfba; font: italic 2rem Georgia, serif; }
.chips span { display: inline-block; margin: 2px; padding: 4px 10px; border-radius: var(--radius); background: #efe1e1; font-size: .875rem; }
.error { color: #85203f; }
.divider { margin-block: 16px; border: 0; border-top: 1px solid var(--line); }

@media (max-width: 650px) {
  .hero {
    min-height: 450px;
    margin-top: 16px;
    background-image: linear-gradient(0deg, #301020 8%, #301020f5 24%, transparent 62%), url(invitation.webp);
    background-position: center, 74% top;
    background-size: cover, auto 76%;
    background-repeat: no-repeat;
  }
  .hero div { width: 100%; padding: var(--card-pad); }
  .hero h1 { max-width: 13ch; }
  .homeActions button { width: 100%; }
  .homeActions .subtle { margin-inline: auto; }
}
@media (max-width: 420px) {
  .tile .row { grid-template-columns: 1fr; }
}

.chat-log { display: grid; gap: 8px; padding: 0; list-style: none; }
.chat-log:empty { display: none; }
.chat-message {
  width: fit-content;
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 14px;
  background: #f3e9e5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.chat-message.mine { justify-self: end; background: var(--plum); color: white; }
.chat-message small { display: block; font-size: .75rem; }
#chat-form { margin-top: 16px; }
#chat-form .field { margin-bottom: 6px; }
#message {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
#chat-status { margin-top: 8px; }
.wrap > .actions + details { margin-top: 16px; }

#profile-files { width: 100%; min-height: var(--control-height); }
.profile-input {
  display: block;
  width: 100%;
  min-height: var(--control-height);
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 400;
}
textarea.profile-input { resize: vertical; }
.profile-limit { display: block; font-weight: 400; }
.profile-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 112px), 1fr)); gap: 12px; }
.profile-photos:empty, #profile-files + p:empty { display: none; }
.profile-photos + h3 { margin-top: 16px; }
.profile-photo { min-width: 0; }
.profile-photo-frame { aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px; background: #eee1df; }
.profile-photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-photo-frame.is-blurred img { filter: blur(18px); transform: scale(1.35); }
.profile-copy { overflow-wrap: anywhere; white-space: pre-wrap; }
.wrap > .actions + .panel { margin-top: 16px; }

.safety-panel {
  margin-top: 16px;
  padding: 12px 16px;
  background: #f7eeeb;
  color: var(--ink);
}
.safety-panel summary { min-height: 24px; }
.safety-panel ul { margin: 0 0 12px; padding-left: 20px; }
.safety-panel li + li { margin-top: 8px; }
.safety-panel a { color: #633449; text-underline-offset: 3px; }

.space-agreement { margin-block: 12px; }
.space-link { color: #633449; text-underline-offset: 3px; }
.stamp-circles {
  display: grid;
  grid-template-columns: repeat(5, 24px);
  gap: 8px;
  margin-bottom: 16px;
}
.stamp-circles span {
  width: 24px;
  height: 24px;
  border: 1px solid #a58d9d;
  border-radius: 50%;
}
.stamp-circles .filled { background: #427659; border-color: #427659; }

.header-account { display: flex; align-items: center; gap: 8px 12px; }
.header-account > span { color: #734658; font-size: .75rem; font-weight: 700; text-align: right; }
#account-action { flex-shrink: 0; }
@media (max-width: 440px) {
  .header-account > span { display: none; }
}

.invite-qr {
  display: block;
  width: min(100%, 224px);
  height: auto;
  margin: 16px auto 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  image-rendering: pixelated;
}

.has-member-nav { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
.discover-home { max-width: 750px; }
.discover-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.discover-heading h1 { margin: 0; }
.discovery-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.goal-tile {
  min-height: clamp(192px, 37vw, 250px); display: flex; flex-direction: column; align-items: flex-start;
  justify-content: flex-end; gap: 7px; border-radius: 19px; padding: clamp(13px,3vw,24px);
  text-align: left; overflow: hidden; color: #fff8f3;
}
.goal-ongoing { background: #552642; }
.goal-one-off { background: #774347; }
.goal-together { background: #3c4e51; }
.goal-all { background: #4f3b63; }
.goal-mark { margin-bottom: auto; font-family: Georgia,serif; font-size: clamp(52px,12vw,82px); line-height: 1.05; color: #f2c9bb; }
.goal-title { font: bold clamp(18px,4.5vw,27px)/1.14 Georgia,serif; }
.goal-description { font-size: .83rem; font-weight: 400; line-height: 1.3; }
.member-nav {
  position: fixed; z-index: 4; bottom: 0; left: 50%; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); width: min(100%,750px);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom,0px)); gap: 3px;
  background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px #24132214;
}
.member-nav button { display: grid; justify-items: center; gap: 2px; border-radius: 12px; padding: 5px 2px; color: var(--ink); background: transparent; font-size: clamp(.72rem,3.1vw,.93rem); }
.member-nav button span { font-size: 1.3rem; line-height: 1.05; }
.member-nav button[aria-current] { background: #ebdbe6; }
.member-nav .spaces-tab { color: #fff7f6; background: var(--plum); }
.member-nav .spaces-tab[aria-current] { color: white; background: #74385f; box-shadow: inset 0 0 0 2px #c990b4; }
.space-lock { position: relative; overflow: hidden; border-radius: 18px; margin: 0 0 16px; }
.space-lock-art { pointer-events: none; filter: blur(5px); background: #dcb2d2; color: var(--ink); padding: 36px 24px; font: 1.8rem Georgia,serif; min-height: 195px; }
.space-lock-prompt { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 4px; text-align: center; padding: 14px; background: #30172d99; color: white; }
.space-lock-prompt p { margin: 0; }

.pilot-tools[hidden], [hidden] { display: none !important; }
.pilot-tools { position: fixed; z-index: 5; right: 12px; top: 62px; display: flex; gap: 4px; align-items: center; }
.pilot-tools button { padding-inline: 10px; font-size: .78rem; }
.pilot-tools > #pilot-save-status { background: var(--paper); padding: 4px; margin: 0; font-size: .7rem; max-width: 140px; }
.pilot-tools dialog { width: min(calc(100% - 24px), 450px); padding: 22px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); }
.pilot-tools dialog::backdrop { background: #30172d99; }
.has-member-nav main { padding-top: 43px; }

.pilot-welcome { max-width: 660px; padding-top: clamp(24px, 5vw, 48px); }
.pilot-disclosure { color: var(--muted); }
.pilot-welcome [data-welcome-action] button { min-height: 44px; }
.pilot-welcome [data-welcome-action] [role="status"]:empty { display: none; }
.pilot-hints summary { cursor: pointer; font-weight: 650; }
.pilot-hints[open] summary { margin-bottom: 12px; }
.pilot-welcome .panel ol, .pilot-tools dialog .panel ol { margin: 0; padding-inline-start: 1.35em; }
.pilot-welcome li + li, .pilot-tools dialog li + li { margin-top: 8px; }
#pilot-guide-dialog { width: min(calc(100% - 24px), 600px); max-height: calc(100dvh - 32px); }
#pilot-finish-status:not(:empty), .pilot-welcome [role="status"]:not(:empty) { margin-top: 12px; }

.book-balance { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; }
.book-balance p { margin-bottom: 8px; }
.book-balance small { color: var(--muted); }
.book-balance .stamp-circles { grid-template-columns: repeat(5, 17px); gap: 4px; margin-bottom: 3px; }
.book-balance .stamp-circles span { width: 17px; height: 17px; }
.wheel-toggle { display: grid; justify-items: center; gap: 3px; min-width: 84px; padding: 8px; background: transparent; color: var(--plum); }
.dial-frame { position: relative; display: block; width: 64px; height: 64px; }
.dial-frame::after { content: ''; position: absolute; left: 50%; top: -3px; transform: translateX(-50%); border: 6px solid transparent; border-top: 11px solid #42243a; }
.stamp-dial { display: block; position: relative; width: 100%; height: 100%; border: 3px solid #aa8760; border-radius: 50%; box-shadow: 0 2px 5px #381a302a;
 background: conic-gradient(#613653 0 60deg,#90596f 60deg 120deg,#4c665e 120deg 180deg,#815766 180deg 240deg,#6c547b 240deg 300deg,#75434c 300deg); }
.stamp-dial::after { content: ''; position: absolute; inset: 42%; border-radius: 50%; background: #ffe3af; }
.stamp-dial i { position: absolute; inset: 0; display: flex; align-items: start; justify-content: center; color: #fff7ec; font: bold 10px/1 system-ui; padding-top: 4px; }
.stamp-dial i:nth-child(1) { transform: rotate(30deg); } .stamp-dial i:nth-child(2) { transform: rotate(90deg); }
.stamp-dial i:nth-child(3) { transform: rotate(150deg); } .stamp-dial i:nth-child(4) { transform: rotate(210deg); }
.stamp-dial i:nth-child(5) { transform: rotate(270deg); } .stamp-dial i:nth-child(6) { transform: rotate(330deg); }
.face-0 { transform: rotate(330deg); } .face-1 { transform: rotate(270deg); } .face-2 { transform: rotate(210deg); }
.face-3 { transform: rotate(150deg); } .face-4 { transform: rotate(90deg); } .face-5 { transform: rotate(30deg); }
.wheel-panel, .stamp-pace { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.wheel-panel p, .stamp-pace p { margin-bottom: 8px; }
.wheel-panel details { margin-bottom: 0; }
.wheel-result, .book-notice:not(:empty) { margin-top: 10px; font-weight: 650; }
.book-notice:empty { margin: 0; }
.next-actions { margin: 0; padding-inline-start: 1.6rem; }
.next-actions li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.next-actions li:last-child { border: 0; }
.next-actions li::marker { font-family: Georgia,serif; color: var(--muted); font-weight: bold; }
.next-actions li > strong { display: block; }
.next-actions li > p, .next-actions li > .actions { margin: 4px 0; }
.next-actions li > button { margin-top: 6px; }
.stamp-pace > button + p { margin-top: 6px; }

.pilot-choices { border: 0; padding: 0; margin: 18px 0; }
.pilot-choices legend { margin-bottom: 8px; font-weight: 650; }
.pilot-choices label { display: flex; align-items: center; gap: 12px; margin: 6px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.pilot-choices label:has(:checked) { border-color: var(--plum); background: #f5e6ee; }
.pilot-choices strong { display: block; }
.pilot-adult { display: block; margin: 12px 0; }
.pilot-choices input, .pilot-adult input { accent-color: var(--plum); }

.help-link {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px;
  color: var(--plum); font-size: .9375rem; font-weight: 650; text-underline-offset: .2em;
}
.help-link:focus-visible, .help-page a:focus-visible { outline: 3px solid #a55972; outline-offset: 2px; }
.help-page { padding-block-start: 24px; }
#plum-help {
  width: min(40rem, calc(100% - 24px)); max-height: calc(100% - 24px);
  max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--paper); color: var(--ink); overscroll-behavior: contain;
}
#plum-help::backdrop { background: #30172d99; }
.help-bar {
  position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: center;
  justify-content: space-between; background: var(--paper); border-bottom: 1px solid var(--line);
  padding: 10px var(--card-pad);
}
.help-bar h1 { margin: 0; font-size: 1.6rem; }
#help-body { padding: 16px var(--card-pad) 24px; }
#help-topics > p { color: var(--muted); }
#help-topics section { margin-block-start: 20px; }
#help-topics h2 { margin-bottom: 6px; }
#help-topics details { padding: 0; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
#help-topics summary { min-height: 44px; padding-block: 11px; line-height: 1.45; }
#help-topics details[open] > summary { margin: 0; }
#help-topics details > :last-child { margin-bottom: 14px; }
#help-topics ol { margin: 0; padding-inline-start: 1.4em; }
#help-topics li + li { margin-top: 8px; }
