@font-face { font-family: 'Pixelify'; src: url('fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; }
@font-face { font-family: 'Pixelify'; src: url('fonts/pixelify-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; }

/* Kairosoft-style pixel UI: every panel is a 9-slice pixel frame scaled by --px */
:root {
  --px: 2px;
  --txt: #f4f6ff; --txt2: #c8d6ff; --ink: #141c3a; --gold: #ffe066; --pink: #ff8aa0; --green: #9df07f;
  --sh: 2px 2px 0 #141c3a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6fa55a; font-family: 'Pixelify', ui-monospace, monospace; color: var(--txt); -webkit-font-smoothing: none; -moz-osx-font-smoothing: unset; user-select: none; }
canvas#game { position: fixed; inset: 0; image-rendering: pixelated; image-rendering: crisp-edges; cursor: pointer; touch-action: none; }
img.px { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; background: none; padding: 0; }

.fr, .chip, .win, .card, .btn, .tab, .dock-btn, .hud-r button, .toast, .slot, .ing, .fcard, .goal, .b-sub, #drawer, #lvup, #discover, .labres, .chart, .ii, .portrait, .city, .win-x, .seg .segb {
  border-style: solid; border-color: transparent; border-width: calc(6 * var(--px));
  border-image-slice: 6 fill; border-image-width: calc(6 * var(--px)); border-image-repeat: stretch;
  image-rendering: pixelated; background: none;
}
.chip, .win, .goal, .toast, .b-sub, #drawer, #lvup, .city { border-image-source: var(--f-win); }
.card, .tab, .slot, .ing, .fcard, .labres, .chart { border-image-source: var(--f-card); }
.ii, .portrait { border-image-source: var(--f-paper); }
.btn, .tab.on, .fcard.on, .ing.on, .slot.full, .seg .segb.on { border-image-source: var(--f-btn); color: #3b2418; text-shadow: none; }
.btn.dis, .card.locked, .fcard.locked, .ing.locked { border-image-source: var(--f-off); }
.btn.danger, .tab.tool.on { border-image-source: var(--f-red); color: #fff; text-shadow: var(--sh); }
.tab.done { border-image-source: var(--f-green); color: #fff; text-shadow: var(--sh); }

body { text-shadow: var(--sh); }

/* ---------- HUD: one Kairosoft-style top bar ---------- */
#hud { position: fixed; top: 4px; left: 6px; right: 6px; display: none; flex-direction: column; gap: 4px; pointer-events: none; z-index: 10; }
body.playing #hud { display: flex; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: auto; padding: 0 2px;
  border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-win) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(20,28,58,.5)); }
.tb-l, .tb-r { display: flex; align-items: center; min-width: 0; }
.tb-l { flex: 1; }
.tb-i { padding: 0 12px; font-size: 18px; font-weight: 700; line-height: 1.1; border-right: 2px solid #5a7cd8; box-shadow: 2px 0 0 #141c3a; white-space: nowrap; }
.tb-i:last-child { border-right: none; box-shadow: none; }
.tb-i:first-child { padding-left: 4px; }
.wk { height: 6px; background: #141c3a; margin-top: 2px; overflow: hidden; }
.wk i { display: block; height: 100%; background: var(--green); }
.tb-i.date { min-width: 214px; }
.sun { display: inline-block; width: 18px; text-align: center; }
.sun.day { color: #ffd040; } .sun.night { color: #bfd0ff; }
.clock { color: var(--gold); font-size: 15px; display: inline-block; min-width: 92px; }
.tb-i.money { color: var(--gold); min-width: 116px; font-size: 20px; }
.tb-i.money.neg { color: var(--pink); }
.tb-i.money.bump { animation: bump .25s; }
@keyframes bump { 40% { transform: translateY(-3px) scale(1.06); } }
.tb-i.rp .lbl { color: #8fe0ff; }
.tb-i.fans .heart { color: var(--pink); }
.tb-i.rank { min-width: 170px; }
.tb-i.rank .wk i { background: var(--gold); }
.tb-r { gap: 3px; flex: none; }
.tb-r button { height: 34px; min-width: 36px; font-size: 13px; font-weight: 700; padding: 0 2px; text-shadow: var(--sh);
  border-style: solid; border-color: transparent; border-width: calc(5 * var(--px)); border-image: var(--f-card) 6 fill / calc(5 * var(--px)) stretch; image-rendering: pixelated; }
.tb-r button.on { border-image-source: var(--f-btn); color: #3b2418; text-shadow: none; }
.tb-r button.off { opacity: .5; text-decoration: line-through; }
.tb-r button:active, .dock-btn:active, .btn:active, .tab:active { transform: translateY(2px); }
.tb-sep { width: 2px; height: 26px; background: #5a7cd8; box-shadow: 2px 0 0 #141c3a; margin: 0 4px; }
.hud-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; }
.chip { padding: 0 6px; font-size: 15px; font-weight: 700; line-height: 1.15; pointer-events: auto; }
.chip.ev { color: #ffd0a0; }
.goal { width: 290px; padding: 0 4px; font-size: 14px; line-height: 1.2; pointer-events: auto; }
.goal-t { color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: 1px; }
.goal-x { font-weight: 700; font-size: 16px; }
.goal-r { color: var(--txt2); font-size: 12px; margin-top: 1px; }
.goal .wk i { background: var(--gold); }

/* ---------- dock: one tray ---------- */
#dock { position: fixed; bottom: 4px; left: 50%; transform: translateX(-50%); display: none; gap: 2px; z-index: 12; padding: 0 2px;
  border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-win) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(20,28,58,.5)); }
body.playing #dock { display: flex; }
.dock-btn { width: 84px; height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font-size: 14px; font-weight: 700; padding: 0; border-image-source: var(--f-card) !important; }
.dock-btn.on { border-image-source: var(--f-btn) !important; color: #3b2418; text-shadow: none; transform: translateY(-3px); }
.dock-btn .di { flex: 1; display: flex; align-items: center; justify-content: center; filter: drop-shadow(1px 1px 0 #141c3a); }

/* ---------- windows ---------- */
.win { display: flex; flex-direction: column; overflow: hidden; filter: drop-shadow(0 4px 0 rgba(20,28,58,.55)); }
.win-title { border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-rib) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated;
  color: #fff; font-size: 22px; font-weight: 700; padding: 0 6px; position: relative; margin: -4px -4px 4px; text-shadow: 2px 2px 0 #3b1418; letter-spacing: 1px; }
.win-x { position: absolute; right: -4px; top: -6px; width: 40px; height: 36px; font-size: 16px; font-weight: 700; border-image-source: var(--f-win); }
.win-body { padding: 2px 4px; overflow-y: auto; }
.win-body::-webkit-scrollbar { width: 10px; } .win-body::-webkit-scrollbar-thumb { background: #8fb0f0; border: 2px solid #141c3a; } .win-body::-webkit-scrollbar-track { background: #1f3c88; }
#panel { position: fixed; right: 8px; top: 68px; bottom: 96px; width: min(540px, calc(100vw - 16px)); display: none; z-index: 15; }
#panel.show { display: flex; animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
#panel .win { width: 100%; }

.tabs { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.tab { padding: 0 6px; font-size: 15px; font-weight: 700; min-height: 34px; text-shadow: var(--sh); }

.card { padding: 2px 4px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.card.locked { opacity: .75; }
.card.sel { border-image-source: var(--f-gold); color: #3b2418; text-shadow: none; }
.card.sel .sub { color: #5a4030; }
.card .info { flex: 1; min-width: 0; }
.card .name { font-size: 18px; font-weight: 700; }
.card .sub { font-size: 14px; color: var(--txt2); margin-top: 1px; }
.card .notes { font-style: italic; }
.card .lv { background: #ff8a3a; color: #fff; font-size: 13px; padding: 0 4px; vertical-align: 2px; }
.card .ctl { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.card.staff { align-items: flex-start; flex-wrap: wrap; }
.card.staff .ctl { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
.card.staff .train { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: 1; }
.seg { display: flex; flex-direction: column; gap: 2px; }
.seg .segb { border-image-source: var(--f-card); font-size: 13px; font-weight: 700; padding: 0 4px; text-shadow: var(--sh); }
.portrait { padding: 0; }
.exp { height: 8px; background: #141c3a; overflow: hidden; margin: 4px 0; }
.exp i { display: block; height: 100%; background: var(--gold); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.stat { display: grid; grid-template-columns: 62px 1fr 30px; align-items: center; gap: 5px; font-size: 13px; }
.stat .bar { height: 8px; background: #141c3a; overflow: hidden; box-shadow: 0 0 0 2px #0c1230; }
.stat .bar i { display: block; height: 100%; }
.stat b { text-align: right; }
.kv { display: flex; justify-content: space-between; font-size: 15px; padding: 2px 0; border-bottom: 2px dotted #3a5cb8; }
.stars { color: var(--gold); letter-spacing: 1px; }
.stars i { color: #4a5c98; font-style: normal; }
.tag { font-size: 12px; background: #4a5c98; padding: 0 4px; vertical-align: 3px; }
.tag.on { background: #4f9a3c; }
.warn { color: var(--pink); }
.hint { font-size: 14px; color: var(--txt2); line-height: 1.35; margin: 4px 2px; }
.hint b { color: var(--gold); }

.btn { padding: 0 8px; font-size: 16px; font-weight: 700; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; min-height: 38px; }
.btn small { font-size: 12px; font-weight: 400; margin-top: 1px; }
.btn.sm { padding: 0 4px; font-size: 14px; min-height: 30px; }
.btn.big { padding: 2px 16px; font-size: 20px; width: 100%; margin: 4px 0; min-height: 52px; }
.btn.dis { color: #2a2a3a; }
.btnrow { display: flex; gap: 6px; justify-content: center; padding: 6px; flex-wrap: wrap; }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.menu-grid .card { margin: 0; gap: 6px; }
.menu-grid .name { font-size: 15px; }
.menu-grid .sub { font-size: 12px; }
.ii { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; flex: none; padding: 0; }
.ii.q, .ft.q, .ing .q { font-size: 22px; font-weight: 700; color: #8a7a60; text-shadow: none; }

.lab { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.slots { display: flex; gap: 6px; justify-content: center; }
.slot { width: 104px; height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.slot .plus { font-size: 28px; color: #5a7cd8; }
.labres { min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 6px; text-align: center; font-size: 15px; }
.labres.win { border-image-source: var(--f-green); }
.labres.near { border-image-source: var(--f-gold); color: #3b2418; text-shadow: none; }
.labres p { margin: 0; }
.brew-anim { display: flex; gap: 4px; }
.brew-anim span { width: 10px; height: 10px; background: var(--gold); animation: bob .6s infinite alternate; }
.brew-anim span:nth-child(2) { animation-delay: .2s; } .brew-anim span:nth-child(3) { animation-delay: .4s; }
@keyframes bob { to { transform: translateY(-8px); } }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; margin-top: 6px; }
.ing { display: flex; flex-direction: column; align-items: center; padding: 0; font-size: 12px; font-weight: 700; min-height: 72px; justify-content: center; text-shadow: var(--sh); }
.ing.on { transform: translateY(-2px); }
.ing.locked { opacity: .6; }

.chart { display: flex; gap: 4px; align-items: flex-end; height: 150px; padding: 0 4px; margin-bottom: 6px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart .bars { flex: 1; width: 100%; display: flex; gap: 2px; align-items: flex-end; }
.chart .bars i { flex: 1; display: block; min-height: 2px; }
.chart span { font-size: 11px; }
i.rev, .lg.rev { background: var(--gold); } i.prof, .lg.prof { background: #7fc85a; } i.loss, .lg.loss { background: #e06a5a; }
.lg { display: inline-block; width: 10px; height: 10px; vertical-align: 0; margin-left: 6px; }

/* ---------- build drawer ---------- */
#drawer { position: fixed; left: 50%; transform: translateX(-50%); bottom: 94px; width: min(1000px, calc(100vw - 12px)); display: none; z-index: 14; padding: 0 2px; }
#drawer.show { display: block; animation: rise .18s ease-out; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
.drawer-top { display: flex; gap: 4px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.drawer-top .grow { flex: 1; }
.drawer-row { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.fcard { flex: none; width: 98px; padding: 0; display: flex; flex-direction: column; align-items: center; font-size: 12px; text-shadow: var(--sh); }
.fcard .ft { height: 52px; display: flex; align-items: center; justify-content: center; filter: drop-shadow(1px 1px 0 #141c3a); }
.fcard .fn { font-weight: 700; text-align: center; line-height: 1.05; min-height: 26px; display: flex; align-items: center; }
.fcard .fp { color: var(--gold); font-weight: 700; }
.fcard.on .fp { color: #3b2418; }
.fcard .fa { color: var(--pink); font-size: 11px; }
.fcard.on { transform: translateY(-3px); }
.fcard.poor .fp { color: var(--pink); }
.fcard.locked { opacity: .6; }
.drawer-info { font-size: 14px; color: var(--txt2); min-height: 18px; margin-top: 2px; }

/* ---------- toasts, banner, level-up ---------- */
#toasts { position: fixed; left: 8px; bottom: 98px; display: flex; flex-direction: column; gap: 2px; z-index: 13; pointer-events: none; max-width: min(440px, 60vw); }
.toast { padding: 0 4px; font-size: 15px; animation: tin .25s ease-out; transition: opacity .5s, transform .5s; }
.toast.good { color: var(--green); } .toast.warn { color: var(--pink); } .toast.event { color: var(--gold); }
.toast.out { opacity: 0; transform: translateX(-20px); }
@keyframes tin { from { transform: translateX(-30px); opacity: 0; } }
#banner { position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.6); z-index: 30; pointer-events: none; opacity: 0; text-align: center; }
#banner.show { animation: ban 2.8s ease-out forwards; }
.b-title { font-size: 60px; font-weight: 700; color: var(--gold); -webkit-text-stroke: 3px #141c3a; text-shadow: 0 6px 0 #141c3a, 4px 6px 0 #141c3a; white-space: nowrap; letter-spacing: 2px; }
.b-sub { display: inline-block; margin-top: 6px; padding: 0 8px; font-size: 18px; font-weight: 700; max-width: 80vw; }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-4deg); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); } 20% { transform: translate(-50%, -50%) scale(1) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%) scale(1); } }
#lvup { position: fixed; left: 50%; bottom: 98px; transform: translateX(-50%); z-index: 28; display: none; align-items: center; gap: 8px; padding: 0 6px; pointer-events: none; min-width: 360px; }
#lvup.show { display: flex; animation: lvin 2.6s ease-out forwards; }
@keyframes lvin { 0% { transform: translate(-50%, 60px); opacity: 0; } 10% { transform: translate(-50%, -6px); opacity: 1; } 16% { transform: translate(-50%, 0); } 88% { opacity: 1; } 100% { opacity: 0; } }
.lv-por { border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-paper) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated; }
.lv-t { color: #8fe0ff; font-size: 28px; font-weight: 700; letter-spacing: 2px; }
.lv-n { font-size: 20px; font-weight: 700; } .lv-n span { color: var(--gold); }
.lv-g { display: flex; gap: 10px; font-size: 14px; } .lv-g b { color: var(--green); }
.lv-s { margin-top: 3px; color: var(--gold); font-size: 14px; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 40; background: rgba(20,28,58,.4); }
#modal.show { display: flex; }
#modal.show .win { animation: popin .22s ease-out; }
@keyframes popin { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.04); } }
.modalwin { width: min(500px, calc(100vw - 24px)); max-height: 88vh; }
.modal-text { font-size: 17px; line-height: 1.4; margin: 2px 2px 6px; }
.modal-text.big { font-size: 22px; font-weight: 700; text-align: center; color: var(--gold); }
.tips { font-size: 15px; line-height: 1.4; padding-left: 20px; margin: 4px 0; }
.tips li { margin-bottom: 3px; } .tips b { color: var(--gold); }
table.report { width: 100%; border-collapse: collapse; font-size: 17px; }
table.report td { padding: 3px 6px; border-bottom: 2px dotted #3a5cb8; }
table.report td:last-child { text-align: right; font-weight: 700; }
table.report .neg { color: var(--pink); } table.report .pos { color: var(--green); }
table.report tr.total td { border-top: 3px solid #f4f6ff; border-bottom: none; font-size: 19px; }
table.report tr.me td { color: var(--gold); }
.report-stats { display: flex; justify-content: space-around; margin-top: 6px; font-size: 15px; }
.report-stats b { color: var(--gold); }
.city { margin-top: 6px; padding: 0 4px; border-image-source: var(--f-card); }
.city-h { font-weight: 700; color: var(--gold); font-size: 16px; margin-bottom: 2px; }
.city-r { display: grid; grid-template-columns: 24px 1fr 50px; font-size: 14px; padding: 1px 0; }
.city-r.me { color: var(--gold); font-weight: 700; }
.city-r i { font-style: normal; text-align: right; color: var(--txt2); }
.up { color: var(--green); } .down { color: var(--pink); } .same { color: var(--txt2); }

/* ---------- title ---------- */
#title { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; background: linear-gradient(rgba(20,28,58,.1), rgba(20,28,58,.5)); }
#title.show { display: flex; }
.title-card { text-align: center; display: flex; flex-direction: column; align-items: center; max-width: 92vw; }
.title-card .logo { max-width: 90vw; height: auto; filter: drop-shadow(0 8px 0 rgba(20,28,58,.6)); animation: float 2.4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.subtitle { font-size: 42px; font-weight: 700; color: #fff6e3; -webkit-text-stroke: 2px #141c3a; text-shadow: 0 5px 0 #141c3a; margin: 4px 0 18px; letter-spacing: 2px; }
.title-btns { display: flex; flex-direction: column; gap: 4px; width: 280px; }
.credit { color: #fff6e3; font-size: 16px; max-width: 440px; }

@media (max-width: 1100px) {
  .tb-i { padding: 0 6px; font-size: 15px; } .tb-i.date { min-width: 0; } .tb-i.rank { min-width: 0; } .tb-i.money { min-width: 0; font-size: 16px; }
  .clock { min-width: 0; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .tb-l { flex-wrap: wrap; }
  .dock-btn { width: 56px; height: 58px; font-size: 11px; }
  #panel { top: auto; bottom: 76px; height: 62vh; }
  .b-title { font-size: 34px; }
  #drawer { bottom: 74px; }
  .hud-l { max-width: none; }
}

/* ---------- news ticker ---------- */
#ticker { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); width: min(460px, 40vw); height: 40px; overflow: hidden; z-index: 11; pointer-events: none; display: none; align-items: center; gap: 6px; padding: 0 2px;
  border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-card) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated; }
body.playing #ticker { display: flex; }
#ticker:not(.live) { display: none !important; }
.tk-l { flex: none; background: #c2453f; color: #fff; font-size: 12px; font-weight: 700; padding: 0 4px; letter-spacing: 1px; }
.tk-m { white-space: nowrap; font-size: 15px; animation: tick 4.2s linear forwards; }
@keyframes tick { 0% { transform: translateX(110%); } 18% { transform: translateX(0); } 82% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(0); opacity: 0; } }

/* ---------- advisor ---------- */
#advisor { position: fixed; left: 50%; bottom: 98px; transform: translateX(-50%); width: min(640px, calc(100vw - 16px)); z-index: 35; display: none; align-items: flex-start; gap: 6px; cursor: pointer; padding: 0 4px;
  border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-win) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(20,28,58,.55)); }
#advisor.show { display: flex; animation: rise2 .2s ease-out; }
@keyframes rise2 { from { transform: translate(-50%, 16px); opacity: 0; } }
.adv-por { flex: none; border-style: solid; border-color: transparent; border-width: calc(6 * var(--px)); border-image: var(--f-paper) 6 fill / calc(6 * var(--px)) stretch; image-rendering: pixelated; }
.adv-body { flex: 1; position: relative; min-height: 80px; }
.adv-name { display: inline-block; background: #c2453f; color: #fff; font-weight: 700; font-size: 14px; padding: 0 6px; margin-bottom: 3px; letter-spacing: 1px; }
.adv-text { font-size: 18px; line-height: 1.35; }
.adv-more { position: absolute; right: 2px; bottom: 0; color: var(--gold); animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* HD sprites: keep thumbnails inside their boxes */
.dock-btn .di img { max-height: 44px; width: auto; }
.fcard { width: 104px; }
.fcard .ft { height: 66px; }
.fcard .ft img { max-height: 62px; max-width: 92px; width: auto; height: auto; }

/* NEW badge on freshly unlocked menus */
.dock-btn { position: relative; }
.badge { position: absolute; top: -10px; right: -6px; background: #e0435a; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 4px; box-shadow: 0 0 0 2px #141c3a; animation: bump 0.9s infinite; text-shadow: none; }
/* quest pointer: a pulsing gold ring and a bouncing arrow */
.focus { position: relative; z-index: 5; animation: focusPulse 1s infinite; }
.focus::after { content: '▼'; position: absolute; left: 50%; top: -26px; transform: translateX(-50%); color: #ffe066; font-size: 20px; text-shadow: 0 2px 0 #141c3a, 2px 0 0 #141c3a, -2px 0 0 #141c3a; animation: arrowBob .6s infinite alternate; pointer-events: none; }
@keyframes focusPulse { 0%, 100% { filter: drop-shadow(0 0 0 #ffe066) brightness(1); } 50% { filter: drop-shadow(0 0 6px #ffe066) brightness(1.25); } }
@keyframes arrowBob { to { transform: translate(-50%, -6px); } }
.tab.focus::after, #btn-expand.focus::after { top: -24px; }
.stam { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 5px; font-size: 13px; margin: 2px 0 4px; }
.stam .bar { height: 8px; background: #141c3a; overflow: hidden; box-shadow: 0 0 0 2px #0c1230; }
.stam .bar i { display: block; height: 100%; }

body.building #advisor { bottom: auto; top: 112px; }

/* job titles & promotions */
.card .title { font-size: 13px; padding: 0 5px; vertical-align: 2px; background: #3d6e8a; color: #fff; }
.card .title.t1 { background: #2f8a5a; }
.card .title.t2 { background: #c8902a; color: #fff6d0; }
.card .sub.skill { color: var(--gold); }
.btn.promote { width: 100%; order: -1; margin-bottom: 2px; }
.btn.promote.ready { border-image-source: var(--f-green); color: #10301a; animation: promo 0.9s ease-in-out infinite; }
@keyframes promo { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }

/* DISCOVERED! window */
#discover { position: fixed; left: 50%; top: 20%; transform: translateX(-50%) scale(0.6); opacity: 0; pointer-events: none; z-index: 60; min-width: 340px; max-width: 92vw; text-align: center; padding: 6px 18px 10px; border-image-source: var(--f-gold); color: #3b2418; text-shadow: none; transition: transform 0.18s cubic-bezier(.3,1.6,.5,1), opacity 0.15s; }
#discover.show { transform: translateX(-50%) scale(1); opacity: 1; }
#discover .d-k { font-size: 13px; letter-spacing: 2px; color: #a8452f; font-weight: 700; }
#discover .d-t { font-size: 30px; font-weight: 700; color: #c2553f; text-shadow: 2px 2px 0 #ffe7a6; margin: 2px 0; }
#discover .d-n { font-size: 20px; font-weight: 700; }
#discover .d-i { margin: 6px auto; image-rendering: pixelated; }
#discover .d-d { font-size: 14px; color: #5a4030; }
#discover .rays { position: absolute; inset: -70px; z-index: -1; opacity: 0.8; pointer-events: none; background: repeating-conic-gradient(rgba(255,230,120,0.35) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#discover .d-i img { display: block; margin: 0 auto; }
.decade { text-align: center; margin: 6px 0 8px; }
.decade .grade { font-size: 64px; font-weight: 700; color: var(--gold); text-shadow: 3px 3px 0 #a8452f; line-height: 1; }
.decade .gname { font-size: 20px; font-weight: 700; }
.decade .gscore { font-size: 14px; color: var(--txt2); }
.report.cats td:last-child { font-size: 13px; }
.trophies { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.trophies .tr { display: inline-flex; flex-direction: column; align-items: center; font-size: 22px; line-height: 1; }
.trophies .tr small { font-size: 11px; color: var(--txt2); }
.bgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 4px; }
.bgrid .fcard { width: auto; }
.bgrid .fcard .ft { height: 58px; display: flex; align-items: center; justify-content: center; }
select.mgr { font-family: inherit; font-size: 14px; background: #141c3a; color: var(--txt); border: 2px solid #3d5aa8; padding: 1px 4px; }
.land-lines { font-size: 13px; color: var(--green); margin: 4px 0; }
body.town #goal-card, body.town .hud-row .goal { opacity: 0.85; }

/* ---------- guest requests ---------- */
.rq-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 4px; }
.rq-face { flex: none; background: #1f3c88; padding: 4px; box-shadow: 0 0 0 2px #141c3a; }
.rq-head b { color: var(--gold); font-size: 17px; }
.rq-head p { margin: 2px 0 4px; font-size: 16px; line-height: 1.3; }
.rq-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tg { font-style: normal; font-size: 12px; padding: 1px 6px; background: var(--c, #888); color: #141c3a; font-weight: 700; box-shadow: 0 0 0 2px #141c3a; text-shadow: none; }
.tg.off { background: #6d7390; color: #e8ecff; }
.rq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 42vh; overflow-y: auto; padding: 4px; }
.rq-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 3px; background: #1f3c88; box-shadow: 0 0 0 2px #141c3a; cursor: pointer; text-align: center; font-size: 12px; line-height: 1.1; }
.rq-item:hover { background: #2c4fa8; }
.rq-item.on { background: #e8b84a; color: #3b2418; text-shadow: none; box-shadow: 0 0 0 2px #3b2418, 0 0 0 4px #fff3b0; }
.rq-item small { display: flex; gap: 2px; align-items: center; color: var(--gold); font-size: 10px; }
.rq-item.on small { color: #7a4a22; }
.rq-item small i { width: 8px; height: 8px; display: inline-block; box-shadow: 0 0 0 1px #141c3a; }
.rq-res { display: flex; flex-direction: column; gap: 5px; }
.rq-row { display: flex; gap: 8px; align-items: center; padding: 4px 6px; background: #1f3c88; box-shadow: 0 0 0 2px #141c3a; animation: popin .3s ease-out both; }
.rq-row:nth-child(2) { animation-delay: .25s; } .rq-row:nth-child(3) { animation-delay: .5s; }
.rq-row > div { flex: 1; } .rq-row small { display: block; font-size: 13px; color: var(--txt2); }
.rq-row em { font-style: normal; font-size: 22px; color: var(--gold); min-width: 34px; text-align: right; }
.rq-row.h2 { background: #2f6a3a; } .rq-row.h0 { background: #4a3a5a; }
.rq-score { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-top: 4px; }
.rq-score .bar { flex: 1; height: 12px; background: #141c3a; position: relative; box-shadow: 0 0 0 2px #0c1230; }
.rq-score .bar i { display: block; height: 100%; background: linear-gradient(90deg, #e06a5a, #e8b84a, #7fc85a); animation: grow 1s .7s ease-out both; transform-origin: left; }
.rq-score .bar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; }
.rq-score span { color: var(--gold); font-weight: 700; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.guide-stars { text-align: center; font-size: 40px; color: #ff5a4a; letter-spacing: 8px; text-shadow: 0 0 10px #ffb0a0, 2px 2px 0 #3b1418; margin: 6px 0; }
.guide-stars span { display: inline-block; animation: popin .4s ease-out both; }
.guide-stars span:nth-child(2) { animation-delay: .3s; } .guide-stars span:nth-child(3) { animation-delay: .6s; }
.guide-stars i { font-size: 18px; color: var(--txt2); letter-spacing: 0; font-style: normal; }
.card.ana .stat { grid-template-columns: 128px 1fr 40px; }
.card.ana .stat span, .card.ana .stat span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card.trainall { flex-wrap: wrap; }
.card.trainall .train { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- collectible cards ---------- */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 4px; }
.tcg { --rc: #a8aec4; width: 96px; height: 134px; perspective: 600px; position: relative; justify-self: center; }
.tcg.rU { --rc: #7fc85a; } .tcg.rR { --rc: #5aa8ff; } .tcg.rE { --rc: #c07aff; } .tcg.rL { --rc: #ffc040; }
.tcg-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3,1.4,.5,1); }
.tcg.back .tcg-in { transform: rotateY(180deg); }
.tcg-face, .tcg-back { position: absolute; inset: 0; backface-visibility: hidden; box-shadow: 0 0 0 2px #141c3a, inset 0 0 0 3px var(--rc); background: #f4ecd8; color: #3b2418; text-shadow: none; display: flex; flex-direction: column; align-items: center; padding: 6px 5px; box-sizing: border-box; overflow: hidden; }
.tcg-back { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #2c4fa8 0 6px, #1f3c88 6px 12px); cursor: pointer; justify-content: center; }
.tcg-back span { font-size: 40px; color: var(--gold); text-shadow: 3px 3px 0 #141c3a; font-weight: 700; }
.tcg.back:hover .tcg-in { transform: rotateY(180deg) translateY(-4px); }
.tcg-art { width: 100%; height: 70px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #fff6e3, #e8d8b0); box-shadow: inset 0 0 0 2px #c8b890; font-size: 30px; color: #a8987a; }
.tcg-art.s-beans { background: radial-gradient(circle, #e8c890, #a8703c); } .tcg-art.s-guests { background: radial-gradient(circle, #ffe8f0, #c8a0d8); }
.tcg-name { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.1; margin-top: 5px; flex: 1; display: flex; align-items: center; }
.tcg-rar { font-size: 10px; padding: 1px 5px; background: var(--rc); color: #141c3a; box-shadow: 0 0 0 1px #141c3a; }
.tcg.rE .tcg-face::after, .tcg.rL .tcg-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 45%, rgba(255,240,200,.2) 52%, transparent 65%); background-size: 250% 100%; animation: foil 2.6s linear infinite; pointer-events: none; }
@keyframes foil { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.tcg.none .tcg-face { background: #3a4470; color: #a8aec4; box-shadow: 0 0 0 2px #141c3a, inset 0 0 0 3px #59608a; }
.tcg.none .tcg-art { background: #2a3258; box-shadow: none; color: #59608a; }
.tcg.new::before { content: 'NEW!'; position: absolute; top: -9px; right: -8px; z-index: 3; background: #e0435a; color: #fff; font-size: 11px; padding: 1px 4px; box-shadow: 0 0 0 2px #141c3a; animation: popin .3s ease-out; }
.pack-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 220px; justify-content: center; }
.pack { width: 120px; height: 170px; cursor: pointer; animation: wob 1.6s ease-in-out infinite; }
.pack-foil { width: 100%; height: 100%; background: linear-gradient(135deg, #e0435a, #e8b84a 50%, #c07aff); box-shadow: 0 0 0 3px #141c3a, inset 0 0 0 4px #fff3b0, 0 0 18px #ffe066; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; text-shadow: 2px 2px 0 #141c3a; }
.pack-foil b { font-size: 22px; letter-spacing: 2px; } .pack-foil small { font-size: 11px; margin-top: 18px; animation: blink 1s steps(2) infinite; }
@keyframes wob { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-4px); } }
@keyframes blink { 50% { opacity: .2; } }
.pack-cards { display: none; gap: 10px; }
.pack-note { display: none; }
.pack-stage.torn .pack { display: none; }
.pack-stage.torn .pack-cards { display: flex; animation: popin .35s ease-out; }
.pack-stage.torn .pack-note { display: block; }
.mini-card { display: inline-block; width: 16px; height: 22px; background: linear-gradient(135deg, #e0435a, #e8b84a 55%, #c07aff); box-shadow: 0 0 0 2px #141c3a, inset 0 0 0 2px #fff3b0; transform: rotate(-8deg); margin: 2px 4px; vertical-align: bottom; }
.dock-btn .di .pk { position: absolute; margin: -18px 0 0 26px; background: #e0435a; color: #fff; font-size: 11px; padding: 0 4px; box-shadow: 0 0 0 2px #141c3a; }
/* ---------- pricing, mini-games, regulars ---------- */
.ctlcol { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.pricer { display: flex; align-items: center; justify-content: space-between; gap: 2px; font-size: 12px; background: #141c3a; box-shadow: 0 0 0 2px #0c1230; }
.pricer .pm { cursor: pointer; padding: 0 6px; color: var(--gold); font-size: 16px; }
.pricer .pm:hover { background: #2c4fa8; }
.pricer b.up { color: var(--green); } .pricer b.down { color: var(--pink); }
.seg.costume { flex-wrap: wrap; }
.seg.costume .segb { font-size: 11px; }
.hearts { color: #ff6f8a; font-size: 13px; letter-spacing: 1px; } .hearts i { color: #3a4470; font-style: normal; }
.big-heart { font-size: 34px; color: #ff6f8a; animation: wob 1s ease-in-out infinite; align-self: center; }
.mg { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mg canvas { width: 240px; height: 168px; image-rendering: pixelated; background: #2a3258; box-shadow: 0 0 0 3px #141c3a, inset 0 0 0 2px #3a5cb8; }
.mg-bar { position: relative; width: 260px; height: 16px; background: #141c3a; box-shadow: 0 0 0 2px #0c1230; }
.mg-bar i { position: absolute; top: 0; bottom: 0; background: #e8b84a; box-shadow: inset 0 0 0 2px #fff3b0; }
.mg-bar b, .roast-bar b { position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 0 2px #141c3a; }
.mg-btn { cursor: pointer; padding: 8px 28px; font-size: 22px; font-weight: 700; color: #3b2418; text-shadow: none; background: #e8b84a; box-shadow: 0 0 0 3px #3b2418, inset 0 -4px 0 #c89a30, inset 0 0 0 2px #fff3b0; user-select: none; }
.mg-btn:active { transform: translateY(2px); box-shadow: 0 0 0 3px #3b2418, inset 0 0 0 2px #fff3b0; }
.mg-btn small { font-size: 12px; } .mg-btn.done { background: #7fc85a; cursor: default; }
.roast-bar { position: relative; display: flex; width: 300px; height: 22px; box-shadow: 0 0 0 2px #141c3a; }
.roast-bar span { flex: 1; font-size: 9px; color: #fff; display: flex; align-items: center; justify-content: center; text-shadow: 1px 1px 0 #000; }
.roast-bar span.tg { box-shadow: inset 0 0 0 2px #ffe066, 0 0 8px #ffe066; z-index: 1; font-weight: 700; }
/* ---------- exterior design ---------- */
.drawer-row .extgrp { display: flex; flex-direction: column; gap: 3px; min-width: 132px; }
.extlbl { font-size: 12px; color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
.extopt { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; padding: 3px 6px; background: #1f3c88; box-shadow: 0 0 0 2px #141c3a; font-size: 12px; line-height: 1.1; }
.extopt:hover { background: #2c4fa8; }
.extopt .sw { grid-row: span 2; width: 20px; height: 20px; box-shadow: 0 0 0 2px #141c3a; display: flex; align-items: center; justify-content: center; font-style: normal; }
.extopt .sw.none { background: #3a4470; color: #a8aec4; }
.extopt small { font-size: 10px; color: var(--txt2); }
.extopt.on { background: #e8b84a; color: #3b2418; text-shadow: none; } .extopt.on small { color: #7a4a22; }
.extopt.locked { opacity: .55; }
#h-ext.on { background: #e8b84a; color: #3b2418; }
.goal-h { font-size: 11px; color: var(--txt2); margin-top: 3px; line-height: 1.2; max-width: 260px; }

/* ---------- Save & Cloud (src/cloud.ts) ---------- */
#cloud, #cloudask { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 60; background: rgba(20,28,58,.45); }
#cloudask { z-index: 61; }
#cloud.show, #cloudask.show { display: flex; }
#cloud.show .win, #cloudask.show .win { animation: popin .22s ease-out; }
.cl-win { width: min(560px, calc(100vw - 16px)); max-height: 92vh; }
.cl-win .win-title { position: relative; }
.cl-h { color: var(--gold); font-weight: 700; font-size: 16px; margin: 8px 2px 2px; }
.cl-slot .name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cl-tag { margin-left: auto; }
.cl-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.cl-ask { margin-top: 4px; }
.cl-form { display: grid; gap: 4px; margin-top: 2px; }
.cl-form label { font-size: 13px; color: var(--txt2); display: grid; gap: 2px; }
.cl-in { font: inherit; font-size: 16px; padding: 4px 6px; background: #f4f6ff; color: #141c3a; border: 2px solid #141c3a; text-shadow: none; user-select: text; -webkit-user-select: text; width: 100%; box-sizing: border-box; min-width: 0; }
.cl-in:focus { outline: 2px solid var(--gold); }
.cl-link { border: 0; background: none; font-size: 13px; color: var(--txt2); text-decoration: underline dotted; padding: 4px; }
.cl-link:hover { color: var(--gold); }
.cl-note { font-size: 14px; font-weight: 700; padding: 3px 6px; margin: 4px 0; line-height: 1.3; }
.cl-note.good { background: rgba(79,154,60,.35); }
.cl-note.bad { background: rgba(194,85,63,.45); }
.cl-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.cl-sides .card { align-items: flex-start; }
.cl-sides .kv { font-size: 14px; gap: 6px; }
.cl-sides .kv b { text-align: right; }
.cl-recover { padding: 4px; margin-bottom: 4px; background: rgba(255,224,102,.15); }
.btn[disabled] { opacity: .55; cursor: default; }
.tb-r .cl-chip { padding: 0 6px; white-space: nowrap; font-size: 13px; }
.tb-r .cl-chip.warn { color: var(--pink); }
@media (max-width: 760px) { .cl-sides { grid-template-columns: 1fr; } .tb-r .cl-chip { max-width: 92px; overflow: hidden; text-overflow: ellipsis; } }
