/* The fonts ship with the game (SIL OFL 1.1, see CREDITS.md): no outside requests. */
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 100 900; font-display: swap; src: url(assets/fonts/fraunces.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 100 900; font-display: swap; src: url(assets/fonts/fraunces-italic.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 200 1000; font-display: swap; src: url(assets/fonts/nunito.woff2) format('woff2'); }
:root { --ink: #2b1d18; --paper: #fff8ea; --paper2: #f3e7cc; --gold: #ffc93a; --rose: #f28fb3; --sage: #8fb98a; --crimson: #d8283c; --indigo: #4b3fa8; --serif: 'Fraunces', Georgia, 'Times New Roman', serif; --sans: 'Nunito', 'Segoe UI', system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1530; font-family: var(--sans); color: var(--ink); user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#recap-canvas { position: fixed; inset: 0; margin: auto; max-width: 100vw; max-height: 100vh; display: none; z-index: 50; background: #000; }
#recap-canvas.on { display: block; }
body.recapping #hud, body.recapping #menu { display: none !important; }
.hidden { display: none !important; }
button { font-family: var(--sans); cursor: pointer; border: 3px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 12px; padding: 6px 12px; font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 var(--ink); transition: transform .08s; }
button:hover { transform: translateY(-1px); background: #fff; }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
button.big { font-size: 20px; padding: 12px 26px; }
button.link { background: none; border: none; box-shadow: none; text-decoration: underline; color: var(--paper2); }
button:disabled { opacity: .45; cursor: default; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 40; }
#loading { background: radial-gradient(circle at 50% 40%, #3a2a60, #1b1530); color: var(--paper2); }
#title { background: linear-gradient(180deg, transparent 50%, rgba(20,12,30,.6)); color: var(--paper); text-shadow: 0 2px 8px #000; }
#title-sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.mirror { display: flex; flex-direction: column; align-items: center; margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(40px, min(13vw, 14vh), 118px); line-height: 1; letter-spacing: .06em; text-shadow: none; }
.mirror .above, .mirror .below { -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .1em .08em; }
.mirror .above { background-image: linear-gradient(180deg, #fff6cf, #ffd060 45%, #c98a1e); filter: drop-shadow(0 0 22px rgba(255,190,80,.55)); animation: shine 6s ease-in-out infinite; }
.mirror .below { background-image: linear-gradient(180deg, #f2f6ff, #a9c0f0 55%, rgba(130,160,230,.6)); filter: url(#ripple) drop-shadow(0 0 14px rgba(150,180,255,.45)); }
.mirror .below { position: relative; }
.mirror .below::before { content: ''; position: absolute; inset: 10% -12%; z-index: -1; background: radial-gradient(closest-side, rgba(14,10,34,.55), transparent); filter: none; }
.mirror .horizon { width: min(760px, 86vw); height: 3px; margin: .14em 0 .1em; border-radius: 2px; background: linear-gradient(90deg, transparent, #ffd98a 20%, #fff 50%, #ffd98a 80%, transparent); box-shadow: 0 0 22px 5px rgba(255,190,110,.55); }
@keyframes shine { 50% { filter: drop-shadow(0 0 34px rgba(255,200,90,.85)); } }
.tag { font-family: var(--serif); font-size: 26px; font-style: italic; margin: 0; max-width: 90vw; text-align: center; }
.row { display: flex; gap: 14px; }
.bar { width: 320px; height: 14px; border-radius: 8px; border: 3px solid var(--paper2); overflow: hidden; }
#load-bar { height: 100%; width: 0; background: var(--gold); transition: width .2s; }

#creator { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#creator .panel { pointer-events: auto; position: absolute; left: 24px; top: 24px; bottom: 24px; width: min(460px, 46vw); overflow-y: auto; background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 18px 22px; box-shadow: 8px 8px 0 rgba(43,29,24,.6); display: flex; flex-direction: column; gap: 12px; }
#creator h2, .card h2, #nightui h2 { font-family: var(--serif); font-size: 34px; margin: 0; }
#creator label { display: flex; flex-direction: column; font-weight: 800; gap: 4px; }
input, select { font: 700 16px var(--sans); padding: 8px 10px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; }
.field > span { font-weight: 800; display: block; margin-bottom: 4px; }
.chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.chips button { min-width: 0; }
.chips.wide { grid-template-columns: repeat(3, 1fr); }
.chips.two { grid-template-columns: repeat(2, 1fr); }
.chips.three { grid-template-columns: repeat(3, 1fr); }
.chips.four { grid-template-columns: repeat(4, 1fr); }
.chips.tabs { grid-template-columns: repeat(5, 1fr); position: sticky; top: -18px; z-index: 2; background: var(--paper); padding: 6px 0; }
#creator [data-tab][hidden] { display: none; }
#cr-go { position: sticky; bottom: -18px; }
#cr-skills { display: grid; grid-template-columns: 1fr auto 2ch auto; gap: 4px 8px; align-items: center; }
#cr-skills button { padding: 2px 10px; font-size: 16px; box-shadow: 0 2px 0 var(--ink); border-width: 2px; }
#cr-skills b { text-align: center; }
.chips button { padding: 5px 4px; font-size: 13px; box-shadow: 0 2px 0 var(--ink); border-width: 2px; }
.chips button.on, .swatches button.on { background: var(--gold); outline: 3px solid var(--ink); }
#night-panel button.on { background: var(--gold); outline: 3px solid var(--ink); }
.chips .glyph { font-size: 22px; display: block; font-family: 'Segoe UI Symbol', serif; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 32px; height: 32px; padding: 0; border-radius: 50%; border-width: 3px; box-shadow: none; }
.swatches button.none { width: auto; padding: 0 10px; border-radius: 16px; font-size: 13px; }
.swatches .any { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; cursor: pointer; position: relative; font-size: 15px; overflow: hidden; }
.swatches .any.on { outline: 3px solid var(--ink); }
.swatches .any input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#cr-random { align-self: flex-start; }
#cr-hatcolor { margin-top: 6px; }
small { color: #5a4a70; }
#cr-bodies small { display: block; font-weight: 600; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: stretch; pointer-events: none; }
#topbar > * { pointer-events: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 10px; box-shadow: 0 4px 0 rgba(43,29,24,.5); display: flex; align-items: center; gap: 8px; }
#clock { flex-direction: column; align-items: flex-start !important; gap: 0 !important; line-height: 1.1; }
#clock big { font-size: 22px; font-weight: 800; }
#clock span { font-size: 12px; }
#speed button { padding: 2px 8px; font-size: 16px; border-width: 2px; box-shadow: none; }
#speed button.on { background: var(--gold); }
#skystrip { flex: 1; overflow: hidden; flex-wrap: nowrap; font-size: 14px; }
.pchip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 10px; background: #efe4cc; white-space: nowrap; font-weight: 700; border: 2px solid transparent; }
.pchip b { font-family: 'Segoe UI Symbol', serif; font-size: 17px; }
.pchip.hard { border-color: var(--crimson); background: #ffe0e4; }
.pchip.soft { border-color: var(--sage); background: #e6f4e2; }
.pchip.rx { font-style: italic; }
#wallet { font-weight: 800; font-size: 16px; }
#tools button { padding: 3px 8px; font-size: 18px; border-width: 2px; box-shadow: none; }
#b-gb { position: relative; overflow: hidden; font-size: 11px !important; padding: 6px 10px !important; background: #2a2040; color: #fff; }
#b-gb b { position: relative; }
#gb-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #c9a24a, #ffd34a); }
#b-gb.ready { animation: pulse 1s infinite; color: var(--ink); }
#b-gb.active { background: #ffd34a; color: var(--ink); }
@keyframes pulse { 50% { box-shadow: 0 0 18px var(--gold); } }
#me { position: absolute; left: 10px; bottom: 10px; width: 270px; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 10px 12px; box-shadow: 0 4px 0 rgba(43,29,24,.5); }
#me .head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
#me-glyph { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; border: 3px solid var(--ink); font-family: 'Segoe UI Symbol', serif; }
#me .head small { display: block; }
#me-mood { margin-left: auto; font-weight: 800; font-size: 12px; text-transform: uppercase; }
.need { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin: 3px 0; }
.need .b { height: 10px; border-radius: 6px; background: #ddd0b4; overflow: hidden; border: 2px solid var(--ink); }
.need .b i { display: block; height: 100%; }
#skills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; font-size: 11px; font-weight: 700; }
#me-goals { display: grid; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 2px dashed #d8c9a8; font-size: 11.5px; font-weight: 700; cursor: pointer; }
#me-goals:empty { display: none; }
#me-goals span { display: flex; align-items: center; gap: 4px; }
#me-goals span[data-goal]:hover { background: #f3e7cb; border-radius: 6px; }
#me-goals span.done { opacity: 0.55; text-decoration: line-through; }
#me-goals .gp { font-style: normal; color: #fff; border-radius: 50%; width: 15px; height: 15px; display: inline-grid; place-items: center; font-size: 10px; margin-right: 3px; font-family: 'Segoe UI Symbol', serif; }
#me-goals b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
#skills span { background: #efe4cc; border-radius: 8px; padding: 1px 6px; }
#doing { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 8px 6px 14px; display: flex; gap: 10px; align-items: center; font-weight: 800; box-shadow: 0 4px 0 rgba(43,29,24,.5); }
#transits { position: absolute; right: 10px; bottom: 10px; width: 260px; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 12px; font-size: 13px; box-shadow: 0 4px 0 rgba(43,29,24,.5); max-height: 40vh; overflow-y: auto; }
#transits h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 20px; }
#transits .t { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; }
#transits .t b { font-family: 'Segoe UI Symbol', serif; }
#transits .t.hard { color: var(--crimson); }
/* The phone: a handset in your Sim's hand, with a status bar, an app grid and a home button. */
#sidepanel { position: absolute; right: 14px; top: 76px; width: 340px; height: min(640px, calc((100vh - 150px) / var(--tz, 1))); display: flex; flex-direction: column; background: var(--paper); border: 10px solid #2b1d18; border-radius: 36px; padding: 0; box-shadow: 0 6px 0 rgba(43,29,24,.5), inset 0 0 0 2px #5a4a70; overflow: hidden; animation: phoneup .22s ease-out; }
@keyframes phoneup { from { transform: translateY(40px); opacity: 0; } }
#sidepanel::before { content: ''; position: absolute; top: 6px; left: 50%; width: 76px; height: 18px; margin-left: -38px; background: #2b1d18; border-radius: 10px; z-index: 2; }
#ph-status { display: flex; justify-content: space-between; padding: 7px 20px 4px; font-size: 12px; font-weight: 800; color: #5a4a70; flex: none; }
#side-body { flex: 1; overflow-y: auto; padding: 6px 14px 12px; }
#ph-nav { flex: none; display: flex; justify-content: center; padding: 6px 0 8px; border-top: 2px solid #efe4cc; }
#ph-nav.hidden { display: none; }
#ph-nav button { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 20px; box-shadow: none; }
#sidepanel .x { top: 34px; right: 12px; z-index: 3; }
.ph-hello { text-align: center; margin: 18px 0 14px; }
.ph-hello b { display: block; font-family: var(--serif); font-size: 46px; line-height: 1; }
.ph-hello small { color: #5a4a70; font-weight: 700; }
.apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 0; background: none; border: none; box-shadow: none; }
.app span { position: relative; width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; background: #fff7e6; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink); }
.app:hover span { transform: translateY(-2px); }
.app span i { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #d8283c; color: #fff; font-style: normal; font-size: 12px; font-weight: 800; line-height: 20px; }
.app small { font-size: 12px; font-weight: 800; }
#side-body .msg { display: flex; gap: 10px; align-items: center; width: 100%; margin: 6px 0; padding: 8px 10px; text-align: left; background: #fff7e6; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 2px 0 var(--ink); }
#side-body .msg > span { font-size: 24px; }
#side-body .msg > div { flex: 1; }
#side-body .msg small { display: block; color: #5a4a70; }
#side-body .msg > button { padding: 2px 10px; box-shadow: none; }
#side-body .wide { display: block; width: 100%; margin: 8px 0; text-align: left; }
#side-body .toggle { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-weight: 700; }
#b-phone { position: relative; font-size: 22px !important; }
#phone-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: #d8283c; color: #fff; font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; animation: pulse 1s infinite; }
#phone-badge.hidden { display: none; }
.card p.goals { background: #f3ead5; border-radius: 10px; padding: 6px 10px; }
#sidepanel .x, .card .x { position: absolute; right: 8px; top: 8px; padding: 0 8px; box-shadow: none; }
#sidepanel h3 { font-family: var(--serif); font-size: 26px; margin: 0 0 8px; }
.post { border-bottom: 2px dashed #d8c9a8; padding: 6px 0; font-size: 14px; }
.post .ic { font-size: 20px; }
.post small { display: block; }
.relrow { display: grid; grid-template-columns: 1fr 160px; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px dashed #d8c9a8; font-size: 13px; }
.mini { display: grid; grid-template-columns: 16px 1fr; gap: 4px; align-items: center; font-size: 11px; }
.mini .b { height: 7px; background: #ddd0b4; border-radius: 4px; overflow: hidden; }
.mini .b i { display: block; height: 100%; }
.quest { padding: 6px 8px; border: 2px solid var(--ink); border-radius: 10px; margin: 6px 0; background: #fff; font-size: 14px; }
.quest progress { width: 100%; }
.quest .where { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.quest .where button { padding: 2px 12px; }

#menu { position: fixed; z-index: 20; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 10px; min-width: 250px; max-width: 320px; box-shadow: 6px 6px 0 rgba(43,29,24,.5); }
#menu h3 { margin: 0; font-family: var(--serif); font-size: 24px; }
#menu .sub { font-size: 12px; margin-bottom: 6px; color: #5a4a70; }
#menu .opts { display: flex; flex-direction: column; gap: 5px; max-height: 50vh; overflow-y: auto; }
#menu { max-height: calc(100vh - 20px); overflow-y: auto; } /* short landscape phones: never past the bottom edge */
#menu .opts button { text-align: left; display: flex; gap: 8px; align-items: center; box-shadow: 0 2px 0 var(--ink); border-width: 2px; font-size: 14px; }
#menu .opts button small { margin-left: auto; color: #5a4a70; font-weight: 700; }
#menu .opts .row { display: flex; gap: 5px; }
#menu .opts .mh { font-size: 12px; font-weight: 800; color: #5a4a70; margin-top: 4px; text-align: left; background: none; border: 0; box-shadow: none; padding: 0 2px; cursor: default; }
#menu .opts button.mh { cursor: pointer; text-decoration: underline dotted; }
#menu .opts button[hidden] { display: none; }
#menu .opts .row > button:first-child { flex: 1; }
#menu .opts button.plan { flex: none; width: 40px; justify-content: center; font-size: 18px; }
#menu .rel { margin: 4px 0 8px; }
#menu .status { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 10px; background: #efe4cc; font-weight: 800; font-size: 13px; }

#modal { position: fixed; inset: 0; z-index: 42; display: grid; place-items: center; background: rgba(43,29,24,.45); }
.card { position: relative; width: min(560px, 92vw); max-height: calc(90vh / var(--tz, 1)); overflow-y: auto; background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 22px 24px; box-shadow: 10px 10px 0 rgba(43,29,24,.6); }
.card .planet-head { display: flex; align-items: center; gap: 12px; }
.card .pg { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; border: 3px solid var(--ink); font-family: 'Segoe UI Symbol', serif; }
.card .choices { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.card .choices button { flex: 1; }
.card p { font-size: 17px; }
.card ul { padding-left: 18px; }
.fight-row { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 20px; margin: 10px 0; }
.fight-log { min-height: 60px; font-size: 17px; text-align: center; }

#nightui { position: fixed; inset: 0; z-index: 12; pointer-events: none; color: var(--paper); }
#nightui > * { pointer-events: auto; }
#night-top { position: absolute; top: 14px; left: 282px; right: calc(min(400px, 40vw) + 32px); text-align: center; text-shadow: 0 2px 6px #000; } /* between the two side panels */
#night-top p { margin: 4px 0; font-family: var(--serif); font-size: 20px; font-style: italic; }
#night-dust { font-weight: 800; font-size: 18px; }
#night-panel { position: absolute; right: 16px; top: 16px; bottom: 90px; width: min(400px, 40vw); overflow-y: auto; background: rgba(255,248,234,.97); color: var(--ink); border: 4px solid var(--ink); border-radius: 20px; padding: 16px; }
#night-panel:empty { display: none; }
#night-panel h3 { font-family: var(--serif); font-size: 30px; margin: 0; }
#night-panel .q { font-family: var(--serif); font-style: italic; font-size: 19px; }
#night-panel button { width: 100%; text-align: left; margin: 4px 0; font-size: 14px; }
#night-panel .sec { font-weight: 800; margin-top: 10px; border-top: 2px dashed #c9b8a0; padding-top: 6px; }
#night-panel .hit { font-size: 14px; }
#night-panel .hit.hard { color: var(--crimson); }
#night-list { position: absolute; left: 16px; top: 16px; width: 250px; background: rgba(18,14,51,.85); border: 3px solid #d9a53a; border-radius: 16px; padding: 10px 12px; font-size: 14px; max-height: calc((100vh - 120px) / var(--tz, 1)); overflow-y: auto; }
#night-list h4 { margin: 4px 0; font-family: var(--serif); font-size: 20px; }
#night-list .g { display: flex; gap: 6px; cursor: pointer; padding: 3px 4px; border-radius: 8px; }
#night-list .g:hover { background: rgba(255,255,255,.12); }
#night-list .g b { font-family: 'Segoe UI Symbol', serif; width: 20px; }
#b-wake { position: absolute; bottom: 18px; left: 16px; }
#b-journal { position: absolute; bottom: 22px; left: 196px; }
#modal.low { place-items: end center; padding-bottom: 80px; background: rgba(43,29,24,.15); }
/* A conversation: the card docks to one side and the camera frames the two of you in the rest (main.js lean). */
#modal.side { place-items: center start; padding: 0 0 0 3vw; background: none; }
#modal.side .card { width: min(430px, 40vw); }
@media (max-aspect-ratio: 1/1) { #modal.side { place-items: end center; padding: 0 0 2vh; } #modal.side .card { width: min(560px, 92vw); } }

#toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 45; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; font-weight: 700; max-width: 560px; box-shadow: 0 4px 0 rgba(43,29,24,.5); animation: tin .25s ease-out; }
.toast .i { font-size: 20px; margin-right: 6px; }
.toast.wait { display: none !important; } /* queued: shown when the ones before it have gone */
body[data-mode="night"] #toasts { top: auto; bottom: 96px; } /* at night the top belongs to the sky's headline */
@keyframes tin { from { transform: translateY(-10px); opacity: 0; } }
#download { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 46; background: var(--gold); border: 3px solid var(--ink); border-radius: 12px; padding: 10px 18px; font-weight: 800; color: var(--ink); text-decoration: none; }

/* Phones: the interface is drawn for a desktop window, so shrink it on small screens. */
@media (max-width: 700px), (max-height: 500px) {
  #hud, #nightui, #modal, #toasts, #title > :not(canvas):not(.mirror) { zoom: 0.62; }
  #creator .panel { zoom: 0.7; width: min(620px, 62vw); }
  #cr-signs button { font-size: 11px; padding: 5px 1px; }
  .card { max-height: calc(145vh / var(--tz, 1)); } /* vh shrinks with zoom, so undo it: 0.9 / 0.62 */
  #sidepanel { height: calc((161vh - 220px) / var(--tz, 1)); }
}
@media (max-width: 700px) {
  /* Portrait phones: one row. The sky strip repeats the sky card, and the tools fold behind one menu button. */
  #skystrip { display: none; }
  #tools { margin-left: auto; }
  #topbar { z-index: 6; } /* the open menu sits above the sky card and side panel */
  #transits { bottom: auto; top: 96px; }
  #sidepanel { top: 96px; left: 12px; right: 12px; width: auto; height: calc((161vh - 220px) / var(--tz, 1)); }
  #doing { left: auto; right: 10px; transform: none; }
  #me { bottom: 84px; } /* the line of what you're doing runs full width here, so the card sits above it */
  #creator .panel { width: auto; left: 12px; right: 12px; top: 62vh; bottom: 12px; } /* vh shrinks with zoom: this is about 43% */
  #night-top { top: 30%; left: 4%; right: 4%; }
  #night-list { max-height: 28%; }
  #night-panel { left: 16px; right: 16px; width: auto; top: 52%; bottom: 90px; }
}

/* Each morning opens with the storybook page turning away from the right edge. */
/* the dreamy dissolve between waking and sleep: a violet haze with a few stars, over everything */
#dreamveil { position: fixed; inset: 0; z-index: 48; pointer-events: none; opacity: 0; background: radial-gradient(1.5px 1.5px at 22% 30%, #fff8 50%, transparent), radial-gradient(1.5px 1.5px at 71% 18%, #fff8 50%, transparent), radial-gradient(2px 2px at 58% 64%, #fffa 50%, transparent), radial-gradient(1.5px 1.5px at 34% 78%, #fff6 50%, transparent), radial-gradient(ellipse at 50% 45%, rgba(150,120,230,.55), rgba(28,16,64,.92) 70%); }
/* paused: an arrow under the speed bar points at the play button */
#pausehint { position: fixed; z-index: 30; transform: translateX(-50%); padding: 6px 12px; font-size: 14px; background: var(--gold); border-radius: 12px; white-space: nowrap; animation: nudge 1.1s ease-in-out infinite; }
#pausehint::before { content: ''; position: absolute; left: 50%; top: -9px; margin-left: -9px; border: 9px solid transparent; border-top: 0; border-bottom-color: var(--gold); }
@keyframes nudge { 50% { transform: translate(-50%, 5px); } }
@media (prefers-reduced-motion: reduce) { #pausehint { animation: none; } }

/* ---------- mini-games, conversations, happenings ---------- */
.mg-score { text-align: center; font-weight: 800; font-size: 18px; min-height: 26px; margin: 8px 0; }
.card .link.mg-skip, .card #rl-leave { display: block; margin: 8px auto 0; color: var(--ink); opacity: .6; font-size: 13px; }
.rh { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; height: 280px; margin-top: 8px; }
.rh .lane { position: relative; overflow: hidden; border: 3px solid var(--ink); border-radius: 14px; background: linear-gradient(180deg, #3a2a60, #1b1530); }
.rh .hitline { position: absolute; left: 0; right: 0; top: 220px; height: 4px; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.rh .note { position: absolute; left: 50%; top: 0; margin: -18px 0 0 -18px; width: 36px; height: 36px; display: grid; place-items: center; font-size: 26px; will-change: transform; }
.rh .pad { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 40px; padding: 0; font-size: 14px; background: var(--paper2); touch-action: manipulation; }
.rh .pad.on { background: var(--gold); transform: translateY(2px); }
.tm { position: relative; height: 34px; margin: 18px 4px; border: 3px solid var(--ink); border-radius: 18px; background: #ddd0b4; overflow: hidden; }
.tm .zone { position: absolute; top: 0; bottom: 0; background: var(--gold); border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.tm .needle { position: absolute; top: -2px; bottom: -2px; width: 6px; margin-left: -3px; background: var(--crimson); border-radius: 3px; }
.mem { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.mem button { font-size: 40px; height: 76px; font-family: 'Segoe UI Symbol', serif; background: #e8dcf7; transition: background .1s, transform .1s; }
.mem button.on { background: var(--gold); transform: scale(1.06); box-shadow: 0 0 18px var(--gold); }
.wheelbox { position: relative; width: 230px; height: 230px; margin: 10px auto; }
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--ink); position: relative; }
.wheel span { position: absolute; left: 50%; top: 50%; width: 30px; margin: -12px 0 0 -15px; text-align: center; color: #fff; font-size: 20px; font-family: 'Segoe UI Symbol', serif; transform-origin: 50% 50%; }
.wheelbox .pointer { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-size: 26px; color: var(--gold); text-shadow: 0 2px 0 var(--ink); }
#rl-st button { padding: 3px 8px; font-size: 14px; }
.cauldron { text-align: center; font-size: 46px; margin: 8px 0; min-height: 60px; }
.dodge { text-align: center; font-size: 70px; margin: 8px 0; transition: transform .08s; }
.dodge.swing { transform: scale(1.5) rotate(-12deg); }
.card .choices.col { flex-direction: column; }
.card .choices.col button { text-align: left; font-weight: 700; }
.card .choices.col button small { opacity: .6; font-weight: 800; }
.card .say { font-family: var(--serif); font-size: 22px; font-style: italic; }
.card button:disabled { opacity: .45; cursor: default; }

/* ---------- one game per building (src/minigames.js) ---------- */
.mg-time { height: 6px; border-radius: 3px; background: #ddd0b4; overflow: hidden; margin: 4px 0 8px; }
.mg-time i { display: block; height: 100%; width: 100%; background: var(--crimson); }
.mg-body .big { font-size: 34px; }
.mg-body .huge { font-size: 64px; text-align: center; line-height: 1.2; }
.mg-q { text-align: center; min-height: 60px; }
.mg-q p { margin: 6px 0; }
.mg-hint, .order { text-align: center; margin: 4px 0; font-size: 14px; }
.order .big { font-size: 28px; }
.mg-opts { display: grid; gap: 8px; margin-top: 8px; }
.mg-opts button { min-height: 48px; font-size: 16px; touch-action: manipulation; }
.mg-opts button small { opacity: .45; font-size: 11px; vertical-align: top; }
.mg-opts button.right { background: var(--sage); }
.mg-opts button.wrong { background: #f2a0a0; }
.mg-opts.pairs button { font-size: 30px; height: 62px; }
.mg-stage { position: relative; overflow: hidden; border: 3px solid var(--ink); border-radius: 14px; background: linear-gradient(180deg, #fff8ea, #f3e7cc); touch-action: none; }
.mg-stage.dark { background: radial-gradient(circle at 50% 30%, #3a2a60, #1b1530); }
.mg-stage .it { position: absolute; transform: translate(-50%, -50%); cursor: pointer; white-space: nowrap; transition: opacity .15s; }
.it.pop { opacity: 0; transform: translate(-50%, -50%) scale(1.5); transition: all .15s; }
.it .word { display: inline-block; padding: 4px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #ffe0ec; font-weight: 800; }
.it .word.mean { background: #c9c3d6; }
.it .post { display: inline-block; padding: 6px 10px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); font-size: 14px; }
.it .bag { font-size: 34px; position: relative; }
.it .bag b { position: absolute; right: -6px; bottom: -4px; font-size: 18px; }
.cash { display: inline-block; margin: 0 2px; }
.cash small { font-size: 14px; font-weight: 800; }
.it.stop { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--ink); background: var(--gold); display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.it.stop.done { background: var(--sage); }
.light { position: absolute; width: 120px; height: 120px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(255,240,170,.55), rgba(255,240,170,0) 70%); pointer-events: none; }
.light.on { background: radial-gradient(circle, rgba(255,214,58,.9), rgba(255,214,58,0) 70%); }
.star { pointer-events: none; }
.lift { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 10px 0; }
.meter, .vial { position: relative; width: 46px; height: 180px; border: 3px solid var(--ink); border-radius: 12px; background: #ddd0b4; overflow: hidden; }
.vial { margin: 10px auto; border-radius: 6px 6px 22px 22px; }
.meter i, .vial .liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--crimson); }
.vial .liquid { background: #6cc28a; }
.vial .line { position: absolute; left: -2px; right: -2px; height: 3px; background: var(--ink); z-index: 1; }
.heart { transition: transform .05s; }
.it.ring { width: 54px; height: 54px; border-radius: 50%; border: 4px dashed var(--gold); }
.it.ring.on { border-style: solid; box-shadow: 0 0 16px var(--gold); }
.it.ship { font-size: 30px; pointer-events: none; }
.chart { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0; font-size: 14px; }
.chart span { padding: 3px 8px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper2); text-align: center; }
.stack { position: relative; height: 250px; border: 3px solid var(--ink); border-radius: 14px; background: linear-gradient(180deg, #3a2a60, #1b1530); overflow: hidden; }
.stack i { position: absolute; height: 24px; background: #fff2a0; border: 2px solid var(--ink); border-radius: 6px; box-sizing: border-box; }
.stack i.set { background: var(--gold); }
.it.me { font-size: 38px; pointer-events: none; transition: left .1s; }
.breath { height: 200px; display: grid; place-items: center; }
.breath i { width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, #e8dcf7, #8b7fd8); border: 3px solid var(--ink); }
.breath i.on { box-shadow: 0 0 26px var(--gold); }
.mg-opts.icons button { font-size: 30px; min-height: 60px; }
.mem button { font-family: inherit; }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; padding: 8px; background: #c9a77a; border: 2px solid var(--ink); border-radius: 10px; }
.keep { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: #fff8ea; border: 2px solid var(--ink); border-radius: 8px; padding: 6px 4px; min-height: 84px; }
.keep span { font-size: 28px; line-height: 1.1; }
.keep small { font-size: 11px; line-height: 1.2; }
.keep i { font-size: 10px; opacity: 0.6; }
.keep.empty { background: rgba(255, 248, 234, 0.35); border-style: dashed; }
.shoplist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; max-height: 46vh; overflow: auto; } .shoplist button { text-align: left; } .shoplist button small { display: block; opacity: 0.75; }
.shoplist .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: middle; border: 1px solid #0003; }
label.spot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0; } label.spot select { max-width: 55%; }
.shelf.book { grid-template-columns: repeat(4, 1fr); gap: 6px; } .shelf.book .keep { min-height: 64px; padding: 4px 2px; } .shelf.book .keep span { font-size: 22px; }
.holiday { background: #fff1c2; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; }

/* Sealing a deal at night: a ring of the twelve signs with the planet circling it. */
.seal { position: relative; width: 290px; height: 290px; margin: 6px auto; border-radius: 50%; background: radial-gradient(#3a3560, #1e1a36); border: 3px solid var(--ink); cursor: pointer; touch-action: none; }
.seal .ring span, .seal .orb { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; display: grid; place-items: center; font-size: 20px; color: #d9cfee; border-radius: 50%; }
.seal .ring span.home { background: #ffd34a; color: var(--ink); box-shadow: 0 0 14px #ffd34a; }
.seal .orb { width: 40px; height: 40px; margin: -20px 0 0 -20px; color: #fff; border: 3px solid #fff; font-size: 22px; }
.seal-out { text-align: center; min-height: 2.6em; }

/* Touch screens get a walking stick bottom-left and a jog button beside it; mice and keyboards don't need them. */
#stick, #b-jog { display: none; }
@media (pointer: coarse) {
  #stick { display: block; position: absolute; left: 22px; bottom: 250px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,247,230,.55); border: 3px solid var(--ink); touch-action: none; z-index: 4; }
  #stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
  #b-jog { display: block; position: absolute; left: 170px; bottom: 260px; width: 66px; height: 66px; border-radius: 50%; font-size: 28px; padding: 0; touch-action: none; z-index: 4; }
  #b-jog.on { background: var(--gold); }
  #menu .opts button, .choices button, #side-body .msg { min-height: 44px; } /* finger-sized */
}
/* where the stick sits beside the needs card is set by UI.placeStick */
#hud:has(#sidepanel:not(.hidden)) #stick, #hud:has(#sidepanel:not(.hidden)) #b-jog { display: none; }

#demo-banner { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 47; background: var(--gold); border: 3px solid var(--ink); border-radius: 14px; padding: 8px 18px; font-weight: 800; animation: pulse 1.6s infinite; pointer-events: none; }

/* A quick fade from dark when you step through a door. */
#fade { position: fixed; inset: 0; background: #1d1420; opacity: 0; pointer-events: none; z-index: 40; }
.info-lines { margin: 10px 0 4px; padding-left: 18px; line-height: 1.45; }
.info-lines li { margin: 4px 0; }
/* the rebuilt mini-games */
.it .word.gold { background: #ffe9a0; box-shadow: 0 0 10px var(--gold); }
.it .word.spike { background: #f2a0a0; }
.it.aura { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, #fff6d0, #c9a7ff 60%, rgba(139,127,216,0) 72%); display: grid; place-items: center; font-weight: 900; color: var(--ink); pointer-events: none; transition: filter .2s; }
.it.aura.hurt { filter: grayscale(1) brightness(.6); }
.ticker { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 4px 0; }
.ticker b { font-size: 26px; min-width: 110px; text-align: center; color: #2f8a4a; }
.ticker b.crash { color: var(--crimson); }
.bill { display: inline-block; font-size: 30px; padding: 8px 18px; border: 3px solid var(--ink); border-radius: 10px; background: #d8ecc8; }
.bill span { display: inline-block; min-width: 34px; margin-left: 10px; color: #8a5a00; }
.gossip { min-height: 40px; text-align: center; }
.gossip button { font-size: 13px; }
.belt { background: repeating-linear-gradient(90deg, #555 0 14px, #444 14px 28px); border-radius: 10px; padding: 4px 0; }
.it.moon { font-size: 40px; padding: 6px; border: 3px dashed var(--ink); border-radius: 50%; background: #efe4ff; }
.it.moon.glow { box-shadow: 0 0 20px var(--gold); background: #fff2a0; }
.it.cat { font-size: 40px; z-index: 2; transition: left .5s, top .5s; }
.meter .gold { position: absolute; left: 0; right: 0; background: rgba(255, 210, 60, .55); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); z-index: 1; }
.meter i.in { background: var(--gold); }
.lung { width: 96px; text-align: center; font-weight: 800; font-size: 13px; opacity: .6; }
.lung b { display: block; font-size: 40px; }
.lung.out { opacity: 1; color: var(--crimson); }
.it.foe { left: 50%; top: 28%; font-size: 54px; pointer-events: none; }
.it.fist { top: 50%; font-size: 40px; opacity: 0; pointer-events: none; transition: left .15s; }
.it.fist.tell { opacity: .35; }
.it.fist.flash { opacity: 1; filter: drop-shadow(0 0 10px #ff5a3a); transform: translate(-50%, -50%) scale(1.4); }
.ko { height: 12px; border: 2px solid var(--ink); border-radius: 6px; background: #ddd0b4; overflow: hidden; margin: 6px 0; }
.ko i { display: block; height: 100%; width: 0; background: var(--crimson); transition: width .2s; }
.it .bag.xray { display: inline-block; padding: 4px 8px; border-radius: 10px; background: rgba(80, 200, 255, .18); }
.it .bag.xray i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -40%); font-size: 16px; font-style: normal; filter: drop-shadow(0 0 4px #7fe0ff); }
.it.troph { font-size: 36px; pointer-events: none; }
.it.pillar { top: 88%; height: 26%; background: linear-gradient(90deg, #c9a24a, #f3d98a, #c9a24a); border: 2px solid var(--ink); border-radius: 6px 6px 0 0; pointer-events: none; }
#pd-h.on { color: var(--crimson); font-weight: 800; }
.it.tray { top: 50%; font-size: 30px; padding: 4px 10px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper2); pointer-events: none; }
.it.mote { font-size: 28px; pointer-events: none; filter: drop-shadow(0 0 8px #fff2a0); }
.it.quartz { font-size: 30px; pointer-events: none; opacity: .75; }
.it.quartz.on { opacity: 1; filter: drop-shadow(0 0 14px #b8f0ff); transform: translate(-50%, -50%) scale(1.3); }
.cauldron.chime { filter: drop-shadow(0 0 12px var(--gold)); transform: scale(1.1); }
/* the polished mini-games */
.mg-body .big.rotten { filter: hue-rotate(250deg) saturate(.6) brightness(.8); position: relative; }
.mg-body .big.rotten i { position: absolute; right: -10px; top: -8px; font-size: 18px; font-style: normal; }
.it.stop.blocked { background: var(--crimson); color: #fff; animation: blink .25s infinite alternate; }
@keyframes blink { to { opacity: .45; } }
.it.vip { font-size: 26px; padding: 2px 6px; border: 2px solid var(--ink); border-radius: 12px; background: #fff2a0; box-shadow: 0 0 12px var(--gold); }
.mg-opts.pairs button.gold { background: #fff2a0; box-shadow: 0 0 14px var(--gold); }
.light.flick { opacity: .15; }
#hb-d.on { font-weight: 800; color: var(--crimson); }
.it .post.troll { background: #e6d0ff; border-color: #7a3fc0; box-shadow: 0 0 10px #a46cff; }
.it.lantern .big { filter: hue-rotate(190deg) drop-shadow(0 0 10px #7fd0ff); }
.rh.fever .lane { background: linear-gradient(180deg, #a0285a, #3a1030); box-shadow: inset 0 0 24px #ff9a3a; }
.mem button.lie { background: #8a4fd8; color: #fff; transform: scale(1.06); box-shadow: 0 0 18px #a46cff; }

/* The HUD's own toggles (Settings) and the sky card that folds to a tab. */
#transits h4 { cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none; }
#transits h4 .n { font-family: var(--sans, inherit); font-size: 12px; background: var(--sage); color: #fff; border-radius: 9px; padding: 0 7px; }
#transits h4 .n.hard { background: var(--crimson); }
#transits h4 .fold { margin-left: auto; font-size: 14px; }
#transits h4 .fold::after { content: '▾'; }
#hud.sky-folded #transits { width: auto; padding: 4px 12px; }
#hud.sky-folded #transits h4 { margin: 0; font-size: 17px; }
#hud.sky-folded #transits h4 .fold::after { content: '▸'; }
#hud.sky-folded #transits > :not(h4) { display: none; }
#hud.no-sky #transits, #hud.no-strip #skystrip, #hud.no-skills #skills, #hud.early #skystrip, #hud.early #skills { display: none; }
#hud.no-strip #wallet, #hud.early #wallet { margin-left: auto; }
#skystrip { gap: 4px; }
#skystrip .pchip { padding: 1px 5px; font-size: 12px; }
#skystrip .pchip b { font-size: 15px; }
#skystrip { overflow-x: auto; scrollbar-width: none; }
#skystrip::-webkit-scrollbar { display: none; }
/* Mid-size windows: the needs card slims down so the line of what you're doing never sits on it. */
@media (min-width: 701px) and (max-width: 1100px) {
  #me { width: 200px; padding: 8px 10px; }
  #me .head small { font-size: 11px; }
  #doing { left: 222px; right: 200px; transform: none; justify-content: space-between; }
}

/* The hero's entrance after creating a Sim: letterbox bars, the name blazing up, then the ruling planet's first words. */
#intro { position: fixed; inset: 0; z-index: 45; cursor: pointer; color: var(--paper); transition: opacity .6s; }
#intro.out { opacity: 0; }
#intro .lb { position: absolute; left: 0; right: 0; height: 11vh; background: #0a0714; animation: barIn 1s ease-out both; }
#intro .lb.top { top: 0; } #intro .lb.bot { bottom: 0; }
@keyframes barIn { from { height: 0; } }
#intro .reveal { position: absolute; left: 0; right: 0; top: 12.5vh; text-align: center; opacity: 0; }
#intro.named .reveal { animation: blaze 1.4s ease-out both; }
@keyframes blaze { 0% { opacity: 0; transform: scale(1.35); filter: blur(12px) brightness(3); } 60% { opacity: 1; filter: blur(0) brightness(1.6); } 100% { opacity: 1; transform: none; filter: none; } }
#intro .name { font-family: var(--serif); font-weight: 700; font-size: clamp(40px, min(10vw, 13vh), 104px); line-height: 1; background: linear-gradient(180deg, #fff6cf, #ffd060 45%, #c98a1e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 24px rgba(255,190,80,.7)); }
#intro .sign { font-family: var(--serif); font-size: clamp(18px, 3.2vh, 28px); font-style: italic; margin-top: 8px; text-shadow: 0 2px 8px #000; }
#intro .speech { position: absolute; left: 50%; bottom: calc(11vh + 18px); transform: translate(-50%, 20px); width: min(640px, 88vw); background: rgba(20,14,40,.82); border: 2px solid rgba(255,214,140,.5); border-radius: 16px; padding: 12px 18px; opacity: 0; transition: opacity .7s, transform .7s; }
#intro.spoken .speech { opacity: 1; transform: translate(-50%, 0); }
#intro .who { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 8px; opacity: .85; }
#intro .who i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #1a1030; font-size: 15px; }
#intro .line { font-family: var(--serif); font-size: clamp(18px, 2.8vh, 24px); font-style: italic; margin-top: 4px; }
#intro .skip { position: absolute; right: 18px; bottom: calc(11vh - 40px); z-index: 1; }
body.cine #hud { opacity: 0; pointer-events: none; }/* The ruling planet's one-time whispers: a little wider and longer-lived than a toast. */
.toast.tip { display: flex; gap: 10px; align-items: center; text-align: left; font-weight: 600; max-width: 480px; background: #1c1438; color: var(--paper); border-color: #d9a53a; }
.toast.tip button { pointer-events: auto; display: block; margin-top: 6px; font: inherit; font-size: 13px; padding: 3px 12px; border-radius: 10px; border: 2px solid #d9a53a; background: transparent; color: var(--paper); cursor: pointer; } /* "Skip the guide", "Take me there" */
.toast.tip .i { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #1a1030; margin: 0; font-size: 18px; }
.toast.tip b { display: block; font-family: var(--serif); font-size: 16px; color: #ffd98a; }
small.term { font-size: 0.78em; opacity: 0.7; font-style: italic; } /* the astrology word, quietly after the plain one */
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; } /* calm motion */
.toggle.slider input { width: 100%; }

/* Accessibility: colour-blind friendly good/bad (Okabe-Ito blue and orange), text size, visible keyboard focus. */
body.cb { --crimson: #d55e00; --sage: #0072b2; }
body.cb .pchip.hard { background: #fde3cf; } body.cb .pchip.soft { background: #d6e8f5; }
body[data-text="l"] { --tz: 1.15; } body[data-text="xl"] { --tz: 1.3; }
:is(#hud > *, #menu > *, #modal .card, #toasts > *, #nightui > *, #creator .panel > *) { zoom: var(--tz, 1); } /* one level in, so it multiplies with the phone shrink */
:is(button, select, input, [tabindex]):focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }
@media (max-width: 700px) { #hud > #topbar { zoom: 1; } } /* a narrow screen has no room for a bigger top bar: it would push the phone button off the edge */

/* ---------- mini-games, livelier: a face that reacts, streaks, sparks, a Ready-Go curtain, confetti ---------- */
.mg-body { position: relative; }
.mg-top { display: flex; align-items: center; gap: 8px; }
.mg-top .mg-time { flex: 1; height: 10px; border-radius: 5px; margin: 4px 0; border: 2px solid var(--ink); }
.mg-time i { background: linear-gradient(90deg, var(--crimson), var(--gold)); transition: width .1s linear; }
.mg-time i.low { animation: mgLow .4s ease-in-out infinite; }
.mg-face { font-size: 26px; line-height: 1; display: inline-block; }
.mg-face.hop, .mg-combo.hop, .mg-score.hop { animation: mgHop .3s ease-out; }
.mg-face.wince { animation: mgWince .35s; }
.mg-combo { min-width: 34px; font-weight: 900; font-size: 18px; color: var(--crimson); text-align: right; }
.mg-combo.hot { font-size: 22px; text-shadow: 0 0 10px var(--gold); }
.mg-body.shake { animation: mgShake .3s; }
.mg-spark { position: absolute; z-index: 5; pointer-events: none; font-style: normal; font-size: 18px; animation: mgSpark .6s ease-out forwards; }
.mg-ready { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; border-radius: 14px; background: rgba(243,231,204,.82); font-family: var(--serif); font-weight: 700; font-size: 44px; color: var(--ink); animation: mgHop .35s ease-out; }
.mg-ready.go { color: var(--crimson); font-size: 64px; }
.mg-conf { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 7; }
.mg-conf i { position: absolute; top: -24px; font-style: normal; font-size: 22px; animation: mgFall 1.6s cubic-bezier(.3,.5,.7,1) forwards; }
.mg-opts button { animation: mgIn .22s ease-out backwards; transition: scale .08s; }
.mg-opts button:nth-child(2) { animation-delay: .04s; } .mg-opts button:nth-child(3) { animation-delay: .08s; } .mg-opts button:nth-child(4) { animation-delay: .12s; } .mg-opts button:nth-child(n+5) { animation-delay: .16s; }
.mg-opts button:active, .mg-stage .it:active { scale: .92; }
.mg-opts button.right { animation: mgYes .4s ease-out; }
.mg-opts button.wrong { animation: mgShake .3s; }
.mg-stage .it { animation: mgIn .2s ease-out backwards; }
.mg-q .huge { animation: mgHop .35s ease-out; }
@keyframes mgHop { 0% { scale: .6; } 60% { scale: 1.25; } 100% { scale: 1; } }
@keyframes mgIn { from { scale: 0; opacity: 0; } }
@keyframes mgYes { 40% { scale: 1.12; } }
@keyframes mgWince { 25% { rotate: -18deg; } 75% { rotate: 18deg; } }
@keyframes mgShake { 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 4px 0; } }
@keyframes mgSpark { to { translate: var(--dx) var(--dy); opacity: 0; scale: .4; } }
@keyframes mgLow { 50% { opacity: .45; } }
@keyframes mgFall { to { translate: 0 520px; rotate: var(--r); opacity: .2; } }

.card:has(.mg-body) { position: relative; }

/* ---------- hero intros: each ruling planet colours your name and brings it in its own way ---------- */
#intro .name { background: linear-gradient(180deg, #fffdf2, color-mix(in srgb, var(--pc, #ffd060) 65%, #fff) 45%, color-mix(in srgb, var(--pc, #ffd060) 80%, #000)); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 0 24px color-mix(in srgb, var(--pc, #ffbe50) 70%, transparent)); }
#intro .lb.top { border-bottom: 3px solid var(--pc, #d9a53a); } #intro .lb.bot { border-top: 3px solid var(--pc, #d9a53a); }
#intro .sign small { font-size: .8em; color: #fff7e6; letter-spacing: .04em; }
#intro[data-style="slam"].named .reveal { animation: introSlam .9s cubic-bezier(.2,1.4,.4,1) both; }
#intro[data-style="zip"].named .reveal { animation: introZip .7s cubic-bezier(.2,1.2,.3,1) both; }
#intro[data-style="drift"].named .reveal { animation: introDrift 2.6s ease-out both; }
#intro[data-style="bloom"].named .reveal { animation: introBloom 1.5s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes introSlam { 0% { opacity: 0; transform: translateY(-60vh) scale(1.7); } 55% { opacity: 1; transform: translateY(0) scale(1); } 70% { transform: translateY(-12px) rotate(-1deg); } 85% { transform: translateY(4px) rotate(.6deg); } 100% { opacity: 1; transform: none; } }
@keyframes introZip { 0% { opacity: 0; transform: translateX(-110vw) skewX(-28deg); filter: blur(6px); } 60% { opacity: 1; transform: translateX(3vw) skewX(8deg); filter: none; } 80% { transform: translateX(-1vw) skewX(-3deg); } 100% { opacity: 1; transform: none; } }
@keyframes introDrift { 0% { opacity: 0; transform: translateY(40px) scale(1.08); filter: blur(14px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes introBloom { 0% { opacity: 0; transform: scale(.2) rotate(-8deg); filter: brightness(3.5) blur(6px); } 60% { opacity: 1; transform: scale(1.12) rotate(1deg); filter: brightness(1.5); } 100% { opacity: 1; transform: none; filter: none; } }

/* mini-games, second pass: round pips, a floating +1, and things on the board that bob while they wait to be tapped */
.mg-pips { display: flex; justify-content: center; gap: 6px; margin: 2px 0 6px; }
.mg-pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: #fff7e6; transition: background .2s, scale .2s; }
.mg-pips i.now { scale: 1.3; background: var(--gold); }
.mg-pips i.yes { background: var(--sage); scale: 1; } .mg-pips i.meh { background: #f0d48a; scale: 1; } .mg-pips i.no { background: #f2a0a0; scale: 1; }
.mg-plus { position: absolute; z-index: 5; pointer-events: none; font-style: normal; font-weight: 900; font-size: 20px; color: var(--crimson); text-shadow: 0 1px 0 #fff; animation: mgPlus .75s ease-out forwards; }
@keyframes mgPlus { from { translate: -50% 0; opacity: 1; } to { translate: -50% -46px; opacity: 0; } }
.mg-stage .it { animation: mgIn .2s ease-out backwards, mgBob 1.4s ease-in-out infinite; }
@keyframes mgBob { 50% { rotate: 5deg; } }

/* the clinic ward: three beds, a patience bar under each patient, and a tray of remedies */
.mg-stage.ward { display: flex; gap: 8px; padding: 8px; align-items: stretch; }
.ward .bed { position: relative; flex: 1; border: 3px solid var(--ink); border-radius: 12px; background: #fff; display: grid; place-items: center; cursor: pointer; opacity: .45; transition: opacity .2s, scale .1s; }
.ward .bed.on { opacity: 1; } .ward .bed:active { scale: .96; }
.ward .bed small { position: absolute; left: 6px; top: 4px; font-weight: 800; opacity: .5; }
.ward .bed .who { font-size: 46px; line-height: 1; } .ward .bed.on .who { animation: mgHop .3s ease-out; }
.ward .bed.leaving .who { animation: wardOut .5s ease-in forwards; }
.ward .bed.shake { animation: mgShake .3s; }
.ward .bed .wait { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 6px; border-radius: 3px; background: var(--sage); width: 0; }
@keyframes wardOut { to { translate: 0 -40px; opacity: 0; } }
.tray { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tray button { font-size: 26px; padding: 4px 2px; min-height: 60px; line-height: 1.1; touch-action: manipulation; } .tray button span { font-size: 11px; font-weight: 700; } .tray button small { font-size: 10px; opacity: .45; vertical-align: top; }
.tray button.sel { background: var(--gold); scale: 1.08; }
.chart.gone { visibility: hidden; }

.mg-stage .book { display: inline-block; text-align: center; font-size: 30px; line-height: 1; } .mg-stage .book b { font-size: 12px; background: #fff7e6; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 4px; }

/* 2.4: the family album */
#side-body .album { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#side-body .album figure { margin: 0; background: #fff7e6; border: 2px solid var(--ink); border-radius: 10px; padding: 4px; }
#side-body .album img { width: 100%; border-radius: 6px; display: block; }
#side-body .album figcaption { font-size: 12px; line-height: 1.2; margin-top: 3px; }
