@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b6f76;
  --line: #e6e3dd;
  --accent: #5b6cff;
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --ok: #1f7a4d;
  --ok-bg: #e8f6ee;
  --err: #b42318;
  --err-bg: #fdecea;
  --warm: #ff9f1c;
  --paper: #fffaf0;
  --ink: #2a3a6b;
  --toon-ink: #2d2150;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px rgba(20, 20, 30, .06);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --card: #1b1d21;
    --text: #e8e9eb;
    --muted: #9a9ea6;
    --line: #2b2e34;
    --accent: #8391ff;
    --accent-text: #0e1020;
    --accent-soft: #23263a;
    --ok: #6fd3a0;
    --ok-bg: #16281f;
    --err: #ff8a80;
    --err-bg: #2e1a19;
    --paper: #2a2720;
    --ink: #e9dfc8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

main { margin: 0 auto; padding: 28px 16px 64px; }
main.narrow { max-width: 460px; }
main.wide { max-width: 960px; }
main.medium { max-width: 700px; }
body:not(:has(.nav)) main.narrow { padding-top: 12vh; }

h1 { font-size: 1.6rem; font-weight: 650; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }
.back { color: var(--muted); font-size: .92rem; }

.nav {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card);
}
.nav .brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.nav .spacer { flex: 1; }
.nav form { margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px; margin: 18px 0;
}
.card > h1 + .muted { margin-top: 0; margin-bottom: 22px; }
.card.highlight { border-color: var(--accent); background: var(--accent-soft); }
.danger-zone { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }

/* ---- Forms ---- */
form { margin: 0; }
label { display: block; font-size: .9rem; font-weight: 550; margin-bottom: 16px; }
label small { font-weight: 400; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 450; }
.field { margin-bottom: 16px; }
.field label { margin-bottom: 0; }
.field .hint { display: block; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.field-error { display: flex; gap: 6px; align-items: flex-start; color: var(--err); font-size: .85rem; margin-top: 6px; font-weight: 500; }
.field-error::before { content: "!"; flex: none; display: grid; place-items: center; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: var(--err); color: var(--card); font-size: .7rem; font-weight: 700; }
.field-error[hidden] { display: none; }
.field.invalid .hint { display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--err); }
.field.invalid input:focus, .field.invalid textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 20%, transparent); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input[type=checkbox] { width: auto; margin: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.code-input { font-family: ui-monospace, Menlo, monospace; letter-spacing: .2em; text-transform: uppercase; font-size: 1.2rem; text-align: center; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; } }

.pw { position: relative; display: block; }
.pw input { padding-right: 68px; }
.pw .show {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 3px;
  background: none; border: 0; color: var(--muted); font-size: .8rem; padding: 6px 8px;
}
.pw .show:active { transform: translateY(-50%) scale(.94); }

/* ---- Buttons: press, hover and loading feedback ---- */
button, .btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none;
  border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  transition: transform .08s ease, filter .15s, background .15s, box-shadow .15s;
  user-select: none;
}
button:hover, .btn:hover { filter: brightness(.96); text-decoration: none; }
button:active, .btn:active { transform: scale(.96); filter: brightness(.9); }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
button.primary:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
form > button.primary { width: 100%; padding: 12px; margin-top: 4px; }
.inline-form > button.primary, .card form[action^="/account"] > button.primary, .card form[action^="/admin/users"] > button.primary { width: auto; }
button.danger { color: var(--err); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 450; }
button.copied { background: var(--ok); color: #fff; }
.small-btn { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }

button.loading { color: transparent !important; pointer-events: none; }
button.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent;
  animation: spin .7s linear infinite;
}
button.primary.loading::after { border-color: var(--accent-text) transparent var(--accent-text) transparent; }
button.link.loading::after { width: 14px; height: 14px; border-color: var(--accent) transparent var(--accent) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 11px 14px; border-radius: 10px; font-size: .92rem; margin: 0 0 18px; animation: pop .25s ease-out; }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.foot { text-align: center; margin: 22px 0 0; color: var(--muted); font-size: .92rem; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }

