/* AVANTIS Moto Tycoon — HUD in the brand palette: blue, navy/graphite, white, orange for actions */
:root {
  --blue: #1a63d8;
  --blue-d: #0f4aa8;
  --blue-l: #5b9bff;
  --navy: #0f1b33;
  --navy-2: #17284a;
  --navy-3: #203660;
  --graphite: #2a2f3a;
  --white: #f5f7fb;
  --light: #d9dee7;
  --muted: #8e9ab3;
  --orange: #ff7a1a;
  --orange-d: #c4520a;
  --gold: #ffd23f;
  --green: #7dffa0;
  --red: #ff5a5a;
  --ink: #0a1020;
  --font: 'Press Start 2P', ui-monospace, monospace;
  --top: calc(env(safe-area-inset-top) + 64px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #4f9140; color: var(--white); font-family: var(--font); }
body { user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; touch-action: none; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; color: inherit; }
img.px { image-rendering: pixelated; }

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: stretch; gap: 6px;
  padding: calc(env(safe-area-inset-top) + 6px) 8px 6px;
  background: linear-gradient(var(--navy), var(--navy-2));
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--blue);
}
.logo {
  display: flex; flex-direction: column; justify-content: center; padding: 6px 10px;
  background: var(--blue); border: 3px solid var(--ink); box-shadow: inset 0 -3px 0 var(--blue-d);
}
.logo b { font-size: 13px; letter-spacing: 1px; font-weight: normal; }
.logo small { font-size: 6px; color: #cfe0ff; margin-top: 4px; letter-spacing: 1px; }
.stat {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px;
  background: var(--navy); border: 3px solid var(--ink); box-shadow: inset 0 0 0 1px var(--navy-3);
  min-width: 0;
}
.stat b { font-weight: normal; display: block; font-size: 13px; white-space: nowrap; }
.stat small { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.bar { height: 6px; background: var(--ink); width: 100%; }
.bar i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .3s; }
.money .coin {
  width: 24px; height: 24px; display: grid; place-items: center; flex: none;
  background: var(--gold); color: #7a5200; border: 3px solid var(--ink); font: 900 12px system-ui, sans-serif;
}
.money small { color: var(--green); }
.rep { flex-direction: column; align-items: stretch; justify-content: center; gap: 4px; width: 116px; }
.rep .stars { font-size: 11px; color: var(--gold); letter-spacing: 1px; font-family: system-ui, sans-serif; line-height: 1; }
.rep .bar i { background: var(--gold); }
.rep small { margin: 0; }
.level { flex: 1; max-width: 280px; }
.lvl-badge {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; font-size: 12px;
  background: var(--orange); color: var(--ink); border: 3px solid var(--ink);
}
.lvl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.lvl-info small { margin: 0; overflow: hidden; text-overflow: ellipsis; color: var(--white); }
.lvl-info .bar i { background: var(--blue-l); }
.clock span { font-size: 16px; font-family: system-ui, sans-serif; }
.buttons { display: flex; gap: 4px; margin-left: auto; align-items: center; }
button.icon {
  width: 38px; height: 38px; font-size: 15px; line-height: 1; color: #fff; font-family: system-ui, sans-serif;
  background: var(--navy-3); border: 3px solid var(--ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,.35);
  display: grid; place-items: center; padding: 0;
}
button.icon:hover { background: var(--blue); }
button.icon:active { transform: translateY(2px); }
button.icon.on { background: var(--orange); }
button.icon.tiny { width: 26px; height: 26px; font-size: 12px; }

/* ---------- side panels ---------- */
.panel {
  background: rgba(15,27,51,.94); border: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(0,0,0,.35), inset 0 0 0 1px var(--navy-3);
}
.side { position: fixed; top: calc(var(--top) + 10px); z-index: 4; display: flex; flex-direction: column; max-height: calc(100vh - var(--top) - 90px); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 6px 6px 10px; background: var(--blue); border-bottom: 3px solid var(--ink); font-size: 10px;
}
.panel-body { overflow: auto; padding: 8px; scrollbar-width: thin; scrollbar-color: var(--blue) var(--navy); }
.side.collapsed .panel-body, .side.collapsed .tabs { display: none; }

#quests { left: 10px; width: 300px; }
.quest-level { font-size: 9px; color: var(--blue-l); line-height: 1.6; margin-bottom: 8px; }
.quest-level b { color: var(--white); font-weight: normal; display: block; font-size: 10px; margin-top: 4px; }
#questList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#questList li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; padding: 7px; background: var(--navy-2); border: 2px solid var(--ink); }
#questList li.done { opacity: .55; }
#questList li.fresh { animation: flash 1s ease 2; }
@keyframes flash { 50% { background: var(--orange-d); } }
.check { width: 16px; height: 16px; border: 3px solid var(--ink); background: var(--navy); box-shadow: inset 0 0 0 1px var(--navy-3); position: relative; }
li.done .check { background: var(--green); }
li.done .check::after { content: ''; position: absolute; left: 3px; top: 0; width: 3px; height: 6px; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.q-text { font-size: 9px; line-height: 1.6; }
.q-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 5px; }
.q-meta .bar { height: 4px; flex: 1; }
.q-meta .bar i { background: var(--green); }
.reward { font-size: 8px; color: var(--gold); white-space: nowrap; }
.quest-next { font-size: 8px; color: var(--muted); margin-top: 8px; line-height: 1.7; }

#biz { right: 10px; width: 420px; }
#biz.collapsed { width: auto; }
#biz.collapsed .panel-head span::after { content: ' ▸'; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 3px solid var(--ink); }
.tabs button { padding: 9px 1px; font-size: 7px; overflow: hidden; white-space: nowrap; background: var(--navy-2); border: 0; border-right: 2px solid var(--ink); color: var(--muted); }
.tabs button:last-child { border-right: 0; }
.tabs button.active { background: var(--navy); color: var(--white); box-shadow: inset 0 -3px 0 var(--orange); }
.sec { font-size: 8px; color: var(--blue-l); margin: 10px 2px 6px; letter-spacing: 1px; }
.sec:first-child { margin-top: 2px; }
.card {
  display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center;
  padding: 7px; margin-bottom: 6px; background: var(--navy-2); border: 2px solid var(--ink);
}
.card.locked { opacity: .5; }
.card.done { box-shadow: inset 3px 0 0 var(--green); }
.card .ico { width: 42px; height: 42px; display: grid; place-items: center; background: var(--navy); border: 2px solid var(--ink); }
.card .ico img { width: 34px; height: 34px; object-fit: contain; image-rendering: pixelated; }
.card .ico img.small { width: 28px; height: 28px; }
.card .info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card .info b { font-size: 9px; font-weight: normal; line-height: 1.4; }
.card .info span { font-size: 8px; color: var(--muted); line-height: 1.6; }
.card .lvl { font-size: 8px; color: var(--gold); }
.pips { display: flex; gap: 2px; }
.pips i { width: 8px; height: 5px; background: var(--ink); }
.pips i.on { background: var(--orange); }
.lockmsg { font-size: 9px; line-height: 1.8; color: var(--muted); padding: 10px; text-align: center; }

.btn {
  display: block; width: 100%; margin-top: 10px; padding: 12px; font-size: 10px; color: var(--ink);
  background: var(--orange); border: 3px solid var(--ink); box-shadow: inset 0 -4px 0 var(--orange-d);
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--orange-d); }
.btn:disabled { background: #4a5162; box-shadow: inset 0 -4px 0 #383e4c; color: #9aa3b5; cursor: default; }
.btn.small { width: auto; min-width: 92px; margin: 0; padding: 9px 6px; font-size: 8px; }
.btn.blue { background: var(--blue); color: var(--white); box-shadow: inset 0 -4px 0 var(--blue-d); }
.btn.ghost { background: var(--navy-3); color: var(--white); box-shadow: inset 0 -4px 0 var(--navy); }
.btn.danger { background: #3a2a2e; color: #ff8080; box-shadow: inset 0 -4px 0 #24181b; }
.tag { font-size: 8px; padding: 6px; border: 2px solid var(--ink); background: var(--navy); color: var(--green); text-align: center; min-width: 84px; }
.tag.cd { color: var(--muted); }
.tag.lock { color: var(--muted); }

/* ---------- bottom ---------- */
#controls {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 8px); transform: translateX(-50%); z-index: 3;
  display: flex; gap: 14px; padding: 7px 12px; font-size: 8px; color: var(--light);
  background: rgba(15,27,51,.85); border: 2px solid var(--ink); white-space: nowrap; pointer-events: none;
}
kbd { font-family: var(--font); font-size: 8px; padding: 2px 4px; background: var(--white); color: var(--navy); border-bottom: 2px solid var(--muted); margin-right: 3px; }
.hint {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 44px); transform: translateX(-50%); z-index: 3;
  max-width: min(560px, calc(100vw - 32px)); padding: 9px 14px; text-align: center;
  font-size: 9px; line-height: 1.6; background: rgba(15,27,51,.92); border: 3px solid var(--orange);
  pointer-events: none;
}
#feed { position: fixed; left: 10px; bottom: calc(env(safe-area-inset-bottom) + 44px); z-index: 3; display: flex; flex-direction: column-reverse; gap: 4px; pointer-events: none; max-width: 330px; }
.feed-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px; font-size: 8px; line-height: 1.5;
  background: rgba(15,27,51,.9); border: 2px solid var(--ink); box-shadow: inset 3px 0 0 var(--blue);
  animation: feedIn .25s ease, feedOut .5s ease 5.5s forwards;
}
.feed-item img { width: 18px; image-rendering: pixelated; flex: none; }
.feed-item.k-sale { box-shadow: inset 3px 0 0 var(--green); }
.feed-item.k-quest, .feed-item.k-level, .feed-item.k-star { box-shadow: inset 3px 0 0 var(--gold); }
.feed-item.k-angry, .feed-item.k-lock { box-shadow: inset 3px 0 0 var(--red); }
@keyframes feedIn { from { opacity: 0; transform: translateX(-20px); } }
@keyframes feedOut { to { opacity: 0; transform: translateX(-20px); } }

