/* Gifts: the builder (/gift, loaded after styles.css) and the page a gift opens on (/for, on its own). */

/* ---------- builder ---------- */

.gift-page { max-width: 1160px; margin: 0 auto; padding: calc(var(--nav-h) + 8px) var(--gutter) 80px; }
.lede-short { display: none; }
@media (max-width: 640px) { .gift-head .lede-short { display: block; } }
.gift-head { margin-bottom: 32px; }
.gift-head h1 { font-size: clamp(38px, 5.6vw, 64px); font-weight: 600; }
.gift-head .lede { max-width: 640px; margin-top: 18px; }
.gift-studio { grid-template-columns: minmax(0, 1fr) 400px; }
.gift-tip { text-align: center; }
.gift-controls { gap: 22px; padding-top: 18px; }
.gift-mode { align-self: flex-start; }
.gift-mode button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.swatches { grid-template-columns: repeat(8, 1fr); }
/* Outlined so the picker reads as a control, not one more swatch. */
.own-colors {
  width: fit-content; margin-top: 10px; padding: 5px 14px 5px 5px;
  border: 1px dashed var(--line-2); border-radius: 999px; transition: border-color 0.2s;
}
.own-colors.is-on { border-style: solid; border-color: var(--muted); }
.own-colors.is-on input[type='color'] { box-shadow: 0 0 0 2px var(--text); }
.backgrounds input[type='color'].is-on { box-shadow: 0 0 0 2px var(--text); }
#fonts .chip { font-size: 15px; }
/* Occasions in labelled sections; a chip leads with its emblem's little wireframe, and a holiday
   trails its date. */
.occasions { display: grid; gap: 12px; }
.occasion-label { display: flex; align-items: center; gap: 10px; }
.occasion-group { display: grid; gap: 6px; }
.occasion-head { font-size: 12px; color: var(--muted); }
#occasions .chip, #emblems .chip { display: inline-flex; align-items: center; gap: 6px; }
.emblem-icon { width: 18px; height: 18px; flex: none; margin-left: -3px; opacity: 0.85; }
.chip-note { font: 11px var(--mono); opacity: 0.7; }
.chip-more { border-style: dashed; }