.inline-form { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 14px; align-items: end; }
.inline-form .check, .inline-form > button { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 640px) { .inline-form { grid-template-columns: 1fr; } }

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { margin: 0; font-family: ui-monospace, Menlo, monospace; min-width: 0; }
.copy-row button { white-space: nowrap; width: auto !important; margin: 0 !important; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.table-wrap { overflow-x: auto; margin: 0 -8px; }
.card form + .table-wrap { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .6; }
td.actions { text-align: right; white-space: nowrap; }
td.actions > * { display: inline-block; margin-left: 6px; vertical-align: middle; }

.badge, .tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; font-weight: 550; }
.tag { background: var(--accent-soft); color: var(--accent); }
.badge.active { background: var(--ok-bg); color: var(--ok); }
.badge.used, .badge.expired { background: var(--line); color: var(--muted); }
.badge.revoked { background: var(--err-bg); color: var(--err); }
.badge.new { background: var(--accent-soft); color: var(--accent); }

/* ---- Avatar ---- */
.avatar {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  font-weight: 650; font-size: 1.3rem; color: #fff; background: var(--accent);
}
.avatar.big { width: 96px; height: 96px; font-size: 2.4rem; }
.av-0 { background: linear-gradient(135deg, #7c8cff, #5b6cff); }
.av-1 { background: linear-gradient(135deg, #ff9a8b, #ff6a88); }
.av-2 { background: linear-gradient(135deg, #5ee7b0, #2bb38a); }
.av-3 { background: linear-gradient(135deg, #ffc56b, #ff9f1c); }
.av-4 { background: linear-gradient(135deg, #b38cff, #8a5cf6); }
.av-5 { background: linear-gradient(135deg, #6fd6ff, #2f9be0); }
.av-6 { background: linear-gradient(135deg, #ff8fd0, #e0559f); }
.av-7 { background: linear-gradient(135deg, #a3b18a, #6b7f52); }
.edit-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.edit-head h1 { margin: 0; }

/* ---- Profile (TikTok-style, plain) ---- */
.profile { text-align: center; padding: 8px 0 4px; }
.profile .avatar { margin: 0 auto 12px; }
.profile .handle { font-size: 1.25rem; margin: 0; }
.display-name { margin: 2px 0 0; color: var(--muted); }
.stats { display: flex; justify-content: center; gap: 0; margin: 18px 0; }
.stats div { display: flex; flex-direction: column; padding: 0 20px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats strong { font-size: 1.1rem; font-weight: 700; }
.stats span { font-size: .8rem; color: var(--muted); }
.profile-actions { display: flex; justify-content: center; gap: 8px; }
.profile-actions .btn { padding: 9px 22px; }
.bio { margin: 16px auto 0; max-width: 340px; white-space: pre-line; }

.tabs { display: flex; margin: 26px -16px 0; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 0; color: var(--muted); font-weight: 550; font-size: .92rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab:active { transform: scale(.97); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: #ff3b5c; }
.tab-body { padding-top: 18px; animation: pop .2s ease-out; }
.tab-note { display: flex; align-items: center; gap: 8px; justify-content: center; color: var(--muted); font-size: .85rem; margin: 0 0 14px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  aspect-ratio: 3 / 4; padding: 14px 10px; border-radius: 14px; text-align: center;
  background: var(--card); border: 1px solid var(--line); color: var(--text); overflow: hidden;
  transition: transform .12s ease, box-shadow .15s;
}
.tile:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-2px); }
.tile:active { transform: scale(.97); }
.tile-label { font-weight: 600; font-size: .92rem; }
.tile-sub { font-size: .78rem; color: var(--muted); }
.tile-wallet .mini-card {
  position: relative; display: block; width: 100%; margin: auto 0 12px; aspect-ratio: 1.585;
  border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}
.mini-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mc-amount { position: absolute; top: 7%; left: 7%; color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1; }
.tile-wallet.is-used .mini-card { filter: grayscale(.8); opacity: .7; }

.empty-state { text-align: center; padding: 36px 16px; }
.empty-state > svg { width: 44px; height: 44px; color: var(--muted); stroke-width: 1.3; }
.empty-state p { margin: 6px 0 0; }

.projects { list-style: none; margin: 0; padding: 0; }
.projects li { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--line); }
.projects li:last-child { border-bottom: 0; }
.projects a { font-weight: 600; }

/* ---- Gift illustration: soft colours, thin outlines ---- */
.gift-art { width: 100%; height: 100%; overflow: visible; stroke: none; stroke-width: 0; }
.gift-art * { transform-box: fill-box; transform-origin: center; }
.gift-art .ga-line { stroke: var(--toon-ink); stroke-width: 3; stroke-linejoin: round; }
.ga-shadow { fill: var(--toon-ink); opacity: .1; }
.gift-art .ga-star { fill: #fff; stroke: var(--toon-ink); stroke-width: 2; stroke-linejoin: round; animation: twinkle 3s ease-in-out infinite; }
.ga-star.s2 { animation-delay: .75s; } .ga-star.s3 { animation-delay: 1.5s; } .ga-star.s4 { animation-delay: 2.25s; }
@keyframes twinkle { 50% { opacity: .3; } }

/* Profile tile for a new surprise */
.tile-new {
  justify-content: flex-start; padding: 12px 10px 14px;
  background: linear-gradient(160deg, var(--accent-soft), var(--card) 70%);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.tile-new .tile-gift { flex: 1; width: 72%; display: grid; place-items: center; margin-top: 10px; }
.new-badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: #ff3b5c; color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

/* Closed surprise page */
.open-stage { text-align: center; padding-top: 8px; }
.open-stage h1 { margin: 4px 0 8px; }
.from-line { margin: 0; color: var(--muted); }
.giftbox {
  position: relative; display: block; width: 230px; height: 230px; margin: 0 auto 18px;
  padding: 0; border: 0; background: none; border-radius: 50%;
}
.giftbox:hover { filter: none; }
.giftbox:active { transform: scale(.97); filter: none; }
.giftbox .gift-art { position: relative; z-index: 1; animation: float 4s ease-in-out infinite; }
.burst {
  position: absolute; inset: -20px; border-radius: 50%; z-index: 0; opacity: .6;
  background: repeating-conic-gradient(#ffe9a8 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 68%); mask: radial-gradient(circle, #000 30%, transparent 68%);
  animation: spin 40s linear infinite;
}
@media (prefers-color-scheme: dark) { .burst { opacity: .2; } }
@keyframes float { 50% { transform: translateY(-4px); } }
.open-stage.opening .gift-art { animation: shakebox .4s ease-in-out 2; }
.open-stage.opening .ga-lid { translate: 26px -40px; rotate: 14deg; transition: translate .5s .5s ease-out, rotate .5s .5s ease-out; }
.open-stage.opening .burst { opacity: 1; }
@keyframes shakebox { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

/* Edit profile: Save + Change password link on one row */
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-actions a { font-size: .92rem; }

/* Special button: a torn strip of paper. Use <button class="paper-btn"><span class="strip">Text</span></button> */
.paper-btn {
  padding: 0; border: 0; background: none; border-radius: 0;
  filter: drop-shadow(0 3px 3px rgba(30, 20, 60, .18));
  transition: transform .12s ease, filter .12s ease;
  rotate: -2deg;
}
.paper-btn .strip {
  --z: 9px; /* depth of the torn zig-zag ends */
  display: block; padding: 8px 40px 10px;
  font: 700 2rem/1.1 "Caveat", "Segoe Print", cursive; color: var(--toon-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .6), transparent 40%),
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(120, 90, 40, .035) 3px 4px),
    #fffaf0;
  -webkit-mask:
    conic-gradient(from -135deg at right, #0000, #000 1deg 89deg, #0000 90deg) 100% 50% / 51% calc(2 * var(--z)) repeat-y,
    conic-gradient(from 45deg at left, #0000, #000 1deg 89deg, #0000 90deg) 0 50% / 51% calc(2 * var(--z)) repeat-y;
  mask:
    conic-gradient(from -135deg at right, #0000, #000 1deg 89deg, #0000 90deg) 100% 50% / 51% calc(2 * var(--z)) repeat-y,
    conic-gradient(from 45deg at left, #0000, #000 1deg 89deg, #0000 90deg) 0 50% / 51% calc(2 * var(--z)) repeat-y;
}
.paper-btn:hover { filter: drop-shadow(0 6px 5px rgba(30, 20, 60, .2)); transform: translateY(-2px); rotate: -1deg; }
.paper-btn:active { filter: drop-shadow(0 1px 1px rgba(30, 20, 60, .2)); transform: translateY(2px) scale(.98); rotate: -2deg; }
.paper-btn.loading .strip { color: transparent; }
.paper-btn.loading::after { border-color: var(--toon-ink) transparent var(--toon-ink) transparent; }
@media (prefers-color-scheme: dark) { .paper-btn .strip { background-color: #f3ead6; } }
form[data-open-gift] > .paper-btn { width: auto; margin-top: 6px; }

/* ---- Gift card (opened) ---- */
.reveal-stage { position: relative; padding-top: 8px; }
.giftcard {
  position: relative; container-type: inline-size; aspect-ratio: 1.585; border-radius: 18px; overflow: hidden;
  background: #000; box-shadow: 0 18px 40px rgba(15, 25, 40, .28);
}
.giftcard img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gc-amount {
  position: absolute; top: 7%; left: 6.5%; color: #fff; line-height: 1;
  font-weight: 700; font-size: clamp(1.4rem, 9cqw, 2.6rem); letter-spacing: -.01em;
}
.gc-used {
  position: absolute; top: 7%; right: 6.5%; color: #fff; font-size: .8rem; font-weight: 600;
  background: rgba(255, 255, 255, .2); padding: 3px 10px; border-radius: 999px;
}
.giftcard.is-used img { filter: grayscale(1) brightness(.75); }

.note {
  position: relative; margin: 22px 8px 0; padding: 18px 22px; background: var(--paper); color: var(--ink);
  border-radius: 4px; transform: rotate(-1.2deg); box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
  background-image: repeating-linear-gradient(transparent 0 33px, color-mix(in srgb, var(--ink) 10%, transparent) 33px 34px);
}
.note::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 80px; height: 22px; margin-left: -40px;
  background: color-mix(in srgb, var(--warm) 35%, transparent); transform: rotate(2deg);
}
.hand { font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive; font-size: 1.6rem; line-height: 34px; margin: 0; white-space: pre-line; }
.hand.sig { text-align: right; margin-top: 4px; }

.code-box { margin-top: 24px; }
.code-box h2 { margin-bottom: 10px; }
.code-box .code { font-size: 1.1rem; letter-spacing: .08em; text-align: center; background: var(--bg); }
.redeem { width: 100%; margin-top: 12px; }
.redeem svg { width: 1em; height: 1em; }
.safe { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .92rem; margin: 18px 4px 0; }
.safe svg { margin-top: 2px; color: var(--ok); }
.used-form { text-align: center; margin-top: 18px; }

/* Reveal animation (first time only) */
.reveal .giftcard { animation: cardIn .9s cubic-bezier(.2, 1.2, .4, 1) both; }
.reveal .note { animation: noteIn .6s .6s ease-out both; }
.reveal .code-box, .reveal .safe, .reveal .used-form { animation: pop .5s .9s ease-out both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(60px) rotateX(55deg) scale(.8); } }
@keyframes noteIn { from { opacity: 0; transform: translateY(16px) rotate(-6deg); } }
.confetti { position: absolute; inset: 0 0 auto 0; height: 0; z-index: 5; pointer-events: none; }
.confetti i { position: absolute; top: 120px; left: 50%; width: 8px; height: 12px; border-radius: 2px; opacity: 0; animation: burst 1.4s .25s ease-out forwards; }
.confetti i:nth-child(4n+1) { background: #ff3b5c; } .confetti i:nth-child(4n+2) { background: #ffc23d; }
.confetti i:nth-child(4n+3) { background: #5b6cff; } .confetti i:nth-child(4n) { background: #2bb38a; }
.confetti i:nth-child(1) { --x: -160px; --y: -110px; } .confetti i:nth-child(2) { --x: 150px; --y: -130px; }
.confetti i:nth-child(3) { --x: -90px; --y: -160px; } .confetti i:nth-child(4) { --x: 100px; --y: -90px; }
.confetti i:nth-child(5) { --x: -190px; --y: -40px; } .confetti i:nth-child(6) { --x: 190px; --y: -50px; }
.confetti i:nth-child(7) { --x: -40px; --y: -170px; } .confetti i:nth-child(8) { --x: 50px; --y: -175px; }
.confetti i:nth-child(9) { --x: -130px; --y: -150px; } .confetti i:nth-child(10) { --x: 130px; --y: -160px; }
.confetti i:nth-child(11) { --x: -70px; --y: -80px; } .confetti i:nth-child(12) { --x: 75px; --y: -140px; }
.confetti i:nth-child(13) { --x: -175px; --y: -125px; } .confetti i:nth-child(14) { --x: 170px; --y: -100px; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 160px)) rotate(540deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.tile.tile-wallet { aspect-ratio: auto; padding-top: 10px; }
.tile-wallet .mini-card { margin: 0 0 10px; }

/* ---- Adopt Me balance (our own card design) ---- */
.ac-bg { background: linear-gradient(135deg, #6cc8ff 0%, #9b8cff 55%, #ff9fcf 100%); color: #fff; }
.tile-wallet .mini-card.ac-bg { container-type: inline-size; background: linear-gradient(135deg, #6cc8ff 0%, #9b8cff 55%, #ff9fcf 100%); }
.ac-paw { position: absolute; right: -4%; bottom: -12%; width: 52%; color: rgba(255, 255, 255, .22); rotate: -18deg; }
.ac-paw svg { width: 100%; height: auto; display: block; }
.ac-title {
  position: absolute; left: 6.5%; bottom: 9%; color: #fff; font-weight: 700; line-height: 1.05;
  font-size: 9cqw; letter-spacing: -.01em; text-shadow: 0 1px 8px rgba(60, 40, 120, .25);
}
.ac-title small { display: block; margin-top: .25em; font-size: .42em; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; opacity: .9; }
.ac-bg .gc-amount, .ac-bg .mc-amount { text-shadow: 0 1px 8px rgba(60, 40, 120, .25); }
.wish-box { margin-top: 24px; }
.wish-box .alert { margin-top: 4px; }
.wish-box .talk { margin: 16px 0 0; }
.shop-row { text-align: center; margin: 26px 0 8px; }
a.paper-btn { display: inline-block; text-decoration: none; }
a.paper-btn:hover { text-decoration: none; }
.balance-form { display: flex; gap: 6px; align-items: center; }
.balance-form input { margin: 0; width: 90px; padding: 6px 8px; font-size: .9rem; }
tr.wish-row td { padding-top: 0; }
tr:has(+ tr.wish-row) td { border-bottom: 0; }
.wish-text { white-space: pre-line; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-top: 4px; font-size: .9rem; }
[hidden] { display: none !important; }

/* ---- Balance: pockets and coins ---- */
.center { text-align: center; }
.balance-pill {
  display: inline-flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text);
  transition: transform .08s ease, box-shadow .15s;
}
.balance-pill:hover { text-decoration: none; box-shadow: var(--shadow); }
.balance-pill:active { transform: scale(.97); }
.balance-pill > span { display: inline-flex; align-items: center; gap: 6px; }
.balance-pill svg { color: var(--muted); }
.pill-sep { width: 1px; height: 18px; background: var(--line); }
.bal-head { text-align: center; margin: 4px 0 18px; }
.bal-head p { margin: 0; }
.bal-total { font-size: 2.6rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; }
.pocket-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pocket {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; min-height: 104px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--text);
  transition: transform .08s ease, box-shadow .15s;
}
.pocket:hover { text-decoration: none; box-shadow: var(--shadow); }
.pocket:active { transform: scale(.97); }
.pk-icon { color: var(--accent); margin-bottom: auto; }
.pk-icon svg { width: 22px; height: 22px; }
.pk-name { font-size: .88rem; color: var(--muted); }
.pk-amt { font-size: 1.3rem; font-weight: 700; }
.pocket-new { border-style: dashed; background: transparent; justify-content: center; gap: 8px; }
.pocket-new input { margin: 0; padding: 8px 10px; }
.pocket-new button { align-self: flex-start; }
.pocket-grid + .center { margin: 10px 0 0; }
.move-form { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 10px; align-items: end; }
.move-form label { margin-bottom: 16px; }
.move-arrow { color: var(--muted); padding-bottom: 28px; }
.move-form .field, .move-form > button { grid-column: 1 / -1; }
.move-form > button { width: 100%; }
.coins-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.coins-row h2 { margin: 0; }
.coin-big { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 1.6rem; font-weight: 700; }
.coin-big svg, .convert-facts svg { color: #d9a400; }
.convert-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 20px; }
.convert-facts div, .mini-pockets div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--bg); border-radius: 10px; }
.convert-facts strong { display: flex; align-items: center; gap: 5px; font-size: .98rem; }
.mini-pockets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 18px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.history small { display: block; color: var(--muted); font-size: .78rem; }
.h-amt { font-weight: 650; white-space: nowrap; }
.h-amt.pos { color: var(--ok); }
.h-amt.neg { color: var(--err); }
.h-amt.neutral { color: var(--muted); }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0 12px; align-items: end; }
.row-3 > button { grid-column: 1 / -1; justify-self: start; }
.card form.row-3 + p, .card form.row-3 + form { margin-top: 0; }
.card form.row-3 + p + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.card form.row-3 ~ .history, .card form.row-3 ~ .empty { margin-top: 16px; border-top: 1px solid var(--line); }
.settings-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0 10px; }
.settings-form label { flex: 1 1 90px; }
.settings-form .settings-eq { padding-bottom: 26px; color: var(--muted); }
.settings-form button { margin-bottom: 16px; }
@media (max-width: 520px) { .row-3, .convert-facts { grid-template-columns: 1fr; } }

/* ---- Icon-only tabs ---- */
.tab svg { width: 1.45em; height: 1.45em; }
.tab .dot { position: absolute; top: 9px; left: calc(50% + 10px); }

/* ---- Wishes ---- */
.shop-row.top { margin: 4px 0 18px; }
.wish-list { display: grid; gap: 12px; }
.wish { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: box-shadow .15s; }
.wish.is-ready { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.wish-main { display: block; padding: 16px 16px 14px; color: var(--text); }
a.wish-main:hover { text-decoration: none; }
a.wish-main:active { background: var(--bg); }
.wish:has(a.wish-main:hover) { box-shadow: var(--shadow); }
.wish-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wish-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 1.05rem; }
.wish-title svg { color: var(--accent); }
.wish-badge { font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.wish-badge.ready { background: var(--ok-bg); color: var(--ok); }
.wish-badge.asked { background: var(--accent-soft); color: var(--accent); }
.wish-note { font-size: 1.35rem; line-height: 1.25; margin: 8px 0 0; color: var(--ink); }
.wish progress { display: block; width: 100%; height: 10px; margin: 12px 0 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); appearance: none; -webkit-appearance: none; }
.wish progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.wish progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .4s; }
.wish progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.wish.is-ready progress::-webkit-progress-value { background: var(--ok); }
.wish.is-ready progress::-moz-progress-bar { background: var(--ok); }
.wish-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .88rem; }
.wish-foot { margin: 0; padding: 0 16px 16px; }
.wish-foot.center { text-align: center; }
.wish-foot .paper-btn .strip { font-size: 1.6rem; padding: 6px 32px 8px; }
.collected-title { margin: 26px 0 8px; font-size: .95rem; color: var(--muted); }
.collected { list-style: none; margin: 0; padding: 0; }
.collected li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.collected li span:first-child { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.collected svg { color: var(--ok); }
.center-row { justify-content: center; margin-top: 4px; }
.added-box { margin-top: 24px; }
.added-line { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.added-line svg { color: var(--accent); width: 22px; height: 22px; }
.added-box .talk { margin: 14px 0 0; }

/* ---- Bell + inbox + toasts ---- */
.bell { position: relative; display: inline-flex; color: var(--text); padding: 4px; border-radius: 8px; }
.bell:hover { text-decoration: none; background: var(--bg); }
.bell:active { transform: scale(.92); }
.bell svg { width: 22px; height: 22px; }
.bell-badge {
  position: absolute; top: -3px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #ff3b5c; color: #fff; font-size: .7rem; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--card); animation: pop .25s ease-out;
}
.bell-badge[hidden] { display: none; }
.inbox { list-style: none; margin: 16px 0 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.inbox li + li { border-top: 1px solid var(--line); }
.inbox a { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; color: var(--text); }
.inbox a:hover { text-decoration: none; background: var(--bg); }
.inbox li.unread a { background: var(--accent-soft); }
.inbox li.unread .in-text { font-weight: 600; }
.in-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--accent); }
.inbox li.unread .in-icon { background: var(--card); }
.in-text small { display: block; margin-top: 2px; color: var(--muted); font-weight: 400; font-size: .8rem; }
.toasts { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 420px; width: 100%; padding: 12px 16px; border-radius: 12px; border: 0;
  background: var(--text); color: var(--bg); font: inherit; font-size: .92rem; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; cursor: pointer;
}
.toast.in { opacity: 1; transform: none; }
a.toast:hover { text-decoration: none; }