.event-badge {
  position: fixed; left: 50%; top: calc(var(--top) + 12px); transform: translateX(-50%); z-index: 4;
  padding: 7px 12px; font-size: 8px; background: var(--orange); color: var(--ink); border: 3px solid var(--ink);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse { 50% { filter: brightness(1.15); } }

.banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 8;
  padding: 18px 26px; text-align: center; background: var(--navy); border: 4px solid var(--ink);
  box-shadow: 0 6px 0 rgba(0,0,0,.4), inset 0 0 0 3px var(--blue);
  font-size: 18px; color: var(--white); animation: pop 3.2s ease forwards; pointer-events: none;
  max-width: calc(100vw - 32px); line-height: 1.5;
}
.banner small { display: block; font-size: 9px; color: var(--orange); margin-bottom: 10px; }
.banner em { display: block; font-style: normal; font-size: 8px; color: var(--blue-l); margin-top: 10px; }
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  12% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
  20%, 85% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1); opacity: 0; }
}

.pause { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(10,16,32,.55); font-size: 22px; pointer-events: none; }
.pause small { display: block; font-size: 8px; color: var(--light); margin-top: 12px; text-align: center; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(10,16,32,.65); padding: 16px; }
.modal-body {
  width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px;
  background: var(--navy); border: 4px solid var(--ink); box-shadow: 0 6px 0 rgba(0,0,0,.45), inset 0 0 0 3px var(--blue);
}
.modal-body.wide { width: min(860px, 100%); }
.modal-body h2 { margin: 0 0 14px; font-size: 14px; color: var(--white); font-weight: normal; line-height: 1.5; }
.modal-body h2 .brand { background: var(--blue); padding: 2px 6px; margin-right: 6px; }
.modal-body p { font-size: 9px; line-height: 1.8; margin: 0 0 10px; }
.modal-body p.big { font-size: 18px; color: var(--green); text-align: center; margin: 16px 0; }
.modal-body p.muted { color: var(--muted); font-size: 8px; }
.stats { display: grid; gap: 6px; margin-bottom: 12px; }
.stats div { display: flex; justify-content: space-between; gap: 10px; font-size: 8px; padding: 7px 8px; background: var(--navy-2); }
.stats span { color: var(--muted); }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-btns .btn { margin-top: 0; }
.daily { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0; }
.daily div { padding: 8px 2px; text-align: center; font-size: 8px; line-height: 1.8; background: var(--navy-2); border: 2px solid var(--ink); color: var(--muted); }
.daily div.past { background: var(--blue-d); color: var(--white); }
.daily div.today { background: var(--orange); color: var(--ink); animation: pulse 1s ease infinite; }
.toggle { display: flex; justify-content: space-between; align-items: center; font-size: 8px; padding: 8px; background: var(--navy-2); margin-bottom: 6px; }
.map-wrap canvas { width: 100%; display: block; image-rendering: pixelated; border: 3px solid var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 8px; margin-top: 10px; color: var(--light); }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border: 1px solid var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .clock small, .logo small { display: none; }
  .level { max-width: 200px; }
  #biz { width: 340px; }
}
@media (max-width: 820px) {
  :root { --top: calc(env(safe-area-inset-top) + 104px); }
  #topbar { flex-wrap: wrap; gap: 4px; padding: calc(env(safe-area-inset-top) + 4px) 4px 4px; }
  .logo { padding: 4px 6px; } .logo b { font-size: 9px; }
  .stat { padding: 3px 6px; }
  .stat b { font-size: 10px; }
  .rep { width: 84px; }
  .rep small { display: none; }
  .level { order: 6; flex-basis: 100%; max-width: none; }
  .clock { display: none; }
  .buttons { margin-left: auto; }
  button.icon { width: 32px; height: 32px; font-size: 13px; }
  #controls { display: none; }
  .hint { bottom: calc(env(safe-area-inset-bottom) + 8px); font-size: 8px; }
  #feed { bottom: calc(env(safe-area-inset-bottom) + 56px); max-width: 70vw; }
  #quests { width: min(260px, calc(100vw - 20px)); }
  #biz:not(.collapsed) { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 62vh; }
  #biz.collapsed { display: none; }
}
@media (max-width: 480px) {
  :root { --top: calc(env(safe-area-inset-top) + 92px); }
  .logo { display: none; }
  .money small { font-size: 7px; }
  button.icon { width: 30px; height: 30px; }
}
@media (pointer: coarse) { #controls { display: none; } }

/* ---------- v3: upgrade cards, badges, location chip ---------- */
.badge {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; margin-left: 5px;
  font: normal 7px var(--font); font-style: normal; color: var(--ink); background: var(--orange); border: 2px solid var(--ink);
  vertical-align: middle;
}
button.icon { position: relative; }
button.icon .badge { position: absolute; top: -8px; right: -8px; margin: 0; }
.tabs button .badge { margin-left: 4px; }
.card.can { box-shadow: inset 3px 0 0 var(--orange); border-color: #4a2a10; }
.card.can .ico { border-color: var(--orange-d); }
.card .info .chip { font-style: normal; font-size: 7px; color: var(--gold); margin-left: 4px; display: inline-flex; vertical-align: middle; }
.card .info .chip .pips { display: inline-flex; }
.card .info .fx { color: var(--light); }
.card .info .fx i { font-style: normal; color: var(--orange); }
.card .info .fx b { color: var(--green); font-weight: normal; }
.card .info .short { color: var(--red); }
.btn.small.can { animation: canBuy 1.6s ease infinite; }
@keyframes canBuy { 50% { filter: brightness(1.18); } }

.location {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 86px); transform: translateX(-50%); z-index: 3;
  padding: 7px 12px; font: 9px var(--font); color: var(--white); background: var(--navy-2); border: 3px solid var(--ink); cursor: pointer;
}
.location.action { background: var(--orange); color: var(--ink); animation: pulse 1s ease infinite; }
.event-badge.alarm { background: var(--red); color: var(--white); animation: pulse .4s ease infinite; }

/* elevator */
.floors { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.floor-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px; text-align: left;
  background: var(--navy-2); border: 3px solid var(--ink); color: var(--white);
}
.floor-btn b { width: 30px; height: 30px; display: grid; place-items: center; background: var(--blue); border: 2px solid var(--ink); font-weight: normal; font-size: 11px; }
.floor-btn span { font-size: 9px; line-height: 1.6; }
.floor-btn small { display: block; font-size: 7px; color: var(--muted); }
.floor-btn.current { box-shadow: inset 0 0 0 2px var(--gold); }
.floor-btn.current b { background: var(--gold); color: var(--ink); }
.floor-btn:hover { background: var(--navy-3); }

/* ---------- AVANTIS OS (boss computer) ---------- */
.modal-body.wide:has(.pc) { padding: 0; width: min(980px, 100%); background: var(--ink); }
.pc { display: flex; flex-direction: column; min-height: min(620px, calc(100vh - 40px)); }
.pc-top { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--blue); border-bottom: 3px solid var(--ink); }
.pc-brand { font-size: 11px; background: var(--white); color: var(--blue); padding: 4px 8px; }
.pc-clock { flex: 1; font-size: 8px; color: #dbe8ff; }
.pc-main { display: grid; grid-template-columns: 150px 1fr; flex: 1; min-height: 0; }
.pc-apps { display: flex; flex-direction: column; gap: 4px; padding: 8px; background: var(--navy); border-right: 3px solid var(--ink); }
.pc-apps button { display: flex; align-items: center; gap: 8px; padding: 8px 6px; font-size: 8px; text-align: left; background: transparent; border: 2px solid transparent; color: var(--light); }
.pc-apps button img { width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.pc-apps button.active { background: var(--navy-3); border-color: var(--ink); color: var(--white); box-shadow: inset 3px 0 0 var(--orange); }
.pc-view { padding: 14px; overflow: auto; max-height: calc(100vh - 110px); background: linear-gradient(var(--navy-2), var(--navy)); }
.pc-view h3 { font-size: 11px; font-weight: normal; margin: 0 0 12px; color: var(--white); }
.pc-view h4 { font-size: 8px; font-weight: normal; margin: 0 0 6px; color: var(--blue-l); }
.pc-view p { font-size: 8px; line-height: 1.8; }
.muted { color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.kpi { padding: 8px; background: var(--navy); border: 2px solid var(--ink); }
.kpi span { display: block; font-size: 6px; color: var(--muted); margin-bottom: 6px; }
.kpi b { font-weight: normal; font-size: 10px; }
.kpi.good b { color: var(--green); } .kpi.bad b { color: var(--red); }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.charts canvas { width: 100%; height: auto; border: 2px solid var(--ink); image-rendering: pixelated; }
.pc-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 7px; margin-bottom: 5px; background: var(--navy); border: 2px solid var(--ink); }
.pc-row img { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.pc-row b { display: block; font-size: 8px; font-weight: normal; margin-bottom: 4px; }
.pc-row span { font-size: 7px; color: var(--muted); line-height: 1.6; }
.mail-item { display: grid; grid-template-columns: 10px 1fr; gap: 8px; align-items: center; padding: 9px; margin-bottom: 5px; background: var(--navy); border: 2px solid var(--ink); cursor: pointer; }
.mail-item i { width: 8px; height: 8px; background: transparent; }
.mail-item.unread i { background: var(--orange); }
.mail-item.unread b { color: var(--white); }
.mail-item b { display: block; font-size: 8px; font-weight: normal; color: var(--light); margin-bottom: 4px; }
.mail-item span { font-size: 7px; color: var(--muted); }
.mail-item:hover { background: var(--navy-3); }
.mail-full { margin-top: 10px; padding: 12px; background: var(--white); color: var(--ink); border: 3px solid var(--ink); }
.mail-full h3 { color: var(--ink) !important; }
.mail-full p { color: var(--ink); }
.mail-full .muted { color: #5a6478; }
@media (max-width: 820px) {
  .pc-main { grid-template-columns: 1fr; }
  .pc-apps { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 3px solid var(--ink); }
  .pc-apps button span { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .location { bottom: calc(env(safe-area-inset-bottom) + 50px); }
}

/* ---------- AVANTIS OS v2: desktop + browser + website look ---------- */
.modal-body.wide:has(.pc) { padding: 0; width: min(1040px, 100%); background: #0b1428; box-shadow: 0 8px 0 rgba(0,0,0,.45), inset 0 0 0 3px var(--blue); }
.pc { display: flex; flex-direction: column; height: min(680px, calc(100vh - 40px)); min-height: 0; }
.os-bar { display: flex; align-items: center; gap: 10px; padding: 5px 8px; background: #0b1428; border-bottom: 2px solid var(--ink); }
.os-logo { font-size: 9px; padding: 4px 7px; background: var(--blue); color: #fff; }
.os-dock { display: flex; gap: 4px; flex: 1; }
.os-dock button { width: 28px; height: 26px; display: grid; place-items: center; background: var(--navy-2); border: 2px solid var(--ink); padding: 0; }
.os-dock button:hover { background: var(--navy-3); }
.os-dock img { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.os-clock { font-size: 8px; color: #c9d6ee; white-space: nowrap; }
.os-close { width: 26px; height: 24px; background: #e04040; color: #fff; border: 2px solid var(--ink); font: 12px system-ui, sans-serif; padding: 0; }
.browser { flex: 1; display: flex; flex-direction: column; min-height: 0; margin: 6px; border: 3px solid var(--ink); background: #dfe3ea; }
.b-tabs { display: flex; gap: 2px; padding: 5px 6px 0; background: #c9ced8; }
.b-tab { display: flex; align-items: center; gap: 6px; max-width: 260px; padding: 6px 10px; font-size: 8px; color: #1b2130; background: #f5f7fb; border: 2px solid #9aa3b5; border-bottom: 0; }
.b-tab img { width: 14px; height: 14px; image-rendering: pixelated; }
.b-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tab i { font-style: normal; color: #8e9ab3; margin-left: 6px; }
.b-tab.ghost { background: transparent; border-color: transparent; color: #5a6478; }
.b-bar { display: flex; align-items: center; gap: 4px; padding: 6px; background: #f5f7fb; border-bottom: 2px solid #c9ced8; }
.b-bar button { width: 26px; height: 24px; padding: 0; font: 13px system-ui, sans-serif; color: #2a2f3a; background: #e6e9ef; border: 2px solid #c9ced8; }
.b-bar button:hover { background: #fff; }
.b-addr { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 8px; color: #1b2130; background: #fff; border: 2px solid #c9ced8; border-radius: 12px; overflow: hidden; white-space: nowrap; }
.b-addr b { color: #2e9e44; font-weight: normal; }
.b-addr .lock { font-family: system-ui, sans-serif; font-size: 10px; }
.page { flex: 1; overflow: auto; background: #fff; color: #1b2130; }
.page .muted { color: #6b7590; }

/* search engine home */
.home { display: flex; flex-direction: column; align-items: center; padding: 24px 20px 30px; min-height: 100%; background: #fff; }
.home-top { align-self: stretch; display: flex; justify-content: flex-end; align-items: center; gap: 12px; font-size: 8px; }
.home-top button { background: none; border: 0; color: #1b2130; font-size: 8px; }
.home-top button:hover { text-decoration: underline; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; font-size: 7px; color: #fff; background: var(--orange); border: 2px solid var(--ink); }
.home-logo { margin: 40px 0 26px; }
.clogo b { font-weight: normal; text-shadow: 3px 3px 0 rgba(0,0,0,.12); }
.home-search { display: flex; align-items: center; gap: 8px; width: min(560px, 100%); padding: 10px 14px; background: #fff; border: 3px solid #d0d6e2; border-radius: 26px; box-shadow: 0 2px 0 #e6e9ef; }
.home-search:focus-within { border-color: var(--blue); }
.home-search span { font-family: system-ui, sans-serif; }
.home-search input { flex: 1; border: 0; outline: 0; font: 10px var(--font); color: #1b2130; background: transparent; }
.home-search button, .home-btns button, .web-btn, .site-search button {
  font: 8px var(--font); padding: 9px 12px; color: #fff; background: var(--orange); border: 2px solid var(--ink); box-shadow: inset 0 -3px 0 var(--orange-d); cursor: pointer;
}
.home-btns { margin-top: 14px; }
.home-btns button.ghost, .web-btn.ghost { background: #eef1f6; color: #1b2130; box-shadow: inset 0 -3px 0 #c9ced8; }
.web-btn:disabled { background: #c9ced8; color: #7d8594; box-shadow: none; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(4, 110px); gap: 12px; margin-top: 30px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; font: 8px var(--font); color: #1b2130; background: #f5f7fb; border: 2px solid #e1e5ec; cursor: pointer; }
.tile:hover { background: #eaf1ff; border-color: var(--blue-l); }
.tile span { width: 44px; height: 44px; display: grid; place-items: center; background: #fff; border: 2px solid #d0d6e2; border-radius: 50%; }
.tile img { width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.tile i, .site-nav nav i { font-style: normal; padding: 1px 4px; color: #fff; background: var(--orange); }
.home-hint { font-size: 7px; color: #8e9ab3; margin-top: 24px; }

/* website chrome */
.site-h { position: sticky; top: 0; z-index: 2; }
.site-top { display: flex; justify-content: space-between; gap: 10px; padding: 5px 14px; font-size: 7px; color: #c9d6ee; background: var(--navy); }
.site-nav { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--blue); border-bottom: 3px solid var(--orange); }
.site-logo { font: 13px var(--font); color: var(--blue); background: #fff; padding: 5px 8px; border: 0; cursor: pointer; }
.site-nav nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.site-nav nav button { font: 7px var(--font); color: #fff; background: transparent; border: 0; padding: 6px 7px; cursor: pointer; }
.site-nav nav button:hover, .site-nav nav button.on { background: rgba(255,255,255,.18); }
.site-search { display: flex; gap: 4px; }
.site-search input { width: 130px; font: 8px var(--font); padding: 6px 8px; border: 2px solid var(--ink); outline: 0; }
.site-body { padding: 16px 18px 24px; }
.site-body h2 { font-size: 12px; font-weight: normal; margin: 4px 0 14px; color: #1b2130; }
.site-body h3 { font-size: 8px; font-weight: normal; margin: 0 0 8px; color: var(--blue); }
.site-body p { font-size: 8px; line-height: 1.8; }
.site-f { padding: 12px 18px; font-size: 7px; color: #c9d6ee; background: var(--navy); line-height: 1.8; }
.result { padding: 10px 4px; border-bottom: 1px solid #eef1f6; cursor: pointer; }
.result:hover b { text-decoration: underline; }
.result .r-url { display: block; font-size: 7px; color: #2e9e44; margin-bottom: 5px; }
.result b { display: block; font-size: 10px; font-weight: normal; color: var(--blue); margin-bottom: 5px; }
.result p { margin: 0; color: #4a5162; }
.page .kpis { grid-template-columns: repeat(4, 1fr); }
.page .kpi { background: #fff; border: 2px solid #e1e5ec; border-top: 4px solid var(--blue); }
.page .kpi span { color: #6b7590; }
.page .kpi b { color: #1b2130; }
.page .kpi.good { border-top-color: #2e9e44; } .page .kpi.good b { color: #2e9e44; }
.page .kpi.bad { border-top-color: #e53935; } .page .kpi.bad b { color: #e53935; }
.chart-card { padding: 10px; background: #fff; border: 2px solid #e1e5ec; }
.chart-card canvas { width: 100%; height: auto; border: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chipbtn { font: 8px var(--font); padding: 7px 10px; color: #1b2130; background: #eef1f6; border: 2px solid #d0d6e2; cursor: pointer; }
.chipbtn.on { color: #fff; background: var(--blue); border-color: var(--blue-d); }
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.prod { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #fff; border: 2px solid #e1e5ec; }
.prod:hover { border-color: var(--blue-l); }
.prod.off { opacity: .6; }
.prod-img { height: 84px; display: grid; place-items: center; background: linear-gradient(#f5f7fb, #e6ebf3); }
.prod-img img { image-rendering: pixelated; }
.prod b { font-size: 8px; font-weight: normal; line-height: 1.6; min-height: 26px; }
.prod .price { font-size: 11px; color: var(--orange); }
.prod .sold { font-size: 7px; color: #6b7590; }
.st { font-size: 7px; padding: 4px 6px; display: inline-block; }
.st.ok { color: #1f7a33; background: #e3f5e7; }
.st.no { color: #b42323; background: #fde8e8; }
.st.soon { color: #6b7590; background: #eef1f6; }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.promo { padding: 12px; background: #fff; border: 2px solid #e1e5ec; }
.promo-band { display: flex; align-items: center; gap: 8px; padding: 8px; margin: -12px -12px 10px; background: var(--orange); }
.promo-band b { font-size: 9px; font-weight: normal; color: #fff; }
.promo-band img { width: 22px; height: 22px; image-rendering: pixelated; }
.web-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.web-table td { padding: 8px 6px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.web-table td:first-child { width: 34px; }
.web-table td:last-child { text-align: right; white-space: nowrap; }
.web-table img { width: 26px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.web-table b { display: block; font-size: 8px; font-weight: normal; margin-bottom: 4px; }
.web-table span { font-size: 7px; color: #6b7590; line-height: 1.6; }
.inbox { border: 2px solid #e1e5ec; }
.mail-row { display: grid; grid-template-columns: 10px 180px 1fr auto; gap: 10px; align-items: center; padding: 10px; font-size: 8px; border-bottom: 1px solid #eef1f6; cursor: pointer; }
.mail-row:hover { background: #f5f8ff; }
.mail-row i { width: 8px; height: 8px; }
.mail-row.unread i { background: var(--orange); }
.mail-row.unread b, .mail-row.unread span { color: #1b2130; }
.mail-row b { font-weight: normal; color: #4a5162; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row span { color: #6b7590; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row em { font-style: normal; font-size: 7px; color: #8e9ab3; }
.letter { margin-top: 12px; padding: 14px; border: 2px solid #e1e5ec; }
.letter-h { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #eef1f6; }
.letter-h b { display: block; font-size: 11px; font-weight: normal; margin-bottom: 6px; }
.letter-h span { font-size: 7px; color: #6b7590; }
.mail-actions { display: flex; gap: 8px; margin-top: 12px; }
.news-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; font-size: 8px; border-bottom: 1px solid #eef1f6; }
.news-row img { width: 18px; image-rendering: pixelated; }
.news-row em { font-style: normal; font-size: 7px; color: #8e9ab3; }
@media (max-width: 820px) {
  .os-dock { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .site-nav { flex-wrap: wrap; }
  .site-search { display: none; }
  .page .kpis { grid-template-columns: repeat(2, 1fr); }
  .mail-row { grid-template-columns: 10px 1fr auto; } .mail-row b { display: none; }
  .home-logo .clogo { font-size: 30px !important; }
}

/* ---------- v5: quest go-button, people cards, roles ---------- */
#questList li { grid-template-columns: 16px 1fr auto; }
.q-go { align-self: center; width: 26px; height: 26px; padding: 0; font: 12px system-ui, sans-serif; color: var(--ink); background: var(--orange); border: 2px solid var(--ink); box-shadow: inset 0 -3px 0 var(--orange-d); cursor: pointer; }
.q-go:hover { filter: brightness(1.15); }
.card.flash, .sec.flash, .role.flash { animation: flashCard .65s ease 4; }
@keyframes flashCard { 50% { background: var(--orange-d); box-shadow: 0 0 0 3px var(--orange); } }
.stats3 { display: flex; flex-direction: column; gap: 2px; font-size: 7px; }
.stats3 em { font-style: normal; color: var(--light); letter-spacing: 0; }
.sec-r { float: right; color: var(--muted); font-size: 7px; }
.linkbtn { font: 7px var(--font); color: var(--orange); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.tip { font-size: 7px; line-height: 1.7; color: var(--gold); padding: 8px; margin-bottom: 6px; background: rgba(255,210,63,.08); border: 2px dashed rgba(255,210,63,.35); }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.role { padding: 6px; background: var(--navy-2); border: 2px solid var(--ink); }
.role b { display: block; font-size: 7px; font-weight: normal; margin-bottom: 4px; }
.role span { font-size: 6px; color: var(--muted); line-height: 1.5; }
.recruit { max-height: 60vh; overflow: auto; margin-bottom: 8px; }
.stats3 em { display: flex; align-items: center; gap: 6px; }
.stats3 u { text-decoration: none; width: 62px; }
.stats3 s { text-decoration: none; color: var(--white); }
.sb { display: inline-block; width: 60px; height: 6px; background: var(--ink); border: 1px solid #000; }
.sb b { display: block; height: 100%; }
.sb.sp b { background: var(--blue-l); } .sb.sk b { background: var(--orange); } .sb.ch b { background: #ff5a9e; }
.assort { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; margin-bottom: 6px; }
.av { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; padding: 8px; background: var(--navy-2); border: 2px solid var(--ink); opacity: .75; }
.av.on { opacity: 1; box-shadow: inset 3px 0 0 var(--green); }
.av img { image-rendering: pixelated; height: 32px; object-fit: contain; }
.av b { font-size: 8px; font-weight: normal; line-height: 1.5; }
.av span { font-size: 7px; color: var(--muted); }
.av .btn.small { min-width: 0; width: 100%; }

/* ---------- v8: rating chip, awards, mini-games ---------- */
.stat.rank { cursor: pointer; }
.stat.rank .cup { font-size: 16px; }
.stat.rank b { color: var(--gold, #ffd23f); }
.ach-toast {
  position: fixed; right: 16px; top: 76px; z-index: 9; display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; background: var(--navy); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px #ffd23f, 0 4px 0 rgba(0,0,0,.4);
  animation: achIn 4.2s ease forwards; pointer-events: none; max-width: calc(100vw - 32px);
}
.ach-toast span { font-size: 22px; }
.ach-toast small { display: block; font-size: 7px; color: #ffd23f; margin-bottom: 4px; }
.ach-toast b { font-size: 10px; color: var(--white); }
@keyframes achIn { 0% { transform: translateX(120%); } 10%, 85% { transform: translateX(0); } 100% { transform: translateX(120%); } }
.rk { display: grid; gap: 3px; margin-bottom: 8px; }
.rk-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; background: rgba(255,255,255,.04); font-size: 9px; }
.rk-row b { color: var(--orange); }
.rk-row em { font-style: normal; color: var(--blue-l); }
.rk-row i { font-style: normal; font-size: 7px; color: #ff8a8a; }
.rk-row.me { background: rgba(26,99,216,.35); outline: 2px solid var(--blue); }
.rk-row.me span { color: #ffd23f; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-bottom: 8px; }
.ach { padding: 8px; background: rgba(255,255,255,.04); border: 2px solid rgba(255,255,255,.06); opacity: .55; display: grid; gap: 4px; }
.ach span { font-size: 18px; }
.ach b { font-size: 8px; line-height: 1.4; }
.ach small { font-size: 7px; color: var(--grey, #9aa3b5); line-height: 1.4; }
.ach.got { opacity: 1; border-color: #ffd23f; background: rgba(255,210,63,.08); }
.recs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.rec { display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; background: rgba(255,255,255,.04); font-size: 8px; }
.rec b { color: var(--green, #7dffa0); }
.small { font-size: 8px; line-height: 1.6; }
.hg-bar { position: relative; display: flex; height: 26px; margin: 14px 0; border: 3px solid var(--ink); }
.hg-bar .z { display: block; height: 100%; }
.hg-bar .z.r { background: #c0392b; flex: 20; } .hg-bar .z.y { background: #e0b020; flex: 17; } .hg-bar .z.g { background: #2ecc71; flex: 10; } .hg-bar .z.au { background: #ffd23f; flex: 6; box-shadow: inset 0 0 0 2px #fff6c8; }
.hg-bar .needle { position: absolute; top: -8px; bottom: -8px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 0 2px var(--ink); }
.hg-res { min-height: 40px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 8px; }
.hg-chip { padding: 4px 6px; border: 2px solid var(--ink); font-size: 7px; color: var(--ink); }
.hg-chip.r { background: #ff8a8a; } .hg-chip.y { background: #ffe58a; } .hg-chip.g { background: #9ff5c0; } .hg-chip.au { background: #ffd23f; }
.qte { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.qte b { width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px; background: var(--navy-2, #17284a); border: 3px solid var(--ink); color: var(--light); }
.qte b.cur { border-color: #ffd23f; color: #ffd23f; transform: translateY(-3px); }
.qte b.ok { background: #2e9e44; color: #fff; }
.qte b.bad { background: #c0392b; }
.qte-time { height: 8px; border: 2px solid var(--ink); margin-bottom: 12px; background: rgba(255,255,255,.06); }
.qte-time i { display: block; height: 100%; width: 100%; background: var(--orange); }
.qte-pad { display: flex; gap: 6px; justify-content: center; margin-bottom: 10px; }
.qte-pad .btn { min-width: 46px; font-size: 16px; }
.wheel-wrap { position: relative; width: 240px; height: 240px; margin: 10px auto; }
.wheel-wrap canvas { width: 240px; height: 240px; border-radius: 50%; box-shadow: 0 0 0 4px var(--ink), 0 6px 0 rgba(0,0,0,.4); }
.wheel-ptr { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-size: 22px; color: #e53935; text-shadow: 0 2px 0 var(--ink); }
.lease-st { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.lease-st div { padding: 8px; background: rgba(255,255,255,.05); border: 2px solid var(--ink); text-align: center; }
.lease-st small { display: block; font-size: 7px; color: var(--muted); margin-bottom: 6px; }
.lease-st b { font-size: 10px; color: var(--green); }
.lease-st b.bad { color: #ff6b6b; }
.page .rk-row { background: #eef2f8; }
.page .rk-row.me { background: #d6e4ff; }
.page .rk-row.me span { color: var(--blue-d); }
.page .ach { background: #f4f6fa; border-color: #dfe5ee; }
.page .ach.got { background: #fff8dc; }
.page .rec { background: #eef2f8; }
.page .rec b { color: #1f8a3a; }
.modal-body .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ---------- v10: talk with an employee ---------- */
.modal-body.talkbox { width: min(1180px, 100%); background: transparent; border: 0; box-shadow: none; padding: 0; overflow: visible; }
.tk { display: grid; grid-template-columns: 210px 1fr 210px 270px; grid-template-areas: "me bubble emp card" "ans ans ans ans"; gap: 14px 16px; align-items: end; }
.tk-side { display: flex; flex-direction: column; align-items: center; gap: 0; }
.tk-me { grid-area: me; } .tk-emp { grid-area: emp; }
.portrait { width: 190px; height: auto; image-rendering: pixelated; display: block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.tk-face { transition: opacity .4s; }
.tk-plate { width: 100%; text-align: center; padding: 10px 8px; background: var(--navy); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--blue); margin-top: -4px; }
.tk-plate b { display: block; font-size: 13px; color: var(--white); }
.tk-plate small { display: block; font-size: 8px; color: var(--blue-l); margin-top: 6px; }
.tk-bubble { grid-area: bubble; position: relative; align-self: center; background: #f5f7fb; color: #1b2130; border: 4px solid var(--ink); padding: 16px 18px 22px; min-height: 150px; box-shadow: 0 6px 0 rgba(0,0,0,.35); }
.tk-bubble::after { content: ''; position: absolute; right: -16px; top: 46%; border: 10px solid transparent; border-left: 14px solid #f5f7fb; filter: drop-shadow(3px 0 0 var(--ink)); }
.tk-name { display: block; color: var(--blue); font-size: 11px; margin-bottom: 10px; }
.tk-text span { display: block; font-size: 10px; line-height: 1.7; margin-bottom: 8px; }
.tk-more { position: absolute; right: 14px; bottom: 6px; color: var(--blue); font-style: normal; font-size: 10px; animation: pulse 1s infinite; }
.tk-card { grid-area: card; align-self: center; padding: 14px; background: var(--navy); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--blue), 0 6px 0 rgba(0,0,0,.35); }
.tk-card h3 { margin: 0 0 10px; font-size: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--navy-3); }
.tk-row { display: flex; justify-content: space-between; gap: 8px; font-size: 8px; margin: 7px 0; }
.tk-row span { color: var(--muted); }
.tk-lbl { font-size: 8px; color: var(--light); margin: 12px 0 6px; }
.tk-bar { display: inline-block; width: calc(100% - 52px); height: 12px; border: 2px solid var(--ink); background: rgba(255,255,255,.08); vertical-align: middle; }
.tk-bar i { display: block; height: 100%; background: var(--blue-l); } .tk-bar i.bad { background: #ff7a5a; }
.tk-bar.mood i { background: var(--gold); }
.tk-pct, .tk-emo { display: inline-block; width: 46px; text-align: right; font-size: 10px; vertical-align: middle; }
.tk-pct.bad { color: #ff6b6b; } .tk-pct.ok { color: var(--green); } .tk-emo { font-size: 16px; }
.tk-answer { grid-area: ans; padding: 14px 18px 16px; background: var(--navy); border: 4px solid var(--ink); box-shadow: inset 0 0 0 3px var(--blue), 0 6px 0 rgba(0,0,0,.4); }
.tk-answer .tk-lbl { margin-top: 0; color: var(--blue-l); font-size: 10px; }
.tk-input { padding: 12px 14px; background: var(--navy-2); border: 3px solid var(--ink); font-size: 10px; color: var(--light); margin-bottom: 12px; min-height: 18px; }
.caret { display: inline-block; width: 8px; height: 14px; margin-left: 4px; vertical-align: middle; background: var(--light); animation: pulse 1s infinite; }
.tk-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tk-btns > .btn { grid-column: 1 / -1; }
.tk-btn { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; padding: 10px; border: 3px solid var(--ink); cursor: pointer; font-family: var(--font); color: var(--white); background: var(--navy-2); box-shadow: 0 4px 0 rgba(0,0,0,.4); }
.tk-btn:hover { transform: translateY(-2px); }
.tk-btn span { grid-row: 1 / 3; font-size: 22px; align-self: center; }
.tk-btn b { font-size: 9px; } .tk-btn small { font-size: 7px; color: var(--light); margin-top: 5px; line-height: 1.4; }
.tk-btn.red { background: #3a1820; box-shadow: inset 0 0 0 2px #e04040, 0 4px 0 rgba(0,0,0,.4); } .tk-btn.red b { color: #ff6b6b; }
.tk-btn.orange { background: #3a2410; box-shadow: inset 0 0 0 2px var(--orange), 0 4px 0 rgba(0,0,0,.4); } .tk-btn.orange b { color: var(--orange); }
.tk-btn.blue { background: #142a52; box-shadow: inset 0 0 0 2px var(--blue-l), 0 4px 0 rgba(0,0,0,.4); }
.tk-btn.green { background: #13361f; box-shadow: inset 0 0 0 2px #3fbf5a, 0 4px 0 rgba(0,0,0,.4); } .tk-btn.green b { color: var(--green); }
.tk-btn.navy { background: #1a2442; box-shadow: inset 0 0 0 2px var(--blue), 0 4px 0 rgba(0,0,0,.4); }
@media (max-width: 900px) {
  .tk { grid-template-columns: 1fr 1fr; grid-template-areas: "me emp" "bubble bubble" "card card" "ans ans"; }
  .portrait { width: 120px; } .tk-bubble::after { display: none; }
}

/* ---------- v10: level up ---------- */
.modal-body.lvlbox { width: min(560px, 100%); padding: 0; overflow: hidden; box-shadow: 0 0 0 4px var(--ink), 0 0 60px rgba(91,155,255,.45), inset 0 0 0 3px var(--blue-l); }
.lvlup { position: relative; padding: 0 0 18px; background: radial-gradient(circle at 50% 22%, #24448a 0%, var(--navy) 60%); overflow: hidden; }
.lvlup .cf { position: absolute; top: -12px; width: 7px; height: 11px; transform: rotate(25deg); animation: cfFall 3s linear infinite; opacity: .9; }
@keyframes cfFall { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(620px) rotate(540deg); } }
.lu-head { margin: 10px; padding: 14px; text-align: center; font-size: 20px; color: var(--white); background: linear-gradient(#2a6ae0, #1a4fb8); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--blue-l); text-shadow: 0 3px 0 var(--ink); }
.lu-badge { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 14px 0; }
.lu-badge b { display: grid; place-items: center; width: 92px; height: 92px; font-size: 48px; color: var(--ink); background: var(--orange); border: 4px solid var(--ink); box-shadow: inset 0 0 0 4px #ffb070, 0 0 30px rgba(255,170,60,.5); animation: luPop .6s ease; }
@keyframes luPop { 0% { transform: scale(.2) rotate(-20deg); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.laurel { width: 46px; height: 84px; image-rendering: pixelated; }
.laurel.l { transform: scaleX(-1); }
.lu-head img { width: 22px; height: 22px; image-rendering: pixelated; vertical-align: middle; margin: 0 10px; }
.lu-msg { margin: 0 34px 14px; padding: 12px; text-align: center; background: rgba(10,16,32,.55); border: 2px solid var(--navy-3); }
.lu-msg b { display: block; font-size: 11px; color: var(--white); } .lu-msg small { display: block; font-size: 8px; color: var(--light); margin-top: 8px; }
.lu-list { margin: 0 22px; border: 3px solid var(--ink); background: rgba(10,16,32,.6); }
.lu-cap { padding: 9px 12px; font-size: 10px; background: var(--blue); color: var(--white); }
.lu-item { display: grid; grid-template-columns: 40px 1fr 20px; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 0; border-top: 2px solid var(--navy-3); background: transparent; color: var(--white); font-family: var(--font); text-align: left; cursor: pointer; }
.lu-item:hover { background: rgba(91,155,255,.15); }
.lu-item img { width: 34px; height: 34px; image-rendering: pixelated; object-fit: contain; }
.lu-item b { display: block; font-size: 9px; } .lu-item small { display: block; font-size: 7px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.lu-item i { font-style: normal; font-size: 18px; color: var(--light); }
.lu-more { padding: 8px 12px; font-size: 8px; color: var(--muted); border-top: 2px solid var(--navy-3); }
.lu-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 22px 0; }
.lu-btns .btn { position: relative; font-size: 10px; padding: 14px 8px; }
.lu-up { background: var(--orange); color: var(--ink); }
.lu-up em { position: absolute; top: -10px; right: -8px; width: 22px; height: 22px; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff; background: #e53935; border: 2px solid var(--ink); border-radius: 50%; }

/* ---------- v12: unified modal style (header strip, glowing frame) ---------- */
.modal { backdrop-filter: blur(1px); }
.modal-body {
  background: radial-gradient(circle at 50% 0%, #22417f 0%, var(--navy) 58%);
  box-shadow: 0 0 0 4px var(--ink), 0 0 40px rgba(91,155,255,.3), inset 0 0 0 3px var(--blue-l), 0 8px 0 rgba(0,0,0,.45);
  border: 0;
}
.modal-body > h2:first-child {
  margin: -20px -20px 16px; padding: 14px 18px; font-size: 14px; line-height: 1.4;
  background: linear-gradient(#2a6ae0, #1a4fb8); border-bottom: 3px solid var(--ink);
  box-shadow: inset 0 -2px 0 var(--blue-l), inset 0 2px 0 rgba(255,255,255,.18); text-shadow: 0 2px 0 var(--ink);
}
.modal-body > h2:first-child + p.muted { padding: 10px 12px; background: rgba(10,16,32,.5); border: 2px solid var(--navy-3); color: var(--light); }
.modal-body .row-btns { gap: 12px; }

/* candidate cards */
.cands { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 6px 0 14px; }
.cc { position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 12px 14px; background: linear-gradient(#1d3566, #15264a);
  border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--navy-3), 0 5px 0 rgba(0,0,0,.4); }
.cc.best { box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(255,210,63,.25), 0 5px 0 rgba(0,0,0,.4); }
.cc-best { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); padding: 4px 8px; font-size: 7px; font-style: normal; color: var(--ink); background: var(--gold); border: 2px solid var(--ink); }
.cc-ph { width: 100%; display: flex; justify-content: center; padding: 6px 0 0; background: radial-gradient(circle at 50% 70%, rgba(91,155,255,.35), transparent 70%); border-bottom: 3px solid var(--ink); margin-bottom: 10px; }
.cc-ph .portrait { width: 104px; filter: none; }
.cc-main { width: 100%; }
.cc-name { display: block; text-align: center; font-size: 10px; }
.cc-stars { text-align: center; color: var(--gold); font-size: 12px; margin: 6px 0 2px; letter-spacing: 2px; } .cc-stars span { color: #3a4a6a; }
.cc-role { text-align: center; font-size: 7px; color: var(--blue-l); margin-bottom: 10px; }
.cc-stat { display: grid; grid-template-columns: 18px 64px 1fr 14px; align-items: center; gap: 4px; font-size: 7px; margin: 5px 0; }
.cc-stat u { text-decoration: none; color: var(--light); } .cc-stat s { text-decoration: none; text-align: right; }
.cc-bar { display: block; height: 8px; border: 2px solid var(--ink); background: rgba(255,255,255,.07); }
.cc-bar b { display: block; height: 100%; } .cc-bar.sp b { background: #5b9bff; } .cc-bar.sk b { background: var(--orange); } .cc-bar.ch b { background: #ff5a9e; }
.cc-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.cc-chips div { padding: 6px; text-align: center; background: rgba(10,16,32,.55); border: 2px solid var(--navy-3); }
.cc-chips small { display: block; font-size: 6px; color: var(--muted); margin-bottom: 4px; } .cc-chips b { font-size: 8px; color: var(--green); }
.cc-hire { width: 100%; margin: 0; } .cc-hire.off { opacity: .55; font-size: 7px; }

/* touch action button */
#actBtn { display: none; position: fixed; right: calc(env(safe-area-inset-right) + 14px); bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 5;
  width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--ink); background: var(--orange); color: var(--ink); font-size: 9px;
  box-shadow: inset 0 -5px 0 var(--orange-d), 0 4px 0 rgba(0,0,0,.4); }
#actBtn b { display: block; font-size: 20px; margin-bottom: 2px; }
#actBtn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 var(--orange-d); }

/* ---------- v12: phones (portrait and landscape) ---------- */
@media (max-width: 820px), (max-height: 500px) {
  :root { --top: calc(env(safe-area-inset-top) + 48px); }
  #actBtn { display: block; }
  #controls { display: none !important; }
  #topbar { flex-wrap: nowrap !important; gap: 4px; padding: calc(env(safe-area-inset-top) + 4px) calc(env(safe-area-inset-right) + 4px) 4px calc(env(safe-area-inset-left) + 4px); height: auto; overflow: hidden; }
  #topbar .logo { display: none !important; }
  #topbar .stat { padding: 4px 6px; min-width: 0; flex: 0 1 auto; }
  #topbar .stat b { font-size: 9px; }
  #topbar .stat small { font-size: 6px; }
  .money .coin { width: 18px; height: 18px; font-size: 9px; }
  .rep { width: auto !important; } .rep .stars { font-size: 8px; } .rep small, .rep .bar { display: none !important; }
  .level { order: 0 !important; flex-basis: auto !important; max-width: none !important; }
  .level .lvl-info small { display: none; } .level .lvl-info .bar { width: 46px; } .lvl-badge { width: 22px; height: 22px; font-size: 10px; }
  .stat.rank small { display: none; } .stat.rank .cup { font-size: 12px; }
  .clock small { display: none; } .clock { display: flex !important; }
  .buttons { margin-left: auto; gap: 3px; flex: 0 0 auto; }
  button.icon { width: 30px !important; height: 30px !important; font-size: 12px !important; }
  #quests { top: calc(var(--top) + 4px); left: calc(env(safe-area-inset-left) + 6px); width: min(280px, calc(100vw - 12px)); max-height: 46vh; }
  #quests .panel-head { padding: 6px 8px; font-size: 8px; }
  #quests.collapsed { width: auto; }
  #quests li { font-size: 7px; }
  #biz:not(.collapsed) { top: auto !important; bottom: 0; left: 0; right: 0; width: auto !important; max-height: 70vh; padding-bottom: env(safe-area-inset-bottom); }
  #biz .panel-head { font-size: 9px; padding: 8px 10px; }
  #biz .card { padding: 8px; gap: 8px; } #biz .card img { width: 30px; height: 30px; }
  .event-badge { top: calc(var(--top) + 6px) !important; font-size: 7px; max-width: 64vw; white-space: normal; text-align: center; padding: 5px 8px; }
  .hint { left: calc(env(safe-area-inset-left) + 8px); right: 96px; transform: none; bottom: calc(env(safe-area-inset-bottom) + 10px); font-size: 7px; max-width: none; }
  #feed { left: calc(env(safe-area-inset-left) + 8px); bottom: calc(env(safe-area-inset-bottom) + 50px); max-width: 62vw; }
  #feed > *:nth-child(n+4) { display: none; }
  .feed-item, #feed > * { font-size: 7px; padding: 5px 7px; }
  .location { right: 96px !important; bottom: calc(env(safe-area-inset-bottom) + 34px) !important; font-size: 7px; }
  .banner { font-size: 12px; padding: 12px 16px; }
  .ach-toast { top: calc(var(--top) + 40px); }
  .modal { padding: 6px; align-items: center; }
  .modal-body { padding: 14px; max-height: calc(100dvh - 12px); width: 100% !important; }
  .modal-body > h2:first-child { margin: -14px -14px 12px; padding: 11px 12px; font-size: 11px; }
  .modal-body p, .modal-body li { font-size: 8px; line-height: 1.6; }
  .cands { grid-template-columns: 1fr; gap: 12px; }
  .cc { flex-direction: row; align-items: stretch; gap: 10px; padding: 10px; }
  .cc-ph { width: 84px; flex: 0 0 84px; border-bottom: 0; border-right: 3px solid var(--ink); margin: 0; align-items: center; }
  .cc-ph .portrait { width: 72px; }
  .cc-name, .cc-stars, .cc-role { text-align: left; }
  /* talk & level-up */
  .modal-body.talkbox { padding: 0; }
  .tk { grid-template-columns: 1fr 1fr; grid-template-areas: "me emp" "bubble bubble" "card card" "ans ans"; gap: 8px; }
  .portrait { width: 96px; }
  .tk-plate b { font-size: 9px; } .tk-plate small { font-size: 6px; }
  .tk-bubble { padding: 10px 12px 16px; min-height: 0; } .tk-bubble::after { display: none; }
  .tk-text span { font-size: 8px; }
  .tk-card { padding: 10px; } .tk-card h3 { font-size: 9px; }
  .tk-btns { grid-template-columns: 1fr 1fr; gap: 6px; }
  .tk-btn { padding: 7px; grid-template-columns: 24px 1fr; } .tk-btn span { font-size: 16px; } .tk-btn b { font-size: 7px; } .tk-btn small { font-size: 6px; }
  .lu-head { font-size: 13px; padding: 10px; } .lu-badge b { width: 64px; height: 64px; font-size: 32px; } .laurel { width: 32px; height: 58px; }
  .lu-msg { margin: 0 14px 10px; } .lu-list { margin: 0 12px; } .lu-btns { margin: 12px 12px 0; } .lu-item { padding: 8px; }
  .wheel-wrap, .wheel-wrap canvas { width: 200px; height: 200px; }
}
@media (max-width: 420px) {
  .clock { display: none !important; }
  #btnPause { display: none; }
  #topbar .stat { padding: 3px 4px; }
  .money small { display: none; }
}
@media (max-height: 500px) {
  #quests { max-height: calc(100vh - var(--top) - 20px); }
  #biz:not(.collapsed) { left: auto; width: 56vw !important; max-height: calc(100vh - var(--top)); top: var(--top) !important; }
  .tk { grid-template-columns: 110px 1fr 110px; grid-template-areas: "me bubble emp" "card card card" "ans ans ans"; }
  .portrait { width: 84px; }
  .modal-body.lvlbox .lu-badge { margin: 6px 0; }
}
@media (max-width: 820px), (max-height: 500px) {
  #quests .panel-head, #quests .panel-head span { font-size: 8px !important; padding: 5px 8px; }
  #quests .panel-head button.icon, #quests .panel-head .tiny { width: 22px !important; height: 22px !important; font-size: 10px !important; }
  #quests.collapsed { width: 120px !important; }
  .event-badge { left: auto !important; right: calc(env(safe-area-inset-right) + 8px) !important; transform: none !important; animation: none; }
  #actBtn { font-size: 6px; } #actBtn b { font-size: 22px; }
  #biz.collapsed { display: none !important; }
  #biz .panel-head span { font-size: 9px; }
  .tabs button { font-size: 6px !important; padding: 8px 1px !important; }
  .tabs button .badge { display: none; }
  .modal-body .row-btns .btn { font-size: 8px; padding: 10px 6px; }
  .hint { font-size: 7px !important; padding: 6px 8px; }
}
/* employee cards in the recruitment centre */
.emps { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.ec { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 10px; background: linear-gradient(#1d3566, #15264a); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--navy-3), 0 4px 0 rgba(0,0,0,.4); }
.ec.asks { box-shadow: inset 0 0 0 2px var(--orange), 0 0 14px rgba(255,122,26,.3), 0 4px 0 rgba(0,0,0,.4); }
.ec-ph { display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(circle at 50% 70%, rgba(91,155,255,.3), transparent 70%); border-right: 3px solid var(--ink); }
.ec-ph .portrait { width: 58px; filter: none; }
.ec .cc-name, .ec .cc-role { text-align: left; } .ec .cc-role { margin: 4px 0 6px; }
.ec .cc-stat { grid-template-columns: 16px 70px 1fr 26px; }
.cc-bar.ok b { background: var(--blue-l); } .cc-bar.bad b { background: #ff7a5a; } .cc-bar.md b { background: var(--gold); }
.ec-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; } .ec-btns .btn { margin: 0; font-size: 7px; padding: 7px 4px; }
.modal-body .recruit { max-height: 66vh; padding-right: 4px; }
.modal-body .recruit .sec { margin-top: 6px; }
.modal-body .roles .role { background: rgba(10,16,32,.45); border: 2px solid var(--navy-3); }
@media (max-width: 820px), (max-height: 500px) { .emps { grid-template-columns: 1fr; } }
.emps { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ec-main { min-width: 0; }
.ec .cc-role { font-size: 6px; line-height: 1.5; }
.ec .cc-stat { grid-template-columns: 14px 58px minmax(0, 1fr) 30px; }
.ec-btns .btn { white-space: nowrap; overflow: hidden; }

/* ---------- v13: polish of the new windows ---------- */
/* the header strip sits inside the 3px frame instead of covering it */
.modal-body > h2:first-child { margin: -17px -17px 16px; }
.modal-body { padding-top: 17px; }
/* level up */
.lvlup > *:not(.cf) { position: relative; z-index: 1; }
.lvlup .cf { z-index: 0; }
.lu-head { display: flex; align-items: center; justify-content: center; gap: 12px; letter-spacing: 1px; }
.lu-head img { margin: 0 !important; }
.lu-badge { gap: 14px; }
.lu-badge b { width: auto; min-width: 92px; padding: 0 10px; line-height: 1; }
.lu-badge b.two { font-size: 40px; min-width: 110px; }
.laurel { width: 40px; height: 74px; }
.lu-list .lu-item:first-of-type { border-top: 0; }
.lu-btns .btn { display: flex; align-items: center; justify-content: center; min-height: 48px; margin: 0; }
/* candidate cards: same frame for every card, the best one only changes colour */
.cands { align-items: stretch; }
.cc, .cc.best { border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px var(--navy-3), 0 5px 0 rgba(0,0,0,.4); margin-top: 8px; }
.cc.best { border-color: var(--gold); box-shadow: inset 0 0 0 2px rgba(255,210,63,.35), 0 0 16px rgba(255,210,63,.25), 0 5px 0 rgba(0,0,0,.4); }
.cc-ph { margin: -12px -12px 10px; width: calc(100% + 24px); padding-top: 10px; }
.cc-main { display: flex; flex-direction: column; flex: 1; }
.cc-hire { margin-top: auto !important; }
.cc-stat span { font-size: 9px; text-align: center; }
.modal-body .row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-body .row-btns .btn { margin: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.modal-body .row-btns .btn.ghost { background: var(--navy-2); box-shadow: inset 0 0 0 2px var(--blue), inset 0 -4px 0 rgba(0,0,0,.35); color: var(--white); }
@media (max-width: 820px), (max-height: 500px) {
  .modal-body { padding-top: 11px; }
  .modal-body > h2:first-child { margin: -11px -11px 12px; }
  .cc-ph { margin: -10px 0 -10px -10px; width: 84px; }
  .lu-badge b.two { font-size: 28px; min-width: 76px; }
}
.lu-msg { background: #0c1630; }
.lu-list { background: #0c1630; }
