/* Tool pages (/spacebar-test/, /spacebar-counter/, /cps-test/) laid out like
   the game's own screen: logo + side windows on the left, the big green
   number, a 98.css window and the floating Spacebar key with the pointing
   hand in the middle, a slot-style panel on the right. Loads after 98.css (copied next to this file) and
   repeats the game's overrides from src/styles/style.css. */

@font-face {
  font-family: 'Super Mario Bros NES';
  src: url('/fonts/Super-Mario-Bros-NES.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --gold: #fff900;
  --text-light: #f7f7fd;
  --boost: #f2360b;
  --hot: #ff8a00;
  --auto: #8e44ad;
  --speed: #077a72;
  --surface: #c0c0c0;
  --surface-button: #ccc;
  --title-from: #000080;
  --title-to: #1084d0;
  --highlight: #000080;
  --accent: #000080;
  --accent-light: #1084d0;
  --text: #222;
  --text2: #555;
  --success: #77c043;

  --fs-xs: 6px;
  --fs-sm: 8px;
  --fs-md: 10px;
  --fs-lg: 13px;
  --fs-xl: 15px;
  --fs-2xl: 20px;
  --fs-3xl: 25px;

  --px: 'Super Mario Bros NES', 'Segoe UI', system-ui, sans-serif;
  --read: Tahoma, 'Segoe UI', Verdana, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--px);
  font-size: var(--fs-sm);
  line-height: 1.5;
  word-spacing: -30%;
  color: var(--text);
  background: #6fa6dd url('/img/bg/bg-3.png') center / cover fixed;
}
img { max-width: 100%; }

/* ---- the game's 98.css overrides ---- */
.title-bar, .title-bar-text, .window, button, input, label, legend, option,
select, table, textarea, .status-bar, li[role="tab"] {
  font-family: var(--px);
}
.window, legend, menu[role=tablist] > li[aria-selected=true], table > thead > tr > *,
.status-field-border { background-color: var(--surface); }
.title-bar { background: linear-gradient(90deg, var(--title-from), var(--title-to)); }
.title-bar-text { margin-left: 8px; }
.title-bar-controls button { min-width: 27px; min-height: 27px; }
.title-bar-controls button[aria-label="Close"] { background-position: center; background-size: 14px; }
.progress-indicator > .progress-indicator-bar { background-color: var(--highlight); }
.progress-indicator.segmented > .progress-indicator-bar {
  background-color: transparent;
  background-image: linear-gradient(90deg, var(--highlight) 16px, transparent 0 2px);
}
button {
  padding: 10px;
  color: var(--text);
  text-shadow: none;
  background-color: var(--surface-button);
  word-spacing: -30%;
  cursor: pointer;
  touch-action: manipulation;
}
button:not(:disabled):active { text-shadow: none; }
button:focus, button:focus-visible, a:focus, summary:focus,
menu[role="tablist"] > li > a:focus { outline: none; }
button[aria-pressed="true"] {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px grey;
  background-image: repeating-conic-gradient(#fff 0% 25%, transparent 0% 50%);
  background-size: 2px 2px;
}
menu[role="tablist"].tabs-98 { flex-wrap: wrap; margin: 0; padding-left: 2px; }
menu[role="tablist"].tabs-98 > li { margin: 0; }
menu[role="tablist"].tabs-98 > li > a {
  padding: 6px 6px 3px;
  font-size: var(--fs-md);
  color: var(--text);
  margin: 0;
  display: block;
  text-decoration: none;
}
menu[role="tablist"].tabs-98 > li[aria-selected=true] { margin: -2px -2px -2px; padding: 0 2px; }


/* ---- screen layout: same three columns as the game ---- */
.screen {
  display: grid;
  grid-template-columns: 2fr 4fr 2fr;
  gap: 16px;
  min-height: calc(100vh - 10px);
  padding: 16px 16px 24px;
}
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-main { align-items: center; }

.logo {
  display: block;
  padding-bottom: 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-light);
  text-decoration: none;
  text-shadow: 2px 2px 0 rgba(0, 0, 50, .35);
}
.logo span { display: inline-block; padding-left: 8px; font-size: 12px; font-weight: 500; opacity: .65; }

