/* EverPaw Home — the room is the whole window. Everything else floats over it and steps back when you stop moving. */

:root {
  --ink: #111111; --ink-2: #454545; --ink-3: #6b6b6b;
  --fill: #f1f1f1; --fill-2: #e5e5e5; --line: #e2e2e2;
  --butter: #ffd84d; --butter-2: #f6c927; --warn: #c2442a;
  --panel: 420px;
  --display: "Bricolage Grotesque", "Figtree", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --body: "Figtree", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(17, 17, 17, .08), 0 14px 36px -10px rgba(17, 17, 17, .3);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; color: var(--ink); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased;
  background: linear-gradient(165deg, var(--bg1, #FFE9D4), var(--bg2, #FBCDB3)); transition: background 1.2s; }
body[data-phase="evening"] { background: linear-gradient(165deg, #FFD9B0, #F4A98C); }
body[data-phase="night"] { background: linear-gradient(170deg, #34365F, #5A4C7E); }
::selection { background: var(--butter); color: var(--ink); }
img { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 10px; }
h1, h2 { font-family: var(--display); letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: clamp(28px, 2.6vw, 36px); line-height: 1.08; font-weight: 700; }
h2 { font-size: 24px; line-height: 1.15; font-weight: 700; }
h3 { font-size: 16px; line-height: 1.3; font-weight: 700; }
:lang(zh-CN) h1, :lang(zh-CN) h2 { letter-spacing: 0; font-weight: 600; line-height: 1.2; }
.fine { font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.fine.ok:empty { display: none; }
.lead { font-size: 15.5px; color: var(--ink-2); }
.link { font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the room ---------- */

#scene { position: fixed; inset: 0; }
canvas.world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 46%, transparent 52%, rgba(40, 20, 10, .2)); }
body[data-phase="night"] #vignette { background: radial-gradient(110% 85% at 50% 46%, transparent 40%, rgba(8, 8, 30, .5)); }
.no3d { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; }

/* ---------- controls floating over it ---------- */

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
.hud-top { position: absolute; left: 16px; right: 16px; top: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; pointer-events: none !important; transition: opacity .9s, right .35s var(--ease); }
.hud-top > * { pointer-events: auto; }
.who { display: flex; align-items: center; gap: 12px; max-width: min(560px, 68vw); padding: 7px 20px 7px 7px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); text-align: left; }
.who:hover { background: #fafafa; }
.portrait { flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--fill); }
.portrait.big { width: 84px; height: 84px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.portrait img.snap { object-fit: contain; padding: 6%; }
.who-text { display: grid; min-width: 0; }
.who-text strong { font: 700 17px/1.2 var(--display); letter-spacing: -.01em; }
.who-text em { font-style: normal; font-size: 14.5px; line-height: 1.3; color: var(--ink-2); }
.tools { display: flex; gap: 8px; }
.tool { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 12px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-weight: 600; font-size: 15px; }
.tool:hover { background: var(--fill); }
.tool[aria-pressed="false"] { color: var(--ink-3); }

.hud-bottom { position: absolute; left: 0; right: 0; bottom: 18px; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 10px; padding: 0 16px; pointer-events: none !important; transition: opacity .9s, right .35s var(--ease); }
.hud-bottom > * { pointer-events: auto; }
[data-bar] { max-width: 100%; }
.dock { display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.dock-btn { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px; border-radius: 999px; font-weight: 600; white-space: nowrap; transition: background .15s, transform .15s var(--ease); }
.dock-btn:hover { background: var(--fill); }
.dock-btn:active { transform: scale(.95); }
.dock .sep { flex: none; width: 1px; height: 26px; margin: 0 6px; background: var(--line); }
.hint { font-size: 13.5px; color: rgba(17, 17, 17, .62); text-align: center; pointer-events: none !important; }
body[data-phase="night"] .hint, body[data-phase="night"] .maker-cap { color: rgba(255, 255, 255, .82); }
body.quiet .hud-top, body.quiet .hud-bottom { opacity: 0; }
[data-tray] { position: relative; width: min(340px, 100%); height: 0; }
.tray { position: absolute; left: 0; right: 0; bottom: 8px; display: grid; gap: 4px; padding: 10px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); animation: pop .22s var(--ease); }
.tray p { padding: 8px 8px 0; font-weight: 600; }
.tray button { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; text-align: left; }
.tray button:hover { background: var(--fill); }
.tray-more { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; width: min(640px, 100%); min-height: 62px; padding: 8px 8px 8px 22px; border-radius: 30px; background: #fff; box-shadow: var(--shadow); }
.selbar.empty { justify-content: center; padding: 8px 22px; color: var(--ink-2); }
.selbar.empty span { display: flex; align-items: center; gap: 10px; }
.selbar.trying { background: #fff3c2; }
.selbar strong, .selbar div > span { display: block; }
.selbar div > span { font-size: 14px; color: var(--ink-2); }
.selbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.selbar .btn { min-height: 46px; }
.selbar.trying .btn:not(.primary) { background: #fff; }

/* ---------- buttons and fields ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; background: var(--fill); font-weight: 600; white-space: nowrap; transition: background .15s, transform .15s var(--ease); }
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--butter); }
.btn.primary:hover { background: var(--butter-2); }
.btn.big { min-height: 54px; padding: 0 26px; font-size: 17px; }
.btn.icon { width: 46px; padding: 0; }
.field { display: grid; gap: 9px; }
.field > span { font-weight: 600; }
.field > span i { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.field .fine { margin-top: -5px; }
.field input[type="text"], .field textarea { width: 100%; padding: 13px 17px; border: 2px solid var(--line); border-radius: 16px; background: #fff; font-size: 17px; transition: border-color .15s; }
.field textarea { font-size: 16px; resize: vertical; }
.field input:hover, .field textarea:hover { border-color: #bdbdbd; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field input::placeholder, .field textarea::placeholder { color: #8a8a8a; }
.field.tight { gap: 6px; }
.field.tight > span { font-size: 14px; color: var(--ink-2); }
.form-error { color: var(--warn); font-weight: 600; }
.form-error:empty { display: none; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 4px; border-radius: 24px; background: #fff; width: fit-content; max-width: 100%; }
.seg button { height: 40px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- making a home ---------- */

.maker { position: absolute; left: 16px; top: 16px; bottom: 16px; width: var(--panel); display: flex; flex-direction: column; gap: 18px; padding: 20px 24px 22px; border-radius: 28px; background: #fff; box-shadow: var(--shadow); overflow-y: auto; }
.maker-top { display: flex; align-items: center; justify-content: space-between; }
.maker-top .tool { box-shadow: none; background: var(--fill); }
.logo { display: flex; align-items: center; gap: 10px; font: 700 20px/1 var(--display); letter-spacing: -.03em; }
.mark { width: 36px; height: 36px; }
.steps { font-size: 14px; font-weight: 600; color: var(--ink-3); margin-bottom: -10px; }
.maker-body { display: grid; gap: 22px; }
.maker-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; }
.maker-actions .primary { flex: 1; }
.maker-cap { position: absolute; left: calc(var(--panel) + 32px); right: 16px; bottom: 26px; text-align: center; font: 600 clamp(17px, 1.5vw, 21px)/1.3 var(--display); color: rgba(17, 17, 17, .78); pointer-events: none !important; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice button { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border-radius: 18px; background: var(--fill); text-align: left; transition: background .15s, box-shadow .15s; }
.choice button:hover { background: var(--fill-2); }
.choice button[aria-pressed="true"] { background: #fff3c2; box-shadow: inset 0 0 0 3px var(--ink); }
.choice em { font-style: normal; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.species { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.species button { display: grid; justify-items: center; padding: 2px 2px 10px; border-radius: 18px; background: var(--fill); font-size: 14.5px; transition: background .15s, box-shadow .15s; }
.species button:hover { background: var(--fill-2); }
.species button[aria-pressed="true"] { background: #fff3c2; box-shadow: inset 0 0 0 3px var(--ink); }
.species img { width: 72%; aspect-ratio: 1; object-fit: contain; }
.photo { position: relative; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 18px; border: 2px dashed #c8c8c8; border-radius: 18px; cursor: pointer; transition: border-color .15s, background .15s; }
.photo:hover { border-color: var(--ink); background: #fafafa; }
.photo:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; }
.photo input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo.has { border-style: solid; border-color: var(--line); }
.photo.has img { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; }
.photo.has strong { text-decoration: underline; text-underline-offset: 3px; }
.look { display: grid; gap: 16px; padding: 16px; border-radius: 20px; background: var(--fill); }
.swatches { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.swatch { display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 500; cursor: pointer; }
.swatch input { width: 42px; height: 42px; padding: 0; border: 3px solid #fff; border-radius: 50%; background: none; cursor: pointer; box-shadow: 0 0 0 1px rgba(17, 17, 17, .18); }
.swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch input::-moz-color-swatch { border: 0; border-radius: 50%; }
.promises { display: grid; gap: 8px; color: var(--ink-2); font-size: 14.5px; }
.promises li { display: flex; gap: 10px; align-items: flex-start; }
.promises .ic { margin-top: 1px; stroke-width: 2.4; }

/* ---------- the side panel ---------- */

#drawer { position: fixed; z-index: 6; right: 0; top: 0; bottom: 0; width: var(--panel); display: flex; flex-direction: column; background: #fff; border-radius: 28px 0 0 28px; box-shadow: var(--shadow); transform: translateX(104%); transition: transform .38s var(--ease); }
#drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 12px 26px; }
.drawer-head .tool { box-shadow: none; background: var(--fill); }
.drawer-body { display: grid; gap: 26px; align-content: start; padding: 4px 26px 28px; overflow-y: auto; }
.drawer-body section { display: grid; gap: 10px; }
.drawer-body .row { display: flex; align-items: baseline; justify-content: space-between; }
body[data-mode="home"]:not([data-panel=""]) .hud-top, body[data-mode="home"]:not([data-panel=""]) .hud-bottom { right: var(--panel); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
.card { display: grid; gap: 1px; text-align: left; border-radius: 18px; align-content: start; }
.card-art { position: relative; display: block; aspect-ratio: 1; border-radius: 18px; background: var(--fill); margin-bottom: 5px; transition: background .15s, box-shadow .15s; }
.card-art img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; transition: transform .3s var(--ease); }
.card:hover .card-art { background: var(--fill-2); }
.card:hover img { transform: scale(1.07); }
.card.on .card-art { background: #fff3c2; box-shadow: inset 0 0 0 3px var(--ink); }
.card strong { font-size: 14.5px; line-height: 1.25; }
.card em { font-style: normal; font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.places { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.place { display: grid; gap: 2px; text-align: left; border-radius: 16px; align-content: start; }
.place-art { display: block; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; margin-bottom: 5px; transition: box-shadow .15s; }
.place-art img { width: 100%; height: 100%; object-fit: cover; }
.place.on .place-art { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.place strong { font-size: 14.5px; line-height: 1.25; }
.place em { font-style: normal; font-size: 13px; line-height: 1.35; color: var(--ink-3); }
.mini { position: relative; flex: none; display: block; width: 54px; height: 54px; border-radius: 16px; background: var(--fill); overflow: hidden; }
.mini img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.mini.big { width: 72px; height: 72px; }
.mini.room img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.things, .timeline { display: grid; gap: 12px; }
.things li, .timeline li { display: flex; align-items: center; gap: 14px; }
.things strong, .things em, .timeline strong, .timeline time { display: block; }
.things em, .timeline time { font-style: normal; font-size: 13.5px; color: var(--ink-3); }
.who-card { display: flex; align-items: center; gap: 16px; }
.meta { color: var(--ink-2); }
blockquote { font-size: 17px; line-height: 1.5; color: var(--ink-2); }
.stack { display: grid; gap: 8px; }

/* ---------- overlays ---------- */

#layer:empty { display: none; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(17, 17, 17, .5); animation: fade .2s; }
.scrim.clear { background: transparent; }
.modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px)); max-height: calc(100% - 40px); overflow: auto; border-radius: 28px; background: #fff; animation: rise .28s var(--ease); }
.modal:focus, .menu:focus { outline: none; }
.modal .close { position: absolute; right: 14px; top: 14px; box-shadow: none; background: var(--fill); }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 34px 30px 26px; }
.modal-body h2 { padding-right: 44px; }
.pay-art { position: relative; flex: none; height: 150px; border-radius: 20px; background: var(--fill); }
.pay-art img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.what { font-size: 17px; color: var(--ink-2); }
.bill { display: grid; gap: 10px; padding: 16px 18px; border-radius: 18px; background: var(--fill); font-variant-numeric: tabular-nums; }
.bill div { display: flex; justify-content: space-between; gap: 16px; }
.bill .total { padding-top: 10px; border-top: 1px solid #d6d6d6; font-weight: 700; }
.note { padding: 12px 16px; border-radius: 16px; background: #fff3c2; font-size: 14.5px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.modal-actions .primary { flex: 1; }
.menu { position: fixed; z-index: 41; right: 16px; top: 72px; display: grid; gap: 2px; width: 310px; max-width: calc(100% - 32px); padding: 10px; border-radius: 24px; background: #fff; box-shadow: var(--shadow); animation: pop .2s var(--ease); }
.menu button { padding: 12px 14px; border-radius: 14px; text-align: left; font-weight: 600; }
.menu button:hover { background: var(--fill); }
.menu p { padding: 10px 14px; font-size: 13.5px; line-height: 1.45; color: var(--ink-3); }
.menu .danger { color: var(--warn); }
#toast { position: fixed; z-index: 70; left: 50%; top: 80px; max-width: calc(100% - 32px); padding: 13px 22px; border-radius: 26px; background: var(--ink); color: #fff; font-weight: 500; font-size: 15px; text-align: center; opacity: 0; transform: translate(-50%, -12px); pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- small screens: panels come up from the bottom ---------- */

@media (max-width: 900px) {
  .maker { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 60vh; border-radius: 26px 26px 0 0; padding: 16px 18px 18px; }
  .maker-cap { display: none; }
  #drawer { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 56vh; border-radius: 26px 26px 0 0; transform: translateY(104%); }
  body[data-mode="home"]:not([data-panel=""]) .hud-top { right: 16px; }
  body[data-mode="home"]:not([data-panel=""]) .hud-bottom { right: 0; bottom: calc(56vh + 10px); }
  body:not([data-panel=""]) .hint { display: none; }
  .who-text em { font-size: 13.5px; }
  .dock-btn { height: 46px; padding: 0 13px; }
  .dock-btn span { font-size: 14.5px; }
  .hint { font-size: 12.5px; max-width: 100%; text-wrap: balance; }
  .hint .zoom { display: none; }
}

/* Phones: the dock becomes five equal keys, icon over label, so nothing is pushed off the edge. */
@media (max-width: 560px) {
  .dock { width: 100%; gap: 0; padding: 5px; border-radius: 26px; overflow: visible; }
  .dock-btn { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; height: 60px; padding: 0 2px; border-radius: 20px; }
  .dock-btn span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .dock .sep { margin: 0 2px; }
  .who { max-width: calc(100vw - 32px - 3 * 46px - 2 * 8px - 12px); }
  .who-text em { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
.hud-bottom > [data-bar], .hud-bottom > [data-tray] { justify-self: stretch; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; pointer-events: none; }
.hud-bottom > [data-bar] > *, .hud-bottom > [data-tray] > * { pointer-events: auto; }
