#game-container, #modal-overlay {
  --rs-ink: #082c3e;
  --rs-deep: #092434;
  --rs-panel: rgba(9, 36, 52, 0.94);
  --rs-line: #386076;
  --rs-muted: #b8d5df;
  --rs-paper: #f7f4df;
  --rs-lime: #c7ec64;
  --rs-good: #4cff7a;
  --rs-warn: #ffc04d;
  --rs-bad: #ff6b6b;
  --rs-info: #5aa9ff;
}

.page-container:has(#game-container) { justify-content: flex-start; min-height: 0; }

#game-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: calc(100dvh - var(--header-height, 71px));
  min-height: 420px;
  overflow: hidden;
  background: var(--rs-ink);
  font-family: Nunito, system-ui, Arial, sans-serif;
  color: var(--rs-paper);
}

#hud [hidden] { display: none !important; }

#game-container button,
#modal-overlay button {
  margin: 0;
  box-shadow: none;
  transition: background-color 0.15s, border-color 0.15s;
  font-family: inherit;
  line-height: 1.2;
  text-transform: none;
}

#hud {
  position: relative;
  flex: 0 0 auto;
  background: var(--rs-deep);
  border-bottom: 2px solid var(--rs-line);
  z-index: 20;
}

.hud-main {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 6px 14px;
}

.hud-cash { display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; flex: 0 0 auto; }
.hud-label { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--rs-muted); }
.hud-big { font-size: 1.75rem; font-weight: 900; color: var(--rs-lime); letter-spacing: -0.01em; }

#hud dl.hud-stats { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; column-gap: 22px; row-gap: 1px; margin: 0; flex: 0 0 auto; }
#hud .pair { display: grid; grid-template-columns: 78px auto; align-items: baseline; column-gap: 8px; white-space: nowrap; line-height: 1.17; }
#hud .pair dt { margin: 0; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rs-muted); }
#hud .pair dd { margin: 0; font-size: 0.95rem; font-weight: 800; color: var(--rs-paper); }
#hud #hud-income { color: var(--rs-good); }
#hud .neg, #hud #hud-income.neg { color: var(--rs-bad); }
#hud .warn { color: var(--rs-warn); }