/* Big balance-style number */
.balance {
  margin: 20px 0 12px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  pointer-events: none;
}
.amount {
  font-size: calc(var(--fs-3xl) * 1.5);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-shadow: -2px -2px 0 #000, 0 -2px 0 #000, 2px -2px 0 #000, -2px 0 0 #000,
               2px 0 0 #000, -2px 2px 0 #000, 0 2px 0 #000, 2px 2px 0 #000;
  animation: balance-float 5s ease-in-out .5s infinite;
}
.amount.hint {
  font-size: var(--fs-3xl);
  color: var(--text-light);
  text-shadow: none;
  animation: start-hint 1.6s ease-in-out infinite;
}
.amount.hot { color: var(--hot); }
.amount.max { color: var(--boost); }
@keyframes balance-float {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(1px) rotate(-.5deg) scale(1.02); }
  75% { transform: translateY(-2px) rotate(.5deg) scale(1.01); }
}
@keyframes start-hint { 50% { opacity: .55; } }

/* Main tool window (the "My office" spot) */
.tool-window { width: min(560px, 100%); }
.tool-window .window-body { margin: 10px; display: flex; flex-direction: column; gap: 10px; }
.readout {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin: 6px 0 8px;
  font-size: var(--fs-xl);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.readout .click { color: var(--accent); }
.readout .auto { color: var(--auto); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.row .label { color: var(--text2); margin-right: 4px; }
.row button { min-width: 0; }
.row .push { margin-left: auto; }
.row .check { margin-left: auto; display: flex; align-items: center; }

.tabs-wrap .window { margin: 0; padding: 8px 10px; }
.tip { margin: 0; min-height: 3.2em; line-height: 1.6; color: var(--text2); }
.progress-indicator { height: 26px; }
.progress-indicator-bar { transition: width .08s linear; }

/* Spacebar key - copied from the game's SpacebarButton.module.css */
.spacebar-area {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 32px 10px 0;
}
.key {
  width: min(600px, 100%);
  aspect-ratio: 5.15 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: inset -3px -3px #0a0a0a, inset 3px 3px #fff, inset -5px -5px grey, inset 5px 5px #dfdfdf;
  letter-spacing: .35px;
  animation: spacebar-float 5.5s ease-in-out infinite;
}
@keyframes spacebar-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -5px; rotate: .5deg; }
}
.key[data-pressed] {
  box-shadow: inset -2px -2px #fff, inset 2px 2px #0a0a0a, inset -4px -4px #dfdfdf, inset 4px 4px grey;
  color: var(--success);
}
.key .name {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--fs-xl);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
}
.key .booster {
  position: relative;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: var(--fs-md);
  font-weight: 600;
  text-transform: uppercase;
}
.key .track {
  position: absolute;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 14px;
}
.key .hint {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1.3;
  color: var(--text2);
  opacity: .5;
}
.key .hint img { width: 23px; height: 23px; }
.key .corner {
  position: absolute;
  right: 13px;
  bottom: 12px;
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  pointer-events: none;
}
.key.locked { cursor: default; }

/* The game's five-bar gainer meter */
.meter {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  justify-content: space-between;
  gap: 2px;
  padding: 13px 2px 14px 3px;
  pointer-events: none;
}
.meter i {
  flex: 1;
  position: relative;
  width: 10px;
  min-height: 7px;
  background: #dfdfdf;
  box-shadow: inset 1px 1px grey, inset -1px -1px #fff;
  overflow: hidden;
}
.meter i::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 1px;
  height: calc(var(--f, 0) * (100% - 2px));
  background: var(--success);
}
.meter.hot i::after { background: var(--hot); }
.meter.max i::after { background: var(--boost); }
.mult { position: absolute; left: 30px; bottom: 13px; font-size: var(--fs-md); line-height: 1; color: var(--text2); opacity: .5; }
.meter.on ~ .mult { color: var(--success); opacity: 1; }
.meter.hot ~ .mult { color: var(--hot); }
.meter.max ~ .mult { color: var(--boost); }

/* Pointing hand above the key */
.hand {
  position: absolute;
  left: max(4px, calc((100% - min(600px, 100%)) / 2 + 10px));
  top: -18px;
  z-index: 3;
  width: 66px;
  transform: rotate(180deg);
  image-rendering: pixelated;
  animation: cursor-float 2s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}
@keyframes cursor-float { 50% { translate: 0 -8px; } }

.pop {
  position: absolute;
  bottom: 62%;
  z-index: 4;
  font-size: var(--fs-lg);
  color: var(--success);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  pointer-events: none;
  animation: pop .7s ease-out forwards;
}
@keyframes pop { to { transform: translateY(-80px); opacity: 0; } }

