/* Layout: wrapped-gift header band crossed by a ribbon, then a grid of gift-tag cards; owner gets a sticky bottom toolbar. */
:root {
  --bg: #EDF1F6; --card: #FFFFFF; --ink: #14213D; --muted: #56627A; --line: #D3DAE5; --edge: #8A96AB;
  --ribbon: #C8233F; --ribbon-ink: #FFFFFF; --ribbon-soft: #FBE3E7;
  --gold: #D9940F; --ok: #1C7154; --ok-soft: #DDF1E8; --warn-soft: #FFF3D6; --warn-ink: #6B4A00;
  --shadow: 0 2px 0 rgba(20,33,61,.08), 0 8px 24px -12px rgba(20,33,61,.18);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0E1520; --card: #162130; --ink: #E8EEF7; --muted: #9AA8BF; --line: #2A3A50; --edge: #63758F;
  --ribbon: #FF6F86; --ribbon-ink: #1A0910; --ribbon-soft: #3A1A24;
  --gold: #F6C453; --ok: #4FC79D; --ok-soft: #12342A; --warn-soft: #3A2E10; --warn-ink: #F6D58A;
  --shadow: 0 0 0 1px #2A3A50; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0E1520; --card: #162130; --ink: #E8EEF7; --muted: #9AA8BF; --line: #2A3A50; --edge: #63758F;
  --ribbon: #FF6F86; --ribbon-ink: #1A0910; --ribbon-soft: #3A1A24;
  --gold: #F6C453; --ok: #4FC79D; --ok-soft: #12342A; --warn-soft: #3A2E10; --warn-ink: #F6D58A;
  --shadow: 0 0 0 1px #2A3A50; color-scheme: dark; }

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--ribbon); outline-offset: 2px; border-radius: 6px; }
button, input, textarea { font: inherit; color: inherit; }

/* Header: wrapping paper + ribbon */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
  background-color: var(--card);
  background-image: radial-gradient(color-mix(in srgb, var(--ribbon) 14%, transparent) 1.4px, transparent 1.6px);
  background-size: 18px 18px; }
.hero::before { content: ""; position: absolute; top: 0; bottom: 0; right: clamp(28px, 12vw, 160px); width: 22px; background: var(--ribbon); opacity: .92; }
.hero .bow { position: absolute; right: calc(clamp(28px, 12vw, 160px) - 29px); top: 18px; width: 80px; height: 56px; color: var(--ribbon); }
.hero-in { position: relative; padding-block: 40px 28px; padding-right: max(16px, env(safe-area-inset-right, 0px), clamp(80px, 18vw, 230px)); }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
h1 { font-family: var(--f-display); font-optical-sizing: auto; font-weight: 800; font-size: clamp(34px, 7vw, 60px); line-height: 1.02; letter-spacing: -.02em; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.sub { margin: 10px 0 0; font-size: 18px; color: var(--muted); max-width: 52ch; overflow-wrap: anywhere; }
.sub:empty { display: none; }
.status { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 15px; color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.note { font-weight: 500; color: var(--muted); }

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; width: 100%; box-sizing: border-box; padding-block: 28px 48px; display: grid; gap: 24px; align-content: start; }

/* Banners */
.banner { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--r); background: var(--warn-soft); color: var(--warn-ink); }
.banner p { margin: 0; min-width: 0; flex: 1 1 260px; }
.banner .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Share help */
details.share { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
details.share summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; min-height: 44px; }
details.share summary::-webkit-details-marker { display: none; }
details.share summary .chev { margin-left: auto; transition: transform .2s; }
details.share[open] summary .chev { transform: rotate(180deg); }
.share-body { padding: 0 18px 18px; max-width: 70ch; }
.share-body ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.share-body p { margin: 12px 0 0; color: var(--muted); font-size: 15px; }

