:root {
  color-scheme: dark;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  background: #120f18;
  --text: #f6f0fc;
  --muted: #bfb3cb;
  --purple: #7043d4;
  --purple-hover: #5d35bb;
  --accent: #d1b9ff;
  --border: #382c44;
  --panel: #1d1725;
  --surface: #292034;
  --selected: #3b2857;
  --control-border: #756483;
  --error: #ffadb7;
  --lavender: #33244a;
  --peach: #472934;
  --mint: #203b35;
  --sky: #23344d;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
.glyph { display: inline-grid; place-items: center; width: 19px; height: 19px; vertical-align: middle; font-size: 1.3rem; line-height: 1; }
.glyph-plus, .glyph-close { font-size: 1.55rem; font-weight: 400; }
.glyph-lock, .glyph-logout { position: relative; }
.glyph-lock::before, .glyph-lock::after, .glyph-logout::before, .glyph-logout::after { content: ''; position: absolute; border: 1.5px solid currentColor; }
.glyph-lock::before { width: 12px; height: 9px; top: 6px; border-radius: 3px; }
.glyph-lock::after { width: 7px; height: 6px; top: 1px; border-radius: 4px 4px 0 0; border-bottom: 0; }
.glyph-logout::before { width: 12px; height: 17px; border-radius: 2px; }
.glyph-logout::after { top: 8px; right: 6px; width: 3px; height: 3px; border: 0; border-radius: 50%; background: currentColor; }
.skip-link { position: fixed; left: 1rem; top: 1rem; transform: translateY(-300%); z-index: 5; background: var(--surface); padding: .75rem; }
.skip-link:focus { transform: none; }

.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { display: flex; flex-direction: column; gap: 44px; align-self: start; position: sticky; top: 0; min-height: 100dvh; padding: 25px 17px 19px; background: var(--panel); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px; }
.brand-mark { display: grid; place-items: center; width: 41px; aspect-ratio: 1; flex-shrink: 0; border-radius: 13px; background: var(--purple); color: white; font-size: 1.65rem; box-shadow: 0 4px 10px #622fd03b; }
.brand strong { display: block; font-size: 1.23rem; font-weight: 800; line-height: 1.12; letter-spacing: -.045em; }
.brand small { display: block; color: var(--muted); font-size: .81rem; margin-top: 4px; }
.side-heading { padding: 0 12px; margin: 30px 0 9px; color: var(--muted); font-size: .875rem; font-weight: 700; }
#family-lists { display: grid; gap: 4px; }
.nav-button { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 47px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); padding: 6px 11px; text-align: left; font-size: .95rem; font-weight: 650; overflow-wrap: anywhere; }
.nav-button:hover { background: var(--surface); }
.nav-button[aria-current="true"] { background: var(--selected); color: var(--accent); }
.sidebar-footer { display: flex; align-items: center; gap: 8px; padding: 11px; margin-top: auto; border-radius: 12px; background: var(--surface); color: var(--muted); font-size: .86rem; font-weight: 600; }
.privacy-mark .glyph { width: 16px; height: 16px; }
.avatar { display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; width: 33px; height: 33px; background: var(--lavender); color: var(--accent); font-size: .88rem; font-weight: 750; }
.avatar.peach { background: var(--peach); color: #ffc0b2; }
.avatar.mint { background: var(--mint); color: #a3edc8; }
.avatar.sky { background: var(--sky); color: #b9d8ff; }
.topbar { display: flex; min-height: 75px; align-items: center; justify-content: space-between; gap: 15px; padding: 0 clamp(18px, 3.6vw, 53px); background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar > strong { min-width: 0; font-size: .98rem; }
.top-user { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .9rem; font-weight: 650; min-width: 0; max-width: 62%; }
.topbar > strong, #viewer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-label { border-radius: 999px; background: var(--surface); color: var(--accent); padding: 5px 9px; font-size: .77rem; white-space: nowrap; }
.icon-button { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; color: var(--muted); border: 0; background: transparent; border-radius: 12px; padding: 0; }
.icon-button:hover { color: var(--accent); background: var(--selected); }

.content { max-width: 1320px; margin: 0 auto; padding: 34px clamp(18px, 3.6vw, 53px) 55px; }
.hero { display: grid; grid-template-columns: 1.12fr 1fr; align-items: stretch; overflow: hidden; isolation: isolate; border: 1px solid #463256; border-radius: 26px; background: radial-gradient(ellipse at top right, #40285c, #23172e 72%); }
.hero-copy { z-index: 1; align-self: center; padding: clamp(23px, 3.7vw, 55px); }
.hero h1 { font-size: clamp(2.45rem, 4.8vw, 4rem); line-height: 1.02; letter-spacing: -.065em; font-weight: 800; overflow-wrap: anywhere; }
.hero p { max-width: 33ch; margin-top: 15px; color: #dbcae9; line-height: 1.55; }
.hero .button { margin-top: 24px; }
.hero-image { width: 100%; height: 100%; min-height: 276px; object-fit: cover; filter: brightness(.78) saturate(.84); mask-image: linear-gradient(to right, transparent, #000 28%); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; border: 1px solid transparent; border-radius: 12px; padding: 9px 15px; font-weight: 700; text-decoration: none; line-height: 1.3; }
.primary { background: var(--purple); color: white; box-shadow: 0 4px 8px #622fd01f; }
.primary:hover { background: var(--purple-hover); }
.secondary { background: var(--surface); border-color: var(--control-border); color: var(--text); }
.secondary:hover { background: var(--selected); }
.danger { background: #3a222d; color: var(--error); }
.danger:hover { background: #512a3c; }
.danger.solid { background: #a3324a; color: #fff; }
.danger.solid:hover { background: #89273c; }

.wish-section { margin-top: 33px; }
.wish-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.wish-heading h2 { font-size: clamp(1.45rem, 2.5vw, 1.85rem); letter-spacing: -.045em; font-weight: 780; }
.wish-heading p { margin-top: 3px; color: var(--muted); font-size: .89rem; }
.filters { display: flex; flex-wrap: wrap; gap: 3px; background: var(--surface); padding: 4px; border-radius: 13px; }
.filters button { border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .88rem; font-weight: 700; min-height: 44px; padding: 0 10px; white-space: nowrap; }
.filters button[aria-pressed="true"] { background: var(--selected); color: var(--accent); }
.filters .glyph { width: 15px; height: 15px; font-size: 1.06rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; align-items: stretch; }
.wish-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); }
.card-top { height: 104px; position: relative; display: grid; place-items: center; margin: 8px 8px 0; border-radius: 13px; background: var(--lavender); }
.card-top.books { background: #443525; }
.card-top.creative { background: #46293e; }
.card-top.style { background: #382d50; }
.card-top.experience { background: var(--mint); }
.card-top.tech { background: var(--sky); }
.card-symbol { font-size: 2.45rem; line-height: 1; }
.card-top.with-image { height: 154px; }
.card-image { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; overflow: hidden; border-radius: inherit; background: transparent; }
.card-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.card-image:focus-visible { outline-offset: -3px; }
.image-count { position: absolute; bottom: 6px; right: 6px; border-radius: 8px; padding: 4px 7px; background: #241536de; color: #fff; font-size: .82rem; }
.favorite-button, .favorite-marker { position: absolute; right: 5px; top: 5px; background: #1d1725eb; }
.favorite-marker { display: grid; place-items: center; border-radius: 12px; width: 38px; height: 38px; }
.favorite-button[aria-pressed="true"] .glyph, .favorite-marker .glyph { font-size: 0; }
.favorite-button[aria-pressed="true"] .glyph::before, .favorite-marker .glyph::before { content: '★'; color: #ffd477; font-size: 1.4rem; }
.card-copy { display: flex; flex-direction: column; flex: 1; padding: 11px 13px 10px; overflow-wrap: anywhere; }
.category { color: var(--muted); font-size: .83rem; font-weight: 650; margin-bottom: 3px; }
.wish-card h3 { font-size: 1.05rem; line-height: 1.3; letter-spacing: -.018em; }
.card-note { font-size: .925rem; color: var(--muted); line-height: 1.45; margin-top: 6px; white-space: pre-wrap; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-top: 4px; margin-top: auto; }
.card-actions .icon-button { margin-left: auto; }
.wish-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; font-size: .875rem; text-underline-offset: 3px; }
.wish-message { display: grid; gap: 10px; justify-items: center; text-align: center; border: 1px dashed var(--control-border); border-radius: 20px; background: var(--panel); color: var(--muted); padding: 30px 16px; }
.wish-message strong { color: var(--text); font-size: 1.1rem; }
.empty-mark { display: grid; place-items: center; width: 55px; height: 55px; border-radius: 18px; background: var(--selected); color: var(--accent); font-size: 1.85rem; }

.entry { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.entry-card { width: min(100%, 416px); background: var(--panel); border-radius: 25px; border: 1px solid var(--border); box-shadow: 0 12px 55px #0006; padding: 24px; }
.entry-card .brand { padding: 0; margin-bottom: 18px; }
.entry-image { width: 100%; aspect-ratio: 2.25; border-radius: 14px; object-fit: cover; margin-bottom: 19px; background: var(--lavender); filter: brightness(.78) saturate(.84); }
.entry h1 { font-size: 1.65rem; letter-spacing: -.04em; }
.entry p { color: var(--muted); line-height: 1.45; margin: 6px 0 13px; }
.entry .primary { width: 100%; margin-top: 16px; }
.entry .text-button { color: var(--accent); background: transparent; margin-top: 5px; padding-inline: 8px; }
.entry .text-button:hover { background: var(--surface); }
#invite-profile { overflow-wrap: anywhere; }
label { display: grid; gap: 5px; margin-top: 12px; color: var(--text); font-size: .94rem; font-weight: 650; }
input, textarea, select { width: 100%; padding: 11px; border: 1px solid var(--control-border); color: var(--text); background: #16111d; border-radius: 10px; font-size: 1rem; font-weight: 400; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 18px center, right 12px center; background-size: 6px 6px; background-repeat: no-repeat; }
.form-error, .entry .form-error { color: var(--error); font-size: .93rem; margin-top: 10px; }
dialog { width: min(500px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--control-border); border-radius: 20px; color: var(--text); background: var(--panel); padding: 22px; box-shadow: 0 20px 90px #0009; }
dialog::backdrop { background: #08050cc0; }
#editor { padding: 0; overflow: hidden; }
#wish-form { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
#wish-form .dialog-heading { flex-shrink: 0; margin: 0; padding: 12px 22px 4px; }
.editor-fields { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px 22px 14px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dialog-heading h2 { font-size: 1.5rem; letter-spacing: -.045em; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.editor-footer { flex-shrink: 0; border-top: 1px solid var(--border); }
.editor-footer .form-error { padding-inline: 22px; }
#wish-form .dialog-actions { margin-top: 0; padding: 10px 22px 14px; }
.dialog-actions .danger { margin-right: auto; }
#delete-form .danger { margin-right: 0; }
#delete-description { color: var(--muted); overflow-wrap: anywhere; }
.attachments { margin-top: 12px; }
.attachment-hint { margin-top: 6px; color: var(--muted); font-size: .875rem; }
.image-previews { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.image-previews:not(:empty) { margin-top: 8px; }
.image-preview { position: relative; overflow: hidden; border-radius: 10px; background: var(--surface); }
.image-preview img { width: 100%; height: 92px; object-fit: cover; }
.image-preview .icon-button { position: absolute; top: 2px; right: 2px; background: var(--panel); color: var(--text); }
.image-preview .icon-button:hover { background: #512a3c; }
.gallery { width: min(780px, calc(100% - 24px)); }
.gallery h2 { overflow-wrap: anywhere; }
.gallery-images { display: grid; gap: 12px; }
.gallery-images img { max-height: 73dvh; width: 100%; object-fit: contain; background: var(--surface); border-radius: 10px; }
details { margin-top: 8px; }
summary { color: var(--accent); font-weight: 650; cursor: pointer; min-height: 44px; padding: 11px 0; }
.toast { position: fixed; bottom: 15px; right: 15px; z-index: 3; max-width: calc(100% - 30px); padding: 12px 16px; border-radius: 12px; background: #332257; color: #fff; box-shadow: 0 6px 20px #34225736; pointer-events: none; }

@media (max-width: 1050px) {
  .layout { grid-template-columns: 190px minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 730px) {
  .layout { display: block; }
  .sidebar { position: static; min-height: 0; gap: 12px; padding: 13px 15px; border: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
  #family-lists { display: flex; gap: 5px; flex-wrap: wrap; min-width: 0; }
  .nav-button { width: auto; background: var(--surface); min-height: 44px; padding: 4px 9px; font-size: .875rem; }
  .nav-button .avatar { width: 27px; height: 27px; font-size: .77rem; }
  .sidebar-footer, .side-heading { display: none; }
  .topbar { min-height: 52px; padding: 0 15px; }
  .top-user { gap: 5px; }
  .content { padding: 15px 15px 32px; }
  .hero { border-radius: 19px; }
  .hero-image { min-height: 210px; }
}

@media (max-width: 520px) {
  .hero { position: relative; grid-template-columns: 1fr; }
  .hero-copy { padding: 23px 17px; }
  .hero h1 { font-size: clamp(2rem, 8.5vw, 2.7rem); }
  .hero p { max-width: 25ch; margin-top: 8px; }
  .hero .button { margin-top: 13px; }
  .hero-image { position: absolute; z-index: -1; right: 0; width: 55%; opacity: .28; mask-image: linear-gradient(to right, transparent, #000 65%); }
  .wish-section { margin-top: 23px; }
  .wish-heading { align-items: flex-start; }
  .filters button { padding: 0 7px; }
  .cards { gap: 8px; }
  .wish-card { border-radius: 14px; }
  .card-top { margin: 5px 5px 0; border-radius: 10px; height: 76px; }
  .card-top.with-image { height: 106px; }
  .card-copy { padding: 8px 8px 5px; }
  .card-symbol { font-size: 1.95rem; }
  .favorite-button, .favorite-marker { top: 2px; right: 2px; }
}

@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
  #wish-form .dialog-actions { padding-inline: 12px; }
  #wish-form .dialog-actions .button { padding-inline: 8px; font-size: .875rem; }
}

@media (max-width: 340px) {
  .wish-heading { flex-wrap: wrap; }
}