/* ---- side windows ---- */
.side .window-body { margin: 8px; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
}
.side-list a img { width: 28px; height: 28px; image-rendering: pixelated; flex-shrink: 0; }
.side-list a:hover, .side-list a:focus-visible, .side-list a[aria-current] { background: var(--highlight); color: #fff; }
.side-list .sep { height: 2px; margin: 3px 2px; box-shadow: inset 0 1px grey, inset 0 -1px #fff; }


/* Right panel: styled like the game's "SLOT #1 - PHONE" upgrades panel */
.slot .window-body { margin: 8px; }
.slot-top { display: grid; grid-template-columns: 116px 1fr; gap: 12px; align-items: start; }
.slot-pic {
  aspect-ratio: 1;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
}
.slot-pic img { width: 78%; height: auto; object-fit: contain; }
.slot-pic .lvl { font-size: var(--fs-sm); color: var(--accent); }
.slot-stats { display: flex; flex-direction: column; gap: 8px; }
.slot-stats .k { display: block; font-size: var(--fs-xs); color: var(--text2); }
.slot-stats .v { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.slot-stats .v.big { font-size: var(--fs-2xl); color: var(--accent); }
.slot-stats .v small { font-size: var(--fs-sm); color: var(--text2); }
fieldset.part-unused { margin: 12px 0 0; padding: 10px 10px 12px; border: 0; box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px grey, inset 2px 2px #fff; }
fieldset.part legend { padding: 0 4px; color: var(--accent); font-size: var(--fs-sm); text-transform: uppercase; }
.part p { margin: 0 0 6px; font-size: var(--fs-sm); line-height: 1.7; }
.part p.verdict { color: var(--speed); }
.badge { display: inline-block; padding: 2px 5px; background: var(--gold); box-shadow: 0 0 0 1px #000; font-size: var(--fs-xs); vertical-align: middle; }
.badge[hidden] { display: none; }
.slot-actions { display: flex; gap: 4px; margin-top: 10px; }
.slot-actions button, .slot-actions a { flex: 1; min-width: 0; padding: 8px 4px; font-size: var(--fs-sm); }
.play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 10px;
  color: #fff;
  text-decoration: none;
  font-size: var(--fs-md);
  text-transform: uppercase;
  background: #1a8a2e;
  box-shadow: inset -1px -1px #0a3d12, inset 1px 1px #8fe0a0, inset -2px -2px #11621f, inset 2px 2px #4cbf62;
}
.play:active { box-shadow: inset 1px 1px #0a3d12, inset -1px -1px #8fe0a0, inset 2px 2px #11621f, inset -2px -2px #4cbf62; }
.play img { width: 20px; height: 20px; }
.slot[data-state="idle"] .when-done { display: none; }
.slot[data-state="done"] .when-idle { display: none; }

/* Counter achievements panel (like the game's Achievements window) */
.ach { list-style: none; margin: 0; padding: 0; background: #fff; box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a; padding: 2px 6px; }
.ach li { display: grid; grid-template-columns: 36px 1fr; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #c9c9c9; }
.ach li:last-child { border-bottom: 0; }
.ach img { width: 30px; height: 30px; image-rendering: pixelated; filter: grayscale(1); opacity: .45; }
.ach li.done img { filter: none; opacity: 1; }
.ach b { display: block; font-weight: 400; font-size: var(--fs-md); }
.ach .meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.ach .bar { flex: 1; height: 10px; background: #fff; box-shadow: inset -1px -1px #fff, inset 1px 1px grey; padding: 2px; }
.ach .bar span { display: block; height: 100%; width: var(--p, 0%); background: var(--highlight); }
.ach .n { font-size: var(--fs-xs); color: var(--text2); white-space: nowrap; }
.ach li.done .n { color: #0a7a2a; }

/* Achievement toast */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px 10px 12px;
  font-size: var(--fs-md);
  line-height: 1.7;
  max-width: calc(100vw - 24px);
  animation: toast-in .25s ease-out;
}
.toast[hidden] { display: none; }
.toast img { width: 32px; height: 32px; }
.toast b { display: block; font-weight: 400; font-size: var(--fs-lg); }
.toast span { color: #0a7a2a; }
@keyframes toast-in { from { transform: translate(-50%, -30px); opacity: 0; } }

/* ---- Notepad article under the screen ---- */
.below { max-width: 820px; margin: 0 auto; padding: 0 12px 40px; }
.notepad .window-body { margin: 0 3px 3px; }
.menu-bar { display: flex; gap: 16px; padding: 4px 6px; font-size: var(--fs-sm); color: #333; user-select: none; }
.menu-bar u { text-decoration-thickness: 1px; }
.paper {
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  padding: 22px 26px 26px;
  font-family: var(--read);
  font-size: 15.5px;
  line-height: 1.65;
  word-spacing: normal;
}
.paper h2, .paper h3 { font-family: var(--px); font-weight: 400; color: var(--accent); line-height: 1.6; word-spacing: -30%; }
.paper h2 { font-size: var(--fs-lg); margin: 2em 0 .7em; text-transform: uppercase; }
.paper h2:first-child { margin-top: 0; }
.paper h3 { font-size: var(--fs-md); margin: 1.5em 0 .4em; }
.paper p { margin: 0 0 1em; }
.paper ul, .paper ol { margin: 0 0 1em; padding-left: 1.3em; }
.paper li { margin-bottom: .35em; }
.paper a { color: #0000c8; }
.paper .table-wrap { overflow-x: auto; margin: 0 0 1.1em; }
.paper table { width: 100%; border-collapse: collapse; font-family: var(--read); font-size: 14.5px; }
.paper th, .paper td { border: 1px solid #9a9a9a; padding: 6px 9px; text-align: left; height: auto; }
.paper th { font-family: var(--px); font-size: var(--fs-sm); font-weight: 400; }
.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 1.6em;
  padding: 12px 14px;
  background: #ffffe1;
  box-shadow: 0 0 0 1px #000;
}
.cta-row p { margin: 0; font-weight: 700; }
.cta-row .play { margin: 0; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .screen { grid-template-columns: 1fr 2fr; }
  .col-left { order: 0; }
  .col-main { order: 1; grid-row: span 2; }
  .col-right { order: 2; }
}
@media (max-width: 768px) {
  .screen { display: flex; flex-direction: column; gap: 12px; padding: 12px 10px calc(24px + var(--taskbar-h)); min-height: 0; }
  .col-left { display: contents; }
  .col-left .logo { order: 0; text-align: center; font-size: 15px; }
  .col-main { order: 1; }
  .col-right { order: 2; }
  .col-left .side { order: 3; }
  .balance { margin: 8px 0 4px; }
  .amount { font-size: calc(var(--fs-2xl) * 1.2); }
  .amount.hint { font-size: var(--fs-2xl); }
  .readout { font-size: var(--fs-md); }
  .key { aspect-ratio: 3.6 / 1; padding: 8px 12px; }
  .paper { padding: 16px 16px 20px; font-size: 15px; }
  .slot-top { grid-template-columns: 96px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .key, .amount, .hand, .pop, .toast { animation: none; }
}

/* The page H1 lives in the tool window's title bar, like a window title. */
h1.title-bar-text { margin: 0 0 0 8px; font-size: var(--fs-md); font-weight: 700; line-height: 1.3; color: #fff; }
.paper .lead { font-family: var(--px); font-size: var(--fs-md); color: var(--text2); word-spacing: -30%; margin-bottom: 1.4em; }

/* Like the game: number at the top, window centered in the free space,
   Spacebar key at the bottom above the taskbar. */
.col-main { min-height: calc(100vh - 40px); }
.col-main .tool-window { margin-top: auto; margin-bottom: auto; }
.col-main .spacebar-area { padding-bottom: 6px; }

@media (max-width: 768px) {
  .col-main { min-height: 0; }
  .col-main .tool-window { margin: 0; }
}


/* ---- Result panel: rank ladder + next goal + earnings hook ---- */
.slot[data-state="done"] .slot-pic img { animation: rank-pop .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes rank-pop { from { transform: scale(.4) rotate(-8deg); opacity: 0; } }
.ranks {
  list-style: none;
  margin: 10px 0 0;
  padding: 2px;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}
.rank {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
}
.rank img { width: 22px; height: 22px; object-fit: contain; }
.rank .rn { text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .rt { color: var(--text2); white-space: nowrap; }
.slot[data-state="done"] .rank { opacity: .4; }
.slot[data-state="done"] .rank.got { opacity: 1; }
.rank.got .rt::after { content: ' \2713'; color: #0a7a2a; }
.rank.cur { background: var(--highlight); color: #fff; }
.rank.cur .rt, .rank.cur .rt::after { color: #fff; }
.next { margin: 8px 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--accent); }
.note { margin: 6px 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--text2); }
.note .verdict { color: var(--speed); }
.slot-actions { margin-top: 8px; }
.play { flex-direction: column; gap: 4px; margin-top: 8px; padding: 8px 10px 9px; }
.play .earn { font-size: var(--fs-sm); color: var(--gold); text-shadow: 1px 1px 0 #0a3d12; }
.play .go { display: flex; align-items: center; gap: 6px; font-size: var(--fs-md); }
.slot[data-state="done"] .play { animation: play-glow 1.6s ease-in-out infinite; }
@keyframes play-glow { 50% { filter: brightness(1.15); } }
.slot-stats [data-el="resultLine"] { font-size: var(--fs-md); line-height: 1.5; }