/* Grid of tags */
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); }
.card { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s, background-color .3s; }
.card::before { /* punched tag hole */ content: ""; position: absolute; top: 14px; right: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 1px 2px rgba(0,0,0,.18); }
.card.mine { background: linear-gradient(var(--ok-soft), var(--ok-soft)) top / 100% 6px no-repeat, var(--card); }
.card.taken .w-title, .card.taken .w-desc { color: var(--muted); }
.card.flash { box-shadow: 0 0 0 3px var(--ribbon), var(--shadow); }
.card.dragging { opacity: .5; }
.card.drop-before { box-shadow: 0 -4px 0 0 var(--ribbon), var(--shadow); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 22px; min-height: 0; }
.meta:empty { display: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; padding: 2px 10px 2px 6px; border-radius: 999px; }
.badge.star { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--ink); }
.badge.star svg { color: var(--gold); }
.badge.price { background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; padding-left: 10px; font-weight: 600; }
.w-title { font-family: var(--f-display); font-weight: 700; font-size: 22px; line-height: 1.15; letter-spacing: -.01em; margin: 0; padding-right: 22px; overflow-wrap: anywhere; }
.meta:not(:empty) + .w-title { padding-right: 0; }
.w-desc { margin: 0; color: var(--ink); opacity: .86; overflow-wrap: anywhere; white-space: pre-line; }
.link { align-self: flex-start; max-width: 100%; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--edge); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link svg { flex: none; transition: transform .15s; }
.link:hover { border-color: var(--ribbon); }
.link:hover svg, .link:focus-visible svg { transform: translate(2px, -2px); }
.nolink { font-size: 14px; color: var(--muted); }
.foot { margin-top: auto; padding-top: 12px; border-top: 1.5px dashed var(--line); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.foot:empty { display: none; }
.foot .spacer { flex: 1; }
.foot-note { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ribbon); border-color: var(--ribbon); color: var(--ribbon-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--ribbon-soft); border-color: transparent; color: var(--ink); }
.btn.icon { width: 44px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
.btn.reserved { background: var(--ok-soft); color: var(--ok); border-color: transparent; cursor: default; }
.btn.taken { background: var(--bg); color: var(--muted); border-color: transparent; cursor: default; opacity: 1; }
.btn.placeholder { border-style: dashed; color: var(--muted); background: transparent; cursor: default; }
.btn .spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tie path { stroke-dasharray: 40; stroke-dashoffset: 0; animation: tie .35s ease-out; }
@keyframes tie { from { stroke-dashoffset: 40; } }

/* Empty + skeleton */
.empty { text-align: center; padding: 48px 20px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); display: grid; gap: 12px; justify-items: center; }
.empty h2 { font-family: var(--f-display); font-size: 26px; margin: 0; }
.empty p { margin: 0; color: var(--muted); max-width: 44ch; }
.empty svg { color: var(--ribbon); }

/* Owner toolbar */
.toolbar { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.toolbar .wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-block: 10px; }
.toolbar .state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-right: auto; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.dirty { background: var(--gold); animation: pulse .6s ease-out 1; }
@keyframes pulse { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
.preview-bar { background: var(--ink); color: var(--bg); }
.preview-bar .wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding-block: 10px; }
.preview-bar .btn { background: var(--bg); color: var(--ink); border-color: transparent; }

/* Dialog */
dialog { border: none; padding: 0; border-radius: 18px; background: var(--card); color: var(--ink); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(10,16,28,.55); }
dialog form { display: grid; gap: 16px; padding: 22px 20px 20px; }
dialog h2 { font-family: var(--f-display); font-size: 24px; margin: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .check span { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field input[type=text], .field input[type=url], .field textarea { width: 100%; box-sizing: border-box; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--bg); }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--ribbon); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ribbon) 30%, transparent); }
.field [aria-invalid="true"] { border-color: var(--ribbon); }
.err { color: var(--ribbon); font-size: 14px; font-weight: 600; margin: 0; }
.err:empty { display: none; }
.two { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 520px) { .two { grid-template-columns: 1fr 1fr; align-items: end; } }
.check { display: flex; gap: 10px; align-items: center; min-height: 46px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ribbon); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { dialog { margin: auto auto 0; border-radius: 18px 18px 0 0; width: 100vw; max-width: 100vw; } .actions .btn { flex: 1; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- standalone additions ---- */
.center { min-height: 60vh; display: grid; place-items: center; padding-block: 40px; }
.login { width: min(420px, 100%); display: grid; gap: 16px; padding: 24px 20px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.login h1 { font-size: 32px; }
.login p { margin: 0; color: var(--muted); }
.copyrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.copyrow input { flex: 1 1 240px; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--bg); color: var(--ink); font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
details.recover { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.recover .code { font-family: ui-monospace, Consolas, monospace; font-size: 17px; letter-spacing: .04em; font-weight: 700; user-select: all; overflow-wrap: anywhere; }
.recover form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.recover form input { flex: 1 1 220px; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--bg); color: var(--ink); font-family: ui-monospace, Consolas, monospace; }
.site-foot { padding-block: 8px 28px; color: var(--muted); font-size: 13px; }

/* base reset (the artifact host used to provide this) */
html, body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
