:root {
  --ink: #1A1A1A;
  --paper: #FFFFFF;
  --muted: #4A4A4A;
  --divider: #DADADA;
  --link-hover: #C4006B;
  --cyan: #00A3E0;
  --magenta: #E6007E;
  --yellow: #FFE500;
  --reserved-other: #F9B2D4;
  --tint-cyan: #DDF3FC;
  --tint-magenta: #FFE3F1;
  --tint-yellow: #FFF7B8;
  --info: #E3F5FD;
  --avatar-pink: #FFB8DC;
  --avatar-blue: #A8E0F7;
  --avatar-yellow: #FFF27A;
  --border: 1.5px solid var(--ink);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
}
a { color: var(--ink); }
a:hover { color: var(--link-hover); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible, input:focus, textarea:focus { outline: 2.5px solid var(--cyan); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* paper grain + print decor */
.grain { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; opacity: .14; mix-blend-mode: multiply; }
.dots { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; mix-blend-mode: multiply; pointer-events: none; }
.dots circle { mix-blend-mode: multiply; }
.regmarks { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.crosshair { position: fixed; right: 18px; top: 18px; z-index: 2; pointer-events: none; }

.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px calc(110px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* type */
.logo {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 1.5px .5px 0 rgba(0,163,224,.7), -1.5px 1px 0 rgba(230,0,126,.55);
  text-decoration: none;
  color: var(--ink);
}
.logo-home { font-size: 32px; }
.logo-sub { font-size: 26px; }
.logo-invite { font-size: 76px; line-height: .9; letter-spacing: -0.05em; text-shadow: 2.5px 1px 0 rgba(0,163,224,.7), -2.5px 1.5px 0 rgba(230,0,126,.55); }
.logo-splash { font-size: 104px; letter-spacing: -0.05em; text-shadow: 3px 1px 0 rgba(0,163,224,.7), -3px 2px 0 rgba(230,0,126,.55); }

.h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 48px; line-height: .95; letter-spacing: -0.03em; overflow-wrap: break-word; hyphens: auto; }
.h-wish { margin: 0; font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1; letter-spacing: -0.03em; overflow-wrap: break-word; hyphens: auto; }
.h-auth { margin: 0; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.1; letter-spacing: -0.02em; }
.label { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-title { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.05; overflow-wrap: break-word; hyphens: auto; }
.card-title.sm { font-size: 21px; line-height: 1.1; }
.meta { font-size: 13px; color: var(--muted); }
.meta.block { display: block; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.ink { color: var(--ink); }
.strong { font-weight: 600; }
.lead { margin: 0; font-size: 15px; line-height: 1.45; color: #333; }
.fineprint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.4; }
.empty { margin: 0; padding: 18px; border: 1.5px dashed var(--ink); border-radius: 20px; color: var(--muted); font-size: 15px; }
.opt { font-weight: 400; color: var(--muted); }
.plain { text-decoration: none; }

/* layout helpers */
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-20 { display: flex; flex-direction: column; gap: 20px; }
.row-8 { display: flex; align-items: center; gap: 8px; }
.row-10 { display: flex; align-items: center; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 48px; gap: 14px; }
.topbar.start { justify-content: flex-start; }

/* shadows */
.shadow-cyan { box-shadow: 4px 4px 0 var(--cyan); }
.shadow-magenta { box-shadow: 4px 4px 0 var(--magenta); }
.shadow-yellow { box-shadow: 4px 4px 0 var(--yellow); }
.form-card.shadow-magenta, .form-card.shadow-yellow { box-shadow: 5px 5px 0 var(--magenta); }
.form-card.shadow-yellow { box-shadow: 5px 5px 0 var(--yellow); }

/* buttons */
.btn-primary {
  height: 56px; padding: 0 24px; border: none; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-primary:hover { color: var(--paper); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--yellow); }
.form-card .btn-primary { height: 54px; font-size: 16px; }
.btn-secondary {
  height: 48px; padding: 0 18px; border: var(--border); border-radius: 999px; background: var(--paper);
  font-weight: 600; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-secondary.wide, form > .btn-secondary.wide { width: 100%; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border: var(--border); border-radius: 999px;
  background: var(--paper); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; max-width: 70%; overflow: hidden; text-overflow: ellipsis;
}
.pill-btn.back { padding-left: 10px; }
.round-btn {
  width: 44px; height: 44px; flex: none; border: var(--border); border-radius: 50%; background: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.icon-btn {
  width: 44px; height: 44px; flex: none; border: none; border-radius: 50%; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--tint-yellow); color: var(--ink); }
.link-btn { min-height: 44px; padding: 0 12px; border: none; background: transparent; font-size: 14px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--link-hover); }
.chip { flex: none; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: var(--border); }
.chip-yellow { background: var(--yellow); }
.chip-btn { height: 44px; padding: 0 16px; border: var(--border); border-radius: 999px; background: var(--yellow); font-weight: 600; font-size: 14px; cursor: pointer; }

.fab {
  position: fixed; z-index: 20; right: max(20px, calc(50vw - 260px)); bottom: calc(28px + env(safe-area-inset-bottom));
  height: 56px; padding: 0 24px 0 20px; display: flex; align-items: center; gap: 8px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 600; font-size: 16px;
}
.fab:hover { color: var(--paper); }

/* cards */
.card { border: var(--border); border-radius: 20px; background: var(--paper); text-decoration: none; color: var(--ink); }
a.card:hover { color: var(--ink); transform: translate(-1px, -1px); }
.list-card { display: flex; flex-direction: column; justify-content: space-between; gap: 28px; min-height: 124px; padding: 16px; }
.shared-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.shared-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.form-card { padding: 20px; border-radius: 24px; display: flex; flex-direction: column; gap: 16px; }

/* avatars */
.avatar {
  --s: 36px;
  width: var(--s); height: var(--s); flex: none; border-radius: 50%; border: var(--border); overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: calc(var(--s) * .38);
  background: var(--paper); color: var(--ink);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-pink { background: var(--avatar-pink); }
.avatar-blue { background: var(--avatar-blue); }
.avatar-yellow { background: var(--avatar-yellow); }
.avatar-btn { border-radius: 50%; text-decoration: none; }
.avatar-btn .avatar { background-color: var(--yellow); }
.avatar-btn .avatar:has(img) { background: var(--paper); }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.owner-name { font-size: 15px; font-weight: 600; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .field textarea {
  width: 100%; height: 48px; padding: 0 14px; border: var(--border); border-radius: 14px; background: var(--paper);
  font-family: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
}
.field textarea { height: auto; padding: 12px 14px; line-height: 1.4; resize: vertical; min-height: 96px; }
.hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.flash { margin: 0; padding: 12px 14px; border: var(--border); border-radius: 14px; font-size: 14px; }
.flash-error { background: var(--tint-magenta); }
.flash-ok { background: var(--tint-yellow); }

.avatar-pick { display: flex; align-items: center; gap: 14px; }
.avatar-drop {
  width: 60px; height: 60px; flex: none; border-radius: 50%; border: 1.5px dashed var(--ink); background: #FFF6A8;
  display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; position: relative;
}
.avatar-drop.has-img { border-style: solid; background: var(--paper); }
.avatar-drop .avatar { border: none; width: 100%; height: 100%; }
.avatar-drop img.preview { width: 100%; height: 100%; object-fit: cover; }
.avatar-drop:focus-within { outline: 2.5px solid var(--cyan); outline-offset: 2px; }

/* auth / splash */
body.auth .page { padding-top: 64px; gap: 28px; padding-bottom: 28px; }
.auth-head { display: flex; flex-direction: column; gap: 14px; padding-top: 30px; }
body.splash .page { min-height: 100dvh; padding: 0; justify-content: center; }
.splash-link { display: flex; justify-content: center; text-decoration: none; padding: 40px 0; }
.splash-link:hover .logo { color: var(--ink); }
.splash-tag { position: fixed; left: 28px; bottom: calc(44px + env(safe-area-inset-bottom)); margin: 0; font-size: 16px; font-weight: 600; z-index: 1; }

/* info box */
.info-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: var(--border); border-radius: 16px; background: var(--info); font-size: 14px; line-height: 1.35; }
.info-box .ic { flex: none; }

/* wish image / halftone placeholders */
.wish-img { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.wish-img img { width: 100%; height: 100%; object-fit: cover; }
.wish-img:has(img) { background: var(--paper) !important; }
.tint-cyan { background-color: var(--tint-cyan); --dot: rgba(0,163,224,.45); }
.tint-magenta { background-color: var(--tint-magenta); --dot: rgba(230,0,126,.35); }
.tint-yellow { background-color: var(--tint-yellow); --dot: rgba(230,180,0,.45); }
.halftone { background-image: radial-gradient(var(--dot) 1.2px, transparent 1.5px); background-size: 7px 7px; }
.wish-img.thumb { width: 60px; height: 60px; flex: none; border: var(--border); border-radius: 12px; }
.wish-img.thumb.halftone { background-size: 6px 6px; }
.wish-img.card-img { height: 128px; border-bottom: var(--border); }

/* wish cards (others' lists) */
.wish-card { display: flex; flex-direction: column; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); }
.wish-card-link { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.wish-card-link:hover { color: var(--ink); }
.wish-card-link:hover .wish-card-title { text-decoration: underline; }
.wish-card-text { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 4px; }
.wish-card-title { font-weight: 700; font-size: 15px; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.wish-card-text .meta { font-size: 12px; }
.wish-card-action { margin-top: auto; padding: 12px; }
.res-form { margin: 0; }
.res {
  width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: var(--border); border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink);
}
.res-free { background: var(--paper); cursor: pointer; }
.res-free:hover { background: var(--tint-yellow); }
.res-mine { background: var(--yellow); cursor: pointer; }
.res-other { background: var(--reserved-other); }
.res[aria-busy="true"] { opacity: .6; }

/* wish rows (own list) */
.wish-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wish-row { display: flex; align-items: center; gap: 4px; padding: 10px; border: var(--border); border-radius: 18px; background: var(--paper); }
.wish-row form { margin: 0; }
.wish-row-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; text-decoration: none; color: var(--ink); }
.wish-row-main:hover { color: var(--ink); }
.wish-row-main:hover .wish-row-title { text-decoration: underline; }
.wish-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wish-row-title { font-weight: 700; font-size: 16px; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.list-actions { margin: 0; }
.list-actions a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.danger-zone { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding-top: 22px; border-top: 1px solid var(--divider); align-items: flex-start; }
.danger-zone p { margin: 0; }

/* wish detail */
body.has-hero .page { padding: 0 0 28px; gap: 0; }
.hero { position: relative; height: 360px; border-bottom: var(--border); }
.wish-img.hero-img { width: 100%; height: 100%; background-size: 9px 9px; }
.hero-img.halftone { background-image: radial-gradient(var(--dot) 1.4px, transparent 1.7px); }
.hero-img img { object-fit: contain; padding: 16px; }
.hero-img svg { stroke-width: .9; }
.hero-back { position: absolute; left: 20px; top: max(16px, env(safe-area-inset-top)); }
.detail { padding: 24px 20px 0; display: flex; flex-direction: column; gap: 18px; min-height: calc(100dvh - 380px); }
.crumb { font-size: 14px; font-weight: 600; text-decoration: none; }
.desc { margin: 0; font-size: 16px; line-height: 1.5; white-space: pre-line; overflow-wrap: break-word; hyphens: auto; }
.link-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: var(--border); border-radius: 16px; background: var(--paper); text-decoration: none; }
.link-card .ic { flex: none; }
.link-card-text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.link-card-text .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.detail-actions form { display: flex; flex-direction: column; }
.you-give { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: var(--border); border-radius: 18px; background: var(--yellow); font-weight: 600; font-size: 16px; }
.you-give.other { background: var(--reserved-other); }

/* image picker */
.picker { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.picker legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.picker-grid { width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.pick {
  position: relative; aspect-ratio: 1 / 1; padding: 0; cursor: pointer; border-radius: 14px; border: var(--border);
  background: var(--paper); display: flex; align-items: center; justify-content: center; overflow: visible;
}
.pick img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.pick[aria-pressed="true"] { border-width: 2.5px; box-shadow: 3px 3px 0 var(--magenta); }
.pick-check { display: none; position: absolute; right: -7px; top: -7px; width: 22px; height: 22px; border-radius: 50%; border: var(--border); background: var(--yellow); align-items: center; justify-content: center; }
.pick[aria-pressed="true"] .pick-check { display: flex; }
.pick-upload { border-style: dashed; }
.pick-upload:focus-within { outline: 2.5px solid var(--cyan); outline-offset: 2px; }
.pick.loading { background: var(--tint-cyan); background-image: radial-gradient(rgba(0,163,224,.45) 1.1px, transparent 1.4px); background-size: 6px 6px; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

/* share */
.people { list-style: none; margin: 0; padding: 4px 14px; border: var(--border); border-radius: 20px; background: var(--paper); }
.people li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; }
.people li + li { border-top: 1px solid var(--divider); }
.people form { margin: 0; }
.person-name { flex: 1; font-weight: 600; font-size: 16px; min-width: 0; }
.candidate { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border: 1.5px dashed var(--ink); border-radius: 20px; background: var(--paper); margin: 0; }
.share-bottom { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; align-items: stretch; }
.share-bottom form { display: flex; justify-content: center; margin: 0; }
.share-url { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--divider); border-radius: 12px; font: inherit; font-size: 13px; color: var(--muted); background: var(--paper); }

/* desktop */
@media (min-width: 700px) {
  .page { padding-top: 32px; }
  body.has-hero .page { padding-top: 24px; }
  .hero { border: var(--border); border-radius: 24px; overflow: hidden; margin: 0 20px; }
  .detail { min-height: 0; }
}
@media (min-width: 1000px) {
  .page:has(.wish-grid) { max-width: 880px; }
  .wish-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