.hud-clock { display: flex; flex-direction: column; gap: 3px; width: auto; min-width: 250px; flex: 0 0 auto; margin-left: auto; }
.hud-mascot { display: block; flex: 0 1 auto; height: 58px; width: auto; min-width: 0; margin: -2px auto; object-fit: contain; pointer-events: none; user-select: none; }
.hud-mascot + .hud-clock { margin-left: 0; }
.hud-date-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; white-space: nowrap; }
.hud-date { font-weight: 800; font-size: 0.95rem; }
.hud-left { font-size: 0.72rem; color: var(--rs-muted); }
.hud-left:empty { display: none; }
.hud-progress { height: 3px; background: #1b4458; border-radius: 2px; overflow: hidden; }
#hud-progress-bar { height: 100%; width: 0; background: var(--rs-lime); }
.hud-controls { display: flex; align-items: center; gap: 6px; }
.hud-speeds { display: flex; gap: 3px; }

#hud .hud-speeds button,
#hud .hud-autopause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--rs-paper) !important;
  background: #0f3a4f !important;
  border: 1px solid var(--rs-line);
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
#hud .hud-speeds button { width: 34px; padding: 0; }
#game-container #hud button:hover { border-color: var(--rs-lime); }
#hud .hud-speeds button.active { background: var(--rs-lime) !important; color: var(--rs-ink) !important; border-color: var(--rs-lime); }
#hud .hud-autopause { font-size: 0.72rem; color: var(--rs-muted) !important; }
#hud .hud-autopause::before { content: ''; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: #4a5d68; }
#hud .hud-autopause.active { color: var(--rs-lime) !important; border-color: var(--rs-lime); }
#hud .hud-autopause.mode-urgent::before { background: var(--rs-lime); }
#hud .hud-autopause.mode-all::before { background: var(--rs-warn); }
#hud .hud-autopause.mode-all { color: var(--rs-warn) !important; border-color: var(--rs-warn); }
#hud .ap-short { display: none; }

#game-menu .hud-icon .fs-off, #game-container.is-fullscreen #game-menu .hud-icon .fs-on { display: none; }
#game-container.is-fullscreen #game-menu .hud-icon .fs-off { display: block; }
#game-menu button.has-score { position: relative; }
#game-menu button.has-score::after { content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--rs-lime); border: 2px solid var(--rs-deep); }


@media (max-width: 1180px) {
  .hud-main { gap: 16px; }
  #hud dl.hud-stats { column-gap: 16px; }
}

@media (max-width: 1080px) {
  .hud-left { display: none; }
  .hud-clock { width: auto; min-width: 210px; }
  #hud .pair { grid-template-columns: auto auto; }
}

@media (max-width: 980px), (max-height: 560px) and (pointer: coarse) {
  #game-container { min-height: 0; }
  #hud { overflow: hidden; }
  .hud-main { position: relative; z-index: 1; }
  .hud-clock, .hud-mascot + .hud-clock { margin-left: auto; min-width: 0; }
  .hud-mascot { position: absolute; left: 50%; top: 50%; height: 100%; margin: 0; transform: translate(-50%, -50%); opacity: 0.14; z-index: -1; }
  #feed { position: relative; }
  #feed .feed-head .feed-new { position: absolute; right: 8px; bottom: 6px; z-index: 2; height: 24px; padding: 0 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }

  #feed .hud-rival span { display: none; }
  #feed .feed-head .game-menu .hud-rival { padding: 0 2px; }
  .hud-main { gap: 12px; padding: 4px 8px 6px; }
  .hud-big { font-size: 1.3rem; }
  #hud dl.hud-stats { column-gap: 12px; }
  #hud .pair { grid-template-columns: auto auto; column-gap: 6px; }
  #hud .pair dt { font-size: 0.56rem; }
  #hud .pair dd { font-size: 0.82rem; }
  .hud-left { display: none; }
  .hud-clock { width: auto; gap: 2px; }
  .hud-date { font-size: 0.85rem; }
  .hud-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 0; }
  #hud .hud-speeds button, #hud .hud-autopause { height: 26px; font-size: 0.72rem; }
  #hud .hud-speeds button { width: 30px; }
  #hud .ap-label { display: none; }
  #hud .ap-short { display: inline; }
  #hud .hud-autopause { margin-left: 0; padding: 0 7px; }


}

@media (max-width: 760px) {
  .hud-main { display: grid; grid-template-columns: 1.25fr 1fr 1fr; align-items: end; gap: 4px 10px; padding: 5px 10px 7px; }
  #hud dl.hud-stats { display: contents; }
  #hud .pair { grid-template-columns: auto; line-height: 1.12; }
  #hud .pair dt { font-size: 0.54rem; }
  .hud-cash { line-height: 1; }
  .hud-clock { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 0; }
  .hud-mascot + .hud-clock { margin: 2px 0 0; }
  .hud-controls { gap: 4px; }
}

@media (max-width: 380px) {
  #hud .hud-speeds button { width: 27px; }
  #hud .pair dd { font-size: 0.76rem; }
  .hud-big { font-size: 1.15rem; }
  #hud dl.hud-stats { column-gap: 10px; }
}

#map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: grab;
  outline: none;
}

#toasts {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: min(380px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 11;
}

.toast {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--rs-panel);
  border-left: 4px solid var(--rs-muted);
  font-size: 0.88rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: opacity 0.6s;
}
.toast-good { border-left-color: var(--rs-good); }
.toast-bad { border-left-color: var(--rs-bad); }
.toast-rival { border-left-color: #c77dff; background: rgba(46, 22, 74, 0.95); }
.toast.fade { opacity: 0; }

.inbox-overdue {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox-overdue li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 12px;
  padding: 8px 10px;
  border: 1px solid var(--rs-line);
  border-left: 3px solid var(--rs-bad);
  border-radius: 8px;
  background: #103447;
}

#modal-content .inbox-back { margin: 0 0 0.75rem; }

#modal-overlay {
  display: none;
  position: fixed;
  top: var(--header-height, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 998;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  box-sizing: border-box;
}

#modal-box {
  position: relative;
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - var(--header-height, 0px) - var(--bottom-nav-height, 0px) - 32px);
  box-sizing: border-box;
  overflow-y: auto;
  padding: 1.4em 1.6em;
  background: var(--rs-deep);
  color: var(--rs-paper);
  border: 1px solid var(--rs-line);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  font-family: Nunito, system-ui, Arial, sans-serif;
}

#modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--rs-paper);
  font-size: 1.8em;
  line-height: 1;
  cursor: pointer;
}
#modal-close:hover { color: var(--rs-bad); }

#modal-content h2 { margin: 0 0 0.4em; color: var(--rs-lime); font-size: 1.6em; }
#modal-content h3 { margin: 1em 0 0.4em; font-size: 1.05em; color: var(--rs-lime); }
#modal-content p { margin: 0.5em 0; line-height: 1.5; }
#modal-content strong { color: #fff; }
#modal-content .muted { color: var(--rs-muted); font-size: 0.9em; }
#modal-content .bad { color: var(--rs-bad); }
#modal-content .good { color: var(--rs-good); }
#modal-content .quirk { font-style: italic; color: var(--rs-muted); font-size: 0.9em; }

.property-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0.7em 0;
  padding: 8px 12px;
  border: 1px solid var(--rs-line);
  border-radius: 10px;
  background: #082b3d;
}

.property-preview img {
  display: block;
  width: min(44%, 168px);
  height: 104px;
  object-fit: contain;
}

.property-preview figcaption {
  color: var(--rs-muted);
  font-weight: 800;
}

.modal-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1em; }

#modal-content button {
  font: inherit;
  font-weight: 800;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
}
.buy-btn { flex: 1 1 auto; padding: 0.65em 1.1em; background: #0b74bf; }
.buy-btn:hover { background: #0d88d9; }
.cancel-btn { padding: 0.65em 1.1em; background: #556; }
.cancel-btn:hover { background: #667; }
.small-btn { padding: 0.3em 0.8em; font-size: 0.85em; background: #0b74bf; }
.muted-btn { background: #556; }
.danger { background: #a83232 !important; }

.rent-slider { width: 100%; accent-color: var(--rs-lime); }

.unit-list { list-style: none; padding: 0; margin: 0; }
.unit-list li, .app, .work-order {
  padding: 8px 10px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 0.92em;
}

.log { padding-left: 1.1em; font-size: 0.88em; }
.log li { margin: 3px 0; }
.log-good { color: var(--rs-good); }
.log-bad { color: var(--rs-bad); }

table.portfolio, table.fin { width: 100%; border-collapse: collapse; font-size: 0.88em; }
table.portfolio th, table.portfolio td, table.fin td { padding: 5px 6px; border-bottom: 1px solid var(--rs-line); text-align: left; }
table.portfolio tr[data-action] { cursor: pointer; }
table.portfolio tr[data-action]:hover { background: rgba(199, 236, 100, 0.12); }
table.fin td:last-child { text-align: right; }
table.fin tr.total td { font-weight: 800; color: var(--rs-lime); }

.score-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.scores { padding-left: 1.4em; }

.submit-score { display: flex; gap: 8px; margin: 1em 0; }
.submit-score input {
  width: 5em;
  padding: 0.5em;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-radius: 8px;
  border: 1px solid var(--rs-line);
  background: #fff;
  color: var(--rs-ink);
}

.rs-start-mascot { display: block; width: 140px; margin: 0 auto 0.6em; }
.rs-help-mascot { width: 120px; margin-bottom: 0.3em; }
#modal-content .rs-help-mascot + h2 { text-align: center; }


#modal-content h2, #modal-content h3 { font-family: 'Original Surfer', Nunito, sans-serif; text-transform: none; letter-spacing: 0; color: var(--rs-lime) !important; }
#modal-content p, #modal-content li, #modal-content td, #modal-content th { color: var(--rs-paper) !important; overflow: visible; }
#modal-content p.muted, #modal-content .muted { color: var(--rs-muted) !important; }
#modal-content .bad, #modal-content p .bad { color: var(--rs-bad) !important; }
#modal-content .good, #modal-content p.good { color: var(--rs-good) !important; }
#modal-content .quirk { color: var(--rs-muted) !important; }
#modal-content .log-good { color: var(--rs-good) !important; }
#modal-content .log-bad { color: var(--rs-bad) !important; }
#modal-overlay #modal-close { padding: 0; background: none !important; color: var(--rs-paper) !important; }
#modal-overlay #modal-close:hover { color: var(--rs-bad) !important; }
#modal-content .buy-btn, #modal-content .small-btn { background: #0b74bf !important; color: #fff !important; }
#modal-content .buy-btn:hover, #modal-content .small-btn:hover { background: #0d88d9 !important; }
#modal-content .cancel-btn, #modal-content .muted-btn { background: #556 !important; color: #fff !important; }
#modal-content .cancel-btn:hover, #modal-content .muted-btn:hover { background: #667 !important; }
#modal-content .danger { background: #a83232 !important; }
#modal-content .danger:hover { background: #c03b3b !important; }

@media (max-width: 980px) {
  #toasts { right: 6px; width: calc(100% - 12px); }
  .toast { font-size: 0.8rem; padding: 6px 10px; }
  #modal-box { padding: 1.1em 1em; }
  .score-cols { grid-template-columns: 1fr; }
}
}

#modal-content .log-rival { color: #d9b8ff !important; }
#modal-content .rival-note { color: #e2c7ff !important; background: rgba(155, 77, 255, 0.12); border-left: 3px solid #c77dff; padding: 6px 10px; border-radius: 6px; }
#modal-content .offer { padding: 8px 10px; margin: 6px 0; border-radius: 8px; background: rgba(155, 77, 255, 0.12); border-left: 3px solid #c77dff; font-size: 0.92em; }
#modal-content .rival-quote { margin: 0.6em 0; padding: 8px 12px; font-style: italic; color: #ecd9ff; border-left: 3px solid #c77dff; background: rgba(155, 77, 255, 0.1); border-radius: 6px; }
#modal-content .rival-preview { border-color: #7a4fb0; }

@media (max-width: 1100px) {
  #game-container { height: calc(100dvh - var(--header-height, 0px) - var(--bottom-nav-height, 60px)); }
  #modal-overlay { bottom: var(--bottom-nav-height, 60px); }
}

#modal-content .lot-summary { display: flex; align-items: center; gap: 12px; margin: 0.4em 0 0.6em; padding: 6px 10px; border: 1px solid var(--rs-line); border-radius: 10px; background: #082b3d; line-height: 1.45; }
#modal-content .lot-summary img { width: 96px; height: 60px; object-fit: contain; flex: 0 0 auto; }
#modal-content .lot-summary img.faded { opacity: 0.5; }
#modal-content .needs-attention { margin: 0.6em 0 0.8em; padding: 4px 10px 8px; border: 1px solid var(--rs-warn); border-radius: 10px; background: rgba(255, 192, 77, 0.06); }
#modal-content .needs-attention h3 { margin: 0.4em 0 0.3em; color: var(--rs-warn) !important; }
#modal-content .action-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); font-size: 0.92em; }
#modal-content .action-item.work-order { border-left: 3px solid var(--rs-bad); }
#modal-content .action-item.app { border-left: 3px solid var(--rs-info); }
#modal-content .action-item.late { border-left: 3px solid var(--rs-warn); }
#modal-content .action-item.offer { border-left: 3px solid #c77dff; }

.brock-face { display: block; object-fit: cover; object-position: 50% 14%; background: radial-gradient(circle at 50% 30%, #2a4a6b, #0b1f30); }
.sal-loans {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 16px);
  padding: 10px;
  border: 1px solid var(--rs-line);
  border-radius: 12px;
  background: #102f40;
}

#modal-content .sal-loans h3 { margin: 0; }
#modal-content .sal-loans p { margin-bottom: 0; }

.loan-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
  gap: 8px;
  margin-top: 8px;
}

.loan-option {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--rs-line);
  border-radius: 8px;
  font-size: 0.9em;
}

.sal-portrait {
  display: block;
  flex: 0 0 auto;
  width: clamp(76px, 22vw, 96px);
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 32%;
}
.toast .brock-tiny, #modal-content .brock-tiny { display: inline-block; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #c77dff; vertical-align: middle; flex: 0 0 auto; }
.toast-rival { display: flex; align-items: center; gap: 8px; }
#modal-content h3.with-face { display: flex; align-items: center; gap: 8px; }
#modal-content .brock-small { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #c77dff; flex: 0 0 auto; }
#modal-content .rival-owner { display: flex; align-items: center; gap: 10px; }
#modal-content .rival-header { display: flex; align-items: center; gap: 14px; margin-bottom: 0.6em; }
#modal-content .rival-header h2 { margin: 0; }
#modal-content .rival-header .muted { margin: 0.1em 0 0.3em; }
#modal-content .brock-portrait { width: 104px; height: 130px; border-radius: 12px; border: 2px solid #c77dff; flex: 0 0 auto; object-position: 50% 8%; }
#modal-content .rival-event { display: flex; align-items: flex-start; gap: 16px; }
#modal-content .rival-event h2 { margin: 0.1em 0 0.1em; }
#modal-content .brock-hero { width: 150px; height: 200px; border-radius: 14px; border: 2px solid #c77dff; flex: 0 0 auto; object-position: 50% 6%; box-shadow: 0 6px 20px rgba(155, 77, 255, 0.35); }
@media (max-width: 520px) {
  #modal-content .rival-event { flex-direction: column; align-items: center; text-align: center; }
  #modal-content .rival-event p { text-align: center; }
  #modal-content .rival-event .rival-quote { text-align: left; }
  #modal-content .brock-hero { width: 130px; height: 160px; }
  #modal-content .brock-portrait { width: 80px; height: 100px; }
}

@keyframes rs-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.0); } 50% { box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.45); } }

#modal-content .warn-text { color: var(--rs-warn) !important; }

#modal-content .staff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#modal-content .staff-card { padding: 10px 12px; border: 1px solid var(--rs-line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); font-size: 0.92em; }
#modal-content .staff-card p { margin: 0.4em 0; }
#modal-content .staff-card.hired { border-color: var(--rs-good); background: rgba(76, 255, 122, 0.06); }
#modal-content .staff-card.hired strong::after { content: ' (hired)'; color: var(--rs-good); font-weight: 700; }
.staff-profile { display: flex; align-items: center; gap: 10px; }
.staff-profile img { flex: 0 0 auto; width: 64px; height: 64px; object-fit: contain; }
.staff-profile .crew-portrait { width: min(42%, 108px); height: 72px; }
@media (max-width: 520px) { #modal-content .staff-grid { grid-template-columns: 1fr; } }

#modal-content .brock-link { color: #d9b8ff !important; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
#modal-content .brock-link:hover { color: #fff !important; }

.face-bubble { display: inline-block; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #8fb3c8; background-color: #1b3a4e; background-repeat: no-repeat; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.face-bubble.face-tiny { width: 22px; height: 22px; border-width: 1.5px; }
.toast.toast-face { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 7px; }
.toast-sara { border-left-color: #ff8fa3; }
.toast-crew { border-left-color: #ffc04d; }
.toast-sal { border-left-color: #8fd18f; }
#modal-content .log li.log-face { display: flex; align-items: center; gap: 7px; list-style: none; margin-left: -1.1em; }

#toasts .toast-action { pointer-events: auto; cursor: pointer; }
#toasts .toast-action:hover, #toasts .toast-action:focus-visible { filter: brightness(1.15); outline: none; }
.toast-tip { border-left-color: var(--rs-lime); background: rgba(16, 52, 38, 0.96); box-shadow: 0 0 0 1px rgba(199, 236, 100, 0.35), 0 3px 10px rgba(0, 0, 0, 0.35); }
#modal-content .log li.log-action { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
@keyframes rs-flash { 0% { box-shadow: 0 0 0 3px rgba(199, 236, 100, 0.8); } 100% { box-shadow: 0 0 0 0 rgba(199, 236, 100, 0); } }
#modal-content .flash { animation: rs-flash 1.6s ease-out 1; border-radius: 10px; }

#modal-content .staff-wide { margin: 10px 0; padding: 12px 14px; }
#modal-content .staff-wide .staff-profile { gap: 12px; }
#modal-content .staff-wide .staff-profile .small-btn { margin-left: auto; }
.face-bubble.face-large { width: 56px; height: 56px; border-width: 2px; }
#modal-content .staff-settings { display: grid; gap: 8px; margin: 8px 0 4px; }
#modal-content .staff-settings label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.92em; color: var(--rs-paper); }
#modal-content .staff-settings label.check { justify-content: flex-start; }
#modal-content .staff-settings select { font: inherit; font-size: 0.95em; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--rs-line); background: #0f3a4f; color: var(--rs-paper); margin: 0; }
#modal-content .staff-settings input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--rs-lime); margin: 0; }
#modal-content .staff-card:not(.hired) .staff-settings { opacity: 0.6; }
#modal-content .staff-wide .staff-profile .small-btn { white-space: nowrap; }

#toasts { top: 10px; bottom: auto; }

#feed {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  background: #071a26;
  border-top: 2px solid var(--rs-line);
  z-index: 10;
}
#feed .feed-head { display: flex; align-items: center; gap: 8px; padding: 3px 12px 2px; min-height: 26px; font-size: 0.74rem; color: var(--rs-muted); text-transform: uppercase; letter-spacing: 0.06em; }
#feed .feed-head strong { color: var(--rs-paper); font-weight: 800; }
#feed .feed-spacer { flex: 1 1 auto; }
#feed .feed-head button {
  margin: 0;
  height: 22px;
  padding: 0 9px;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--rs-paper) !important;
  background: #0f3a4f !important;
  border: 1px solid var(--rs-line);
  border-radius: 11px;
  box-shadow: none;
  cursor: pointer;
}
#feed .feed-head button:hover { border-color: var(--rs-lime); }
#feed .feed-head .feed-new { background: var(--rs-lime) !important; color: var(--rs-ink) !important; border-color: var(--rs-lime); }
#feed .feed-head .feed-new[hidden] { display: none; }
#feed .feed-head { gap: 6px; }
#feed .game-menu { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
#feed .feed-head .game-menu button { height: 24px; padding: 0 10px; font-size: 0.74rem; border-radius: 7px; background: #123f56 !important; }
#feed .feed-head .game-menu .menu-round { width: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
#feed .feed-head .game-menu button[data-action="help"] { border-radius: 50%; }
#feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { display: inline-flex; align-items: center; gap: 4px; }
#feed .feed-head #feed-filter[aria-pressed="true"] { border-color: #5f8aa0; }
#feed .feed-ico { flex: 0 0 auto; }
#feed .feed-head button { flex: 0 0 auto; }
#feed .game-menu { flex: 0 1 auto; min-width: 0; }
#feed .ico-show, #feed.collapsed .ico-hide { display: none; }
#feed .feed-head .game-menu .menu-btn { display: inline-flex; align-items: center; gap: 5px; }
#feed .menu-ico { flex: 0 0 auto; }
#feed .feed-head .game-menu .inbox-btn { position: relative; }
#feed .inbox-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px; background: var(--rs-info); color: #fff; font-size: 0.62rem; font-weight: 900; line-height: 16px; text-align: center; border: 1px solid var(--rs-deep); pointer-events: none; }
#feed .inbox-badge.urgent { background: var(--rs-bad); }
#feed .inbox-badge[hidden] { display: none; }
#feed .feed-head .game-menu .menu-mine { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; color: var(--rs-muted) !important; }
#feed .feed-head .game-menu .menu-mine[aria-pressed="true"] { color: var(--rs-ink) !important; background: var(--rs-lime) !important; border-color: var(--rs-lime); }
#feed .feed-head .game-menu .hud-rival { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 2px; border-radius: 12px; font-size: 0.74rem; font-weight: 600; color: var(--rs-muted) !important; background: transparent !important; border-color: #3b2a55; }
#feed .feed-head .game-menu .hud-rival.active { color: #ecd9ff !important; background: #261640 !important; border-color: #c77dff; }
#feed .hud-rival strong { color: #ecd9ff; }
#feed .hud-rival .good { color: var(--rs-good); }
#feed .hud-rival .brock-tiny { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #c77dff; }
#feed.collapsed .ico-show { display: block; }
#feed-list {
  list-style: none;
  margin: 0;
  padding: 0 8px 6px;
  height: 112px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2b5468 transparent;
}
#feed.collapsed #feed-list { height: 30px; overflow: hidden; padding-bottom: 0; }
#feed.collapsed #feed-list .feed-item { height: 26px; }
#feed.collapsed #feed-list .feed-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#feed.collapsed #feed-list .feed-item:not(:last-child) { display: none; }
#feed .feed-item { display: flex; align-items: center; gap: 8px; margin: 0; padding: 2px 6px; border-radius: 6px; font-size: 0.82rem; line-height: 1.35; color: var(--rs-paper); }
#feed .feed-item[data-action] { cursor: pointer; }
#feed .feed-item[data-action]:hover { background: rgba(255, 255, 255, 0.06); }
#feed .feed-item .feed-text { flex: 1 1 auto; min-width: 0; }
#feed .feed-item .feed-date { flex: 0 0 auto; font-size: 0.68rem; color: #6f93a6; white-space: nowrap; }
#feed .feed-dot { flex: 0 0 auto; width: 8px; height: 8px; margin: 0 7px; border-radius: 50%; background: var(--rs-muted); }
#feed .kind-good .feed-dot { background: var(--rs-good); }
#feed .kind-bad .feed-dot { background: var(--rs-bad); }
#feed .kind-bad .feed-text { color: #ffc2c2; }
#feed .kind-good .feed-text { color: #c9f5d8; }
#feed .kind-rival .feed-text { color: #e2c7ff; }
#feed .kind-tip { background: rgba(199, 236, 100, 0.08); }
#feed .kind-tip .feed-text { color: #e9f8b8; text-decoration: underline dotted; text-underline-offset: 3px; }
#feed .is-quiet { opacity: 0.72; }
#feed .feed-item .face-bubble.face-tiny { width: 22px; height: 22px; }

@media (max-width: 980px) {
  #feed-list { height: 84px; }
  #feed .feed-item { font-size: 0.76rem; }
  #feed .feed-item .feed-date { display: none; }
}

#game-container.is-fullscreen { height: 100vh !important; height: 100dvh !important; min-height: 0; }
#game-container.is-fullscreen #modal-overlay { top: 0; bottom: 0; }
#game-container.is-fullscreen #modal-box { max-height: calc(100dvh - 32px); }

@media (max-height: 560px) {
  #feed-list { height: 72px; }
  #feed .feed-head { min-height: 22px; padding-top: 1px; padding-bottom: 1px; }
}

@media (max-width: 760px) {
  #feed .feed-head { padding: 4px 8px 3px; gap: 5px; }
  #feed .feed-title, #feed #feed-filter-label, #feed #feed-toggle-label, #feed .game-menu .lbl, #feed .mine-label, #feed .hud-rival span { display: none; }
  #feed .game-menu { margin-left: 0; gap: 5px; }
  #feed .feed-head .game-menu .menu-btn, #feed .feed-head .game-menu .menu-round, #feed .feed-head .game-menu .menu-mine, #feed .feed-head .game-menu .hud-rival,
  #feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { width: 28px; height: 28px; padding: 0; margin-left: 0; justify-content: center; }
  #feed .feed-head .game-menu .menu-btn, #feed .feed-head .game-menu .menu-mine { border-radius: 8px; }
  #feed .feed-head .game-menu .menu-round, #feed .feed-head .game-menu .hud-rival, #feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { border-radius: 50%; }
  #feed .menu-ico { width: 15px; height: 15px; }
  #feed .hud-rival .brock-tiny { width: 22px; height: 22px; }
}

@media (max-width: 380px) {
  #feed .feed-head, #feed .game-menu { gap: 4px; }
  #feed .feed-head .game-menu .menu-btn, #feed .feed-head .game-menu .menu-round, #feed .feed-head .game-menu .menu-mine, #feed .feed-head .game-menu .hud-rival,
  #feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { width: 26px; height: 26px; }
  #feed .hud-rival .brock-tiny { width: 20px; height: 20px; }
}

#modal-content .lot-street { display: flex; align-items: center; gap: 8px; }
#modal-content .link-btn { padding: 0; margin: 0; background: none !important; border: 0; color: #8fd0ff !important; font: inherit; font-size: 0.9em; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#modal-content .link-btn:hover { color: var(--rs-lime) !important; }
#modal-content .road-list { list-style: none; margin: 0.8em 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#modal-content .road { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--rs-line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
#modal-content .road.editing { border-color: var(--rs-lime); }
#modal-content .road-name { min-width: 0; }
#modal-content .road-name .muted { font-size: 0.82em; }
#modal-content .road-edit { flex: 1 1 100%; }
#modal-content .road-edit input { width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; color: var(--rs-paper); background: #082b3d; border: 1px solid var(--rs-line); border-radius: 8px; }
#modal-content .road-edit input:focus { outline: none; border-color: var(--rs-lime); }
#modal-content .road-edit .modal-buttons { margin-top: 8px; }
#modal-content p.good { color: var(--rs-good) !important; }
#modal-content p.bad { color: var(--rs-bad) !important; }

@media (max-width: 420px) {
  #feed .feed-head, #feed .game-menu { gap: 4px; }
  #feed .feed-head .game-menu .menu-btn, #feed .feed-head .game-menu .menu-round, #feed .feed-head .game-menu .menu-mine, #feed .feed-head .game-menu .hud-rival,
  #feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { width: 26px; height: 26px; }
}

@media (max-width: 380px) {
  #feed .feed-head, #feed .game-menu { gap: 3px; }
  #feed .feed-head .game-menu .menu-btn, #feed .feed-head .game-menu .menu-round, #feed .feed-head .game-menu .menu-mine, #feed .feed-head .game-menu .hud-rival,
  #feed .feed-head #feed-filter, #feed .feed-head #feed-toggle { width: 24px; height: 24px; }
  #feed .menu-ico { width: 13px; height: 13px; }
  #feed .hud-rival .brock-tiny { width: 18px; height: 18px; }
}

#hud .hud-sound { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px; padding: 0; color: var(--rs-paper) !important; background: #0f3a4f !important; border: 1px solid var(--rs-line); border-radius: 7px; cursor: pointer; }
#hud .hud-sound .snd-off, #hud .hud-sound.muted .snd-on { display: none; }
#hud .hud-sound.muted .snd-off { display: block; }
#hud .hud-sound.muted { color: var(--rs-muted) !important; }
#hud .hud-sound.open { border-color: var(--rs-lime); }

.snd-panel { position: fixed; z-index: 40; width: 270px; padding: 10px 12px 8px; box-sizing: border-box; background: var(--rs-deep); color: var(--rs-paper); border: 1px solid var(--rs-line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); font-size: 0.85rem; }
.snd-panel[hidden] { display: none; }
.snd-panel .snd-row { display: grid; grid-template-columns: 84px 1fr 36px; align-items: center; gap: 8px; margin: 2px 0 6px; }
.snd-panel .snd-toggle { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 800; color: var(--rs-paper); cursor: pointer; }
.snd-panel input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--rs-lime); }
.snd-panel input[type="range"] { width: 100%; margin: 0; accent-color: var(--rs-lime); }
.snd-panel input[type="range"]:disabled { opacity: 0.35; }
.snd-panel .snd-val { font-size: 0.75rem; color: var(--rs-muted); text-align: right; }
.snd-panel .snd-note { margin: 4px 0 0; font-size: 0.72rem; color: var(--rs-muted) !important; line-height: 1.35; }

@media (max-width: 980px), (max-height: 560px) and (pointer: coarse) {
  #hud .hud-sound { width: 28px; height: 26px; }
}
#modal-content .music-credit { margin-top: 1.2em; padding-top: 0.8em; border-top: 1px solid var(--rs-line); font-size: 0.8em; }
#modal-content .music-credit a { color: #8fd0ff !important; }
#modal-content .start-warning { margin: 0.8em 0 0; padding: 8px 12px; border-left: 3px solid var(--rs-bad); border-radius: 6px; background: rgba(255, 107, 107, 0.12); color: #ffd6d6 !important; }