.input {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 500 15px var(--font); color-scheme: dark;
}
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { resize: vertical; line-height: 1.45; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Labels on the first row, their inputs under them. */
.pair.labelled { row-gap: 8px; }
.pair .wide { grid-column: 1 / -1; }
.ask { margin-left: 6px; color: var(--muted); font-weight: 400; }
.hear { margin-left: auto; font-size: 13px; }

.gift-style { border-top: 1px solid var(--line); border-bottom: 0; }
.gift-style summary { font: 600 15px var(--font); letter-spacing: 0; text-transform: none; color: var(--text); }
.summary-hint { margin-left: 8px; color: var(--muted); font-weight: 400; font-size: 13px; }
.gift-reply { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(125, 255, 180, 0.08); border: 1px solid rgba(125, 255, 180, 0.3); color: #b9ffd6; font-size: 14px; }
.gift-deliver { align-self: flex-start; }
.pair .gift-deliver { justify-self: start; }
.input[aria-invalid='true'] { border-color: #ff6b6b; }
.fine.warn { color: #ff9b9b; }
.gift-deliver button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 500 13px var(--font); cursor: pointer; }
.export-btns.two { grid-template-columns: 1fr 1fr; }

/* Phones: a bar at the bottom leads to Send it until that box is on screen. */
.buy-bar { display: none; }

.drop {
  display: block; padding: 22px 16px; border: 1.5px dashed var(--line-2); border-radius: 12px;
  color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; cursor: pointer;
}
.drop b { color: var(--text); font-weight: 600; }
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(51, 204, 255, 0.05); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

#buy-box, #paid-box, #edit-box, #pack-box, #pending-box { display: grid; gap: 10px; }
#buy-box .label { margin-bottom: -4px; }
[hidden] { display: none !important; }
.paid-ok { margin: 0; color: #7dffb4; font-weight: 600; }
.link-row { display: flex; gap: 8px; }
.link-row .input { font: 12px var(--mono); }
.gift-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 80, 100, 0.08); border: 1px solid rgba(255, 80, 100, 0.3); color: #ffb3bf; font-size: 14px; }

.gift-mine { margin-top: 64px; }
.gift-mine h2 { margin-bottom: 16px; font-size: 24px; font-weight: 600; }
.gift-mine ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.gift-mine li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.mine-heard { flex-basis: 100%; margin: 0; color: var(--muted, #9aa4b2); font-size: 14px; }
.mine-name { flex: 1; min-width: 0; overflow: hidden; color: var(--accent); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  /* The header is in the flow (sticky), so on a phone the page starts just below it, not a header's height further. */
  .gift-page { padding-top: 20px; }
  /* The whole pitch is a screenful on a phone: one line instead, and the builder (who it's for first) right under it. */
  .gift-head .lede:not(.lede-short) { display: none; }
}
@media (max-width: 900px) {
  .gift-studio { display: block; }
  .gift-studio .panel { margin-top: 12px; }
  /* A square preview stays pinned under the nav, so edits further down are still in view. */
  .gift-studio .stage-col { position: sticky; top: var(--nav-h); z-index: 5; margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); background: var(--bg); }
  .gift-studio .stage { --arw: 1; --arh: 1; width: min(100%, 36vh); }
  .gift-tip { display: none; }
  .swatches { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .buy-bar {
    position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px;
    border: 1px solid var(--line-2); border-radius: 999px; background: rgba(10, 13, 19, 0.92);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-weight: 600; font-size: 14px;
    transition: transform 0.3s, opacity 0.3s;
  }
  .buy-bar.away { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .gift-page { padding-bottom: 120px; }
}

/* ---------- the gift itself ---------- */

body.for { margin: 0; height: 100dvh; overflow: hidden; background: #000; color: #f2f5f8; font: 16px/1.5 'Space Grotesk', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
.for canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
.for a { color: inherit; }

.for-banner { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.2); font-size: 13px; white-space: nowrap; }

.for-card {
  position: fixed; left: 50%; bottom: calc(var(--bar-h, 56px) + 28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(460px, calc(100% - 32px)); padding: 18px 22px; border-radius: 18px;
  background: rgba(4, 6, 10, 0.62); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  text-align: center; animation: card-in 1.2s ease both; transition: opacity 0.4s, transform 0.4s;
}
.for-card.away { opacity: 0; transform: translate(-50%, 16px); pointer-events: none; }
.for-card p { margin: 0; }
.for-close {
  position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; padding: 9px; border: 0; border-radius: 999px;
  background: none; color: #9aa4b2; cursor: pointer;
}
.for-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.for-close svg { display: block; width: 100%; height: 100%; }
.for-to { padding: 0 26px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.for-note { margin-top: 6px !important; color: #d4dae2; white-space: pre-line; }
.for-note:empty { display: none; }
.for-from { margin-top: 10px !important; color: #9aa4b2; font-size: 14px; }
.for-secret { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px dashed rgba(255, 210, 63, 0.7); background: rgba(255, 210, 63, 0.08); animation: secret-in 0.9s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.for-daily { display: block; margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.12); color: #33ccff; font-size: 13px; text-decoration: none; }
.for-daily:hover { text-decoration: underline; }
.for-secret-head { display: block; font: 500 11px 'JetBrains Mono', monospace; letter-spacing: 0.12em; text-transform: uppercase; color: #ffd23f; }
.for-secret p { margin-top: 4px !important; font-size: 18px; font-weight: 600; white-space: pre-line; }
@keyframes secret-in { from { opacity: 0; transform: scale(0.6) rotate(-4deg); } }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, 24px); } }

.for-bar { position: fixed; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 16px; }
.for-btn {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22); background: rgba(0, 0, 0, 0.5); color: #f2f5f8;
  font: 500 14px 'Space Grotesk', system-ui, sans-serif; text-decoration: none; white-space: nowrap; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.for-btn.icon { width: 40px; padding: 0; justify-content: center; }
.for-btn.icon svg { width: 18px; height: 18px; }
.for-btn:hover { border-color: #33ccff; }
.for-btn:disabled { opacity: 0.6; cursor: progress; }
.for-make { border-color: rgba(51, 204, 255, 0.6); }
.for-tip, .for-toast {
  position: fixed; left: 50%; top: max(56px, calc(env(safe-area-inset-top) + 44px)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 8px 16px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.18); text-align: center; font-size: 14px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade-in 0.8s ease both; transition: opacity 0.8s;
}
.for-toast { top: auto; bottom: calc(var(--bar-h, 56px) + 28px + env(safe-area-inset-bottom)); z-index: 11; }
.for-tip.away, .for-toast.away { opacity: 0; pointer-events: none; }
@keyframes fade-in { from { opacity: 0; } }

/* The envelope a gift arrives in. Tapping it lifts the flap, slides the letter up and fades it all away. */
.for-envelope {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 0; padding: 24px; background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.07), transparent 60%); color: #f2f5f8;
  font: inherit; cursor: pointer; transition: opacity 0.5s 0.75s;
}
.for-envelope.open { opacity: 0; pointer-events: none; }
.for-envelope.sealed { cursor: default; }
.for-envelope.sealed .env-tap { animation: none; font-family: 'JetBrains Mono', monospace; }
.for-envelope.shake .env { animation: env-shake 0.5s ease; }
@keyframes env-shake { 20%, 60% { transform: translateX(-8px) rotate(-2deg); } 40%, 80% { transform: translateX(8px) rotate(2deg); } }
.env { position: relative; width: min(300px, 72vw); aspect-ratio: 3 / 2; margin-bottom: 18px; perspective: 800px; animation: env-bob 3s ease-in-out infinite; }
.env-body, .env-flap, .env-letter { position: absolute; left: 0; right: 0; }
.env-body {
  inset: 0; border-radius: 10px; background: linear-gradient(160deg, #1b2230, #0c1018);
  border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: 0 30px 80px -20px rgba(51, 204, 255, 0.35);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); z-index: 2;
}
.env-flap {
  top: 0; height: 56%; background: linear-gradient(180deg, #273145, #161c28); clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top; transition: transform 0.5s ease; z-index: 3;
}
.env-letter { left: 8%; right: 8%; top: 8%; bottom: 8%; border-radius: 6px; background: linear-gradient(135deg, #33ccff, #a78bfa 55%, #ff3df2); transition: transform 0.6s 0.25s ease; z-index: 1; }
.env-seal {
  position: absolute; left: 50%; top: 52%; z-index: 4; width: 46px; height: 46px; margin: -23px 0 0 -23px; display: grid; place-items: center;
  border-radius: 50%; background: #33ccff; color: #001018; box-shadow: 0 0 24px rgba(51, 204, 255, 0.7); transition: opacity 0.2s;
}
.env-seal svg { width: 24px; height: 24px; }
.for-envelope.open .env { animation: none; }
.for-envelope.open .env-seal { opacity: 0; }
.for-envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.for-envelope.open .env-letter { transform: translateY(-60%); }
.env-to { font-size: clamp(24px, 6vw, 34px); font-weight: 700; letter-spacing: -0.01em; text-align: center; }
.env-from { color: #9aa4b2; }
.env-from:empty { display: none; }
.env-tap { margin-top: 10px; padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(51, 204, 255, 0.6); color: #bfefff; font-size: 14px; animation: env-pulse 2s ease-in-out infinite; }
@keyframes env-bob { 50% { transform: translateY(-6px); } }
@keyframes env-pulse { 50% { box-shadow: 0 0 0 6px rgba(51, 204, 255, 0.12); } }

.for-react {
  position: fixed; left: 50%; bottom: calc(var(--bar-h, 56px) + 28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 5;
  width: min(380px, calc(100% - 32px)); padding: 16px; border-radius: 18px; display: grid; gap: 12px;
  background: rgba(8, 11, 16, 0.92); border: 1px solid rgba(255, 255, 255, 0.18); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: card-in 0.4s ease both;
}
.for-react-head { margin: 0; font-weight: 600; text-align: center; }
.for-react-emoji { display: flex; justify-content: center; gap: 8px; }
.for-react-pick { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.05); font-size: 26px; cursor: pointer; transition: transform 0.15s; }
.for-react-pick[aria-pressed="true"] { border-color: #33ccff; background: rgba(51, 204, 255, 0.18); transform: scale(1.12); }
.for-react-text { height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.4); color: #f2f5f8; font: 15px 'Space Grotesk', system-ui, sans-serif; }
.for-react-text:focus { outline: none; border-color: #33ccff; }
.for-react-error { margin: 0; color: #ff9b9b; font-size: 13px; text-align: center; }
.for-react-row { display: flex; justify-content: flex-end; gap: 8px; }
.for-react[hidden] { display: none; }

.for-progress { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font: 13px 'JetBrains Mono', monospace; color: #c9d1db; }

.for-missing { position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; padding: 24px; text-align: center; }
.for-missing h1 { margin: 0; font-size: 28px; }
.for-missing p { margin: 0; max-width: 420px; color: #9aa4b2; }
.for-missing a { color: #33ccff; }


/* ---------- /review ---------- */

.review-login { display: flex; gap: 8px; max-width: 480px; margin-bottom: 16px; }
.review-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.review-list li { display: grid; grid-template-columns: 240px 1fr; gap: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.review-list canvas { width: 240px; height: 240px; border-radius: 10px; background: #000; }
.review-meta { display: flex; flex-direction: column; gap: 8px; }
.review-meta p { margin: 0; }
.review-to { font-weight: 600; }
.review-note { color: var(--muted); white-space: pre-line; }
@media (max-width: 600px) { .review-list li { grid-template-columns: 1fr; } }

/* ---------- /activity ---------- */

.activity-page[hidden] { display: none; }
.act-range { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.act-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.act-tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); min-width: 0; }
.act-tile p { margin: 0; }
.act-k { font-size: 13px; color: var(--muted); }
.act-v { font-size: 28px; font-weight: 600; margin: 4px 0 !important; font-variant-numeric: tabular-nums; }
.act-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.act-note { grid-column: 1 / -1; }
.act-h { margin: 32px 0 12px; font-size: 18px; }
.act-chart { display: grid; grid-template-columns: auto 1fr; gap: 8px; position: relative; }
.act-axis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font: 11px var(--mono); color: var(--muted); text-align: right; }
.act-bars { display: flex; align-items: stretch; gap: 2px; height: 160px; border-bottom: 1px solid var(--line); min-width: 0; }
.act-col { flex: 1; position: relative; display: flex; align-items: flex-end; min-width: 0; cursor: default; outline: none; }
.act-bar { width: 100%; max-width: 28px; margin: 0 auto; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.act-col:hover .act-bar, .act-col:focus .act-bar { filter: brightness(1.3); }
.act-day { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); padding-top: 4px; font: 10px var(--mono); color: var(--muted); white-space: nowrap; }
.act-tip { grid-column: 2; margin: 24px 0 0; font: 12px var(--mono); color: var(--text); }
.act-chart:not(:has(.act-tip:not([hidden]))) { padding-bottom: 24px; }
.act-table { margin-top: 12px; font-size: 13px; }
.act-table summary { cursor: pointer; color: var(--muted); }
.act-table table { margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.act-table th, .act-table td { padding: 4px 12px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }
.act-gifts { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.act-gifts > li { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); display: grid; gap: 6px; }
.act-gifts p { margin: 0; }
.act-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.act-pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.act-pill.on { color: var(--text); border-color: var(--accent); }
.act-reacts { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.act-e { font-size: 18px; }
#fill-field { display: flex; flex-direction: column; gap: 8px; }
#fill-field[hidden] { display: none; }
#looks .chip-note { margin-left: 6px; }

/* Their page, opened over the builder: the whole screen, with an X in the corner. */
.their-page { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: #000; overflow: hidden; }
.their-page iframe { display: block; width: 100%; height: 100%; border: 0; }
.their-page-close {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; width: 44px; height: 44px; padding: 11px; border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff; cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.their-page-close:hover { background: rgba(0, 0, 0, 0.8); }
.their-page-close svg { display: block; width: 100%; height: 100%; }

/* The last look before paying: the name and words, big enough to catch a typo. */
.last-look { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--panel); color: var(--text); }
.last-look::backdrop { background: rgba(0, 0, 0, 0.6); }
.last-look form { display: grid; gap: 12px; }
.last-look p { margin: 0; }
.last-look p[hidden] { display: none; }
.check-to { font: 600 22px var(--font); }
.check-words { font: 600 clamp(26px, 7vw, 34px) var(--font); line-height: 1.15; white-space: pre-line; overflow-wrap: anywhere; }
.check-from, .check-note { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.last-look .export-btns { margin-top: 8px; }
