/* =========================================================================
   OFFICE PONG — Windows XP / mid-90s skin
   Light, beveled, Tahoma. Luna-blue title bars, 3D buttons, gray chrome.
   ========================================================================= */

:root {
  /* Classic Luna control palette */
  --face: #ECE9D8;          /* window/control face */
  --face-2: #F5F4EA;        /* lighter face */
  --hl: #FFFFFF;            /* bevel highlight */
  --shadow: #ACA899;        /* bevel shadow */
  --dshadow: #716F64;       /* dark bevel shadow */
  --ink: #1a1a1a;
  --muted: #5a5a52;

  /* Luna blue title-bar gradient */
  --title-1: #0058E6;
  --title-2: #2A8AF6;
  --title-3: #3F93FF;

  /* Player colors — saturated VGA-ish */
  --p1: #1f5fd0;           /* blue worker  */
  --p2: #cf2a2a;           /* red worker   */

  --urgent: #d11d1d;
  --coffee: #9c6b34;
  --reply:  #7a3fb5;
  --gold:   #c8960c;

  --font: Tahoma, "MS Sans Serif", "Segoe UI", Geneva, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: none;
}

/* ---------- The XP "Bliss" desktop ---------- */
#desktop {
  min-height: 100%;
  padding: 24px 16px 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background:
    linear-gradient(180deg,
      #4d90e0 0%,
      #6aa8e8 30%,
      #9ccbf2 55%,
      #cfe8c2 70%,
      #7fb35a 78%,
      #5e9438 100%);
}

/* ---------- Window frame ---------- */
#window {
  width: 100%;
  max-width: 1000px;
  background: var(--face);
  border: 1px solid #0046b8;
  border-radius: 8px 8px 0 0;
  box-shadow: 3px 3px 10px rgba(0,0,0,.45);
  overflow: hidden;
}

/* Title bar */
.titlebar {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 6px;
  background: linear-gradient(180deg, var(--title-2) 0%, var(--title-1) 8%, var(--title-1) 40%, var(--title-3) 92%, #1d6fe0 100%);
  border-radius: 7px 7px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.titlebar-left { display: flex; align-items: center; gap: 6px; }
.titlebar-icon { font-size: 15px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.3)); }
.titlebar-text {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 1px 1px 1px rgba(0,0,0,.45);
}

.titlebar-buttons { display: flex; gap: 2px; }
.tb-btn {
  width: 22px; height: 21px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #5aa0f5, #1c64dd);
  border: 1px solid #103e9c;
  border-top-color: #cfe4ff;
  border-left-color: #9fc6ff;
  border-radius: 3px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.5);
  padding: 0;
}
.tb-btn:hover { filter: brightness(1.12); }
.tb-btn:active { filter: brightness(.9); }
.tb-btn.close { background: linear-gradient(180deg, #f78a6a, #d6431f); border-color: #9c2a10; }
/* glyphs drawn with small boxes/lines */
.g-min { width: 8px; height: 2px; background: #fff; margin-top: 6px; box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.g-max { width: 9px; height: 8px; border: 1.5px solid #fff; border-top-width: 3px; }
.g-close { width: 10px; height: 10px; position: relative; }
.g-close::before, .g-close::after {
  content: ""; position: absolute; left: 4px; top: -1px;
  width: 2px; height: 12px; background: #fff; border-radius: 1px;
}
.g-close::before { transform: rotate(45deg); }
.g-close::after { transform: rotate(-45deg); }

/* Menu bar */
.menubar {
  display: flex;
  gap: 2px;
  padding: 2px 4px;
  background: var(--face);
  border-bottom: 1px solid var(--shadow);
  font-size: 12px;
}
.menubar span { padding: 2px 8px; cursor: default; }
.menubar > span:hover { background: var(--title-1); color: #fff; }
.menu-spacer { flex: 1; }
.menu-spacer:hover { background: none !important; }
.snd-toggle { cursor: pointer; user-select: none; }
.lang-opt { cursor: pointer; user-select: none; font-size: 11px; }
.lang-opt.active { background: var(--title-1); color: #fff; }

/* dropdown menus */
.menu-item { position: relative; }
.menu-label { padding: 2px 8px; cursor: default; user-select: none; display: inline-block; }
.menu-item.open .menu-label, .menu-label:hover { background: var(--title-1); color: #fff; }
.dropdown {
  display: none;
  position: absolute; top: 100%; left: 0; z-index: 1000;
  min-width: 190px;
  background: var(--face);
  border: 2px solid var(--hl);
  border-right-color: var(--dshadow); border-bottom-color: var(--dshadow);
  box-shadow: 2px 2px 7px rgba(0,0,0,.45);
  padding: 2px;
}
.menu-item.open .dropdown { display: block; }
.dd-item {
  padding: 4px 18px 4px 22px;
  font-size: 12px; cursor: default; white-space: nowrap; position: relative;
}
.dd-item:hover { background: var(--title-1); color: #fff; }
.dd-item.checked::before { content: "✓"; position: absolute; left: 7px; }

/* dialog button row */
.dlg-buttons { display: flex; gap: 10px; justify-content: center; }
.overlay-box h1.hamster-msg { font-size: 30px; line-height: 1.35; margin: 14px 4px 22px; }
.overlay-box h1.notice-title { font-size: 26px; line-height: 1.3; margin: 8px 4px 14px; }
.notice-body {
  font-size: 14px; line-height: 1.6; color: var(--ink);
  max-width: 480px; margin: 0 auto 20px; text-align: left;
}
.notice-body ul { list-style: none; padding: 0; }
.notice-body li { padding: 3px 0 3px 4px; }
button.secondary {
  color: var(--ink);
  background: linear-gradient(180deg, var(--face-2), var(--face));
}

/* Status bar */
.statusbar {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--face);
  border-top: 1px solid var(--hl);
}
.sb-cell {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--shadow);
  border-right-color: var(--hl);
  border-bottom-color: var(--hl);
  background: var(--face);
}
.sb-grow { flex: 1; }

/* ---------- App body ---------- */
#app {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--face);
}

/* Bevel helpers (sunken / raised) */
.sunken {
  border: 2px solid var(--shadow);
  border-top-color: var(--dshadow);
  border-left-color: var(--dshadow);
  border-right-color: var(--hl);
  border-bottom-color: var(--hl);
}

/* ---------- HUD ---------- */
#hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

/* compact octagon HUD cells */
.hud-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--face);
  padding: 6px 12px;
  border: 2px solid var(--hl);
  border-right-color: var(--dshadow);
  border-bottom-color: var(--dshadow);
}
.hud-cell.hud-right { text-align: right; }
.hud-k { font-size: 11px; color: var(--muted); }
.hud-k #yourTitle { color: var(--p1); font-weight: 700; }
.hud-v { font-size: 22px; font-weight: 800; color: #0a3a8a; font-variant-numeric: tabular-nums; }
.hud-v.hud-warn { color: #b00000; }
.online-soon { color: var(--reply); font-weight: 700; }

.player-card {
  background: var(--face);
  padding: 8px 12px;
  border: 2px solid var(--hl);
  border-right-color: var(--dshadow);
  border-bottom-color: var(--dshadow);
}
#card-p2 { text-align: right; }

.player-card .title {
  font-size: 18px;
  font-weight: 700;
}
#card-p1 .title { color: var(--p1); }
#card-p2 .title { color: var(--p2); }

.player-card .name { font-size: 11.5px; color: var(--muted); margin: 1px 0 8px; }
.player-card .keys { color: var(--ink); font-weight: 700; }

.ladder {
  height: 16px;
  background: var(--hl);
  border: 2px solid var(--shadow);
  border-top-color: var(--dshadow);
  border-left-color: var(--dshadow);
  border-right-color: var(--hl);
  border-bottom-color: var(--hl);
  padding: 1px;
  overflow: hidden;
}
/* segmented "loading bar" fill */
.ladder-fill {
  height: 100%;
  width: 0%;
  transition: width .3s steps(8);
  background-image: repeating-linear-gradient(90deg,
      currentColor 0, currentColor 7px, var(--hl) 7px, var(--hl) 9px);
}
#ladder-p1 { color: var(--p1); }
#ladder-p2 { color: var(--p2); margin-left: auto; }

/* caffeine meter */
.caff-row { margin-top: 6px; }
.caff-label { font-size: 10.5px; color: var(--coffee); font-weight: 700; display: block; margin-bottom: 2px; }
.caff-num { letter-spacing: -1px; }
.caff-meter {
  height: 12px;
  background: var(--hl);
  border: 2px solid var(--shadow);
  border-top-color: var(--dshadow); border-left-color: var(--dshadow);
  border-right-color: var(--hl); border-bottom-color: var(--hl);
  padding: 1px;
  overflow: hidden;
}
.caff-fill {
  height: 100%;
  width: 0%;
  transition: width .12s linear;
  background-image: repeating-linear-gradient(90deg,
      #b5803f 0, #b5803f 6px, #8a5e29 6px, #8a5e29 8px);
}
#card-p2 .caff-fill { margin-left: auto; }

.center-hud {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px 14px; min-width: 130px;
}
.center-hud .score {
  font-size: 26px; font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  color: #0a3a8a;
}
.center-hud .status {
  font-size: 11.5px; color: var(--muted);
  margin-top: 3px; text-align: center; min-height: 15px;
}
.center-hud .spam {
  font-size: 11px; font-weight: 700; color: #0a8a8a;
  margin-top: 2px; text-align: center; min-height: 14px;
}
.center-hud .spam.hr { color: #b0008a; }

/* ---------- Stage ---------- */
#stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  border: 2px solid var(--shadow);
  border-top-color: var(--dshadow);
  border-left-color: var(--dshadow);
  border-right-color: var(--hl);
  border-bottom-color: var(--hl);
}
#game {
  display: block;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  touch-action: none;          /* swipes move the paddle, not the page */
}

/* ---------- Overlays as XP dialogs ---------- */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 70, 120, .35);
  padding: 16px; text-align: center; z-index: 5;
}
.overlay.transparent { background: rgba(40, 70, 120, .25); }
.overlay.hidden { display: none; }

.overlay-box {
  width: min(640px, 100%);
  background: var(--face);
  border: 1px solid #0046b8;
  border-radius: 7px 7px 0 0;
  box-shadow: 3px 3px 9px rgba(0,0,0,.5);
  overflow: hidden;
  animation: pop .14s steps(3);
}
.overlay-box.small { width: min(380px, 100%); }

@keyframes pop { from { transform: scale(.96); } to { transform: scale(1); } }

.dlg-title {
  display: flex; align-items: center; justify-content: space-between;
  height: 26px; padding: 0 6px;
  background: linear-gradient(180deg, var(--title-2), var(--title-1) 45%, var(--title-3));
  color: #fff; font-weight: 700; font-size: 12.5px;
  text-shadow: 1px 1px 1px rgba(0,0,0,.4);
}
.dlg-x {
  width: 18px; height: 16px; line-height: 14px;
  background: linear-gradient(180deg, #f78a6a, #d6431f);
  border: 1px solid #9c2a10; border-radius: 3px;
  font-size: 11px; color: #fff;
}

.dlg-body { padding: 18px 22px 22px; }

.overlay-box h1 { font-size: 22px; margin-bottom: 10px; color: #0a3a8a; }
.tagline { color: var(--ink); line-height: 1.5; font-size: 13px; margin-bottom: 14px; }
.tagline em { font-style: italic; font-weight: 700; }
.tagline strong { color: #9a6b00; }

/* how-to + rules */
.how-to { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.how-to > div {
  flex: 1; max-width: 220px; padding: 8px 14px;
  background: var(--face);
  border: 2px solid var(--shadow);
  border-top-color: var(--dshadow); border-left-color: var(--dshadow);
  border-right-color: var(--hl); border-bottom-color: var(--hl);
}
.how-to h3 { font-size: 12px; color: var(--p1); margin-bottom: 4px; }
.how-to p { font-size: 12px; color: var(--muted); }

.rules {
  list-style: none; text-align: left; font-size: 12px;
  color: var(--muted); line-height: 1.6; margin: 0 auto 12px; max-width: 540px;
}
.rules li { padding-left: 18px; position: relative; }
.rules li::before { content: "›"; position: absolute; left: 3px; color: var(--p1); font-weight: 800; }
.rules strong { color: var(--ink); }

.pu {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border: 1px solid rgba(0,0,0,.4);
  letter-spacing: .3px; vertical-align: middle; color: #fff;
}
.pu.urgent { background: var(--urgent); }
.pu.coffee { background: var(--coffee); }
.pu.reply  { background: var(--reply); }
.pu.chef   { background: #2a7a3a; }
.pu.ooo    { background: #1e7fb0; }

/* ---------- Classic 3D buttons ---------- */
button {
  font: inherit; font-size: 13px; font-weight: 700;
  color: var(--ink);
  background: var(--face);
  border: 2px solid;
  border-top-color: var(--hl);
  border-left-color: var(--hl);
  border-right-color: var(--dshadow);
  border-bottom-color: var(--dshadow);
  padding: 7px 18px;
  cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--face-2), inset -1px -1px 0 var(--shadow);
}
button:hover { background: var(--face-2); }
button:active {
  border-top-color: var(--dshadow); border-left-color: var(--dshadow);
  border-right-color: var(--hl); border-bottom-color: var(--hl);
  box-shadow: inset 1px 1px 0 var(--shadow);
  padding: 8px 17px 6px 19px;
}

/* mode select */
.mode-select { display: flex; gap: 12px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.mode-select button {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 180px; padding: 10px 18px;
}
.mode-select button span { font-size: 10.5px; font-weight: 400; color: var(--muted); }

.difficulty { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.difficulty .diff-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
button.diff { font-size: 12px; padding: 4px 14px; }
button.diff.active {
  color: #fff;
  background: linear-gradient(180deg, var(--title-3), var(--title-1));
  border-top-color: var(--dshadow); border-left-color: var(--dshadow);
  border-right-color: var(--hl); border-bottom-color: var(--hl);
  box-shadow: inset 1px 1px 0 rgba(0,0,0,.25);
}

kbd {
  display: inline-block;
  background: var(--face); color: var(--ink);
  border: 1px solid var(--dshadow);
  border-top-color: var(--hl); border-left-color: var(--hl);
  padding: 0 5px; font-size: 11px; font-family: var(--font);
}
.hint { margin-top: 10px; font-size: 11.5px; color: var(--muted); }

@media (max-width: 620px) {
  .player-card .name { display: none; }
  .player-card .title { font-size: 15px; }
  .center-hud .score { font-size: 20px; }
  .how-to { flex-direction: column; align-items: center; }
}

/* ---------- Touch controls (mobile only) ---------- */
#touchControls { display: none; }
.tc-btn {
  position: absolute; bottom: 12px; width: 58px; height: 58px;
  border-radius: 50%; font-size: 24px; padding: 0; z-index: 4;
  background: linear-gradient(180deg, var(--face-2), var(--face));
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  touch-action: manipulation; opacity: 0.92;
}
#tcSpam { left: 12px; }
#tcHr { right: 12px; }
.tc-btn:active { filter: brightness(.9); }

/* ---------- Mobile / small-screen layout (desktop unaffected) ---------- */
@media (max-width: 760px) {
  #desktop { padding: 6px 4px 18px; }
  #window { border-radius: 6px 6px 0 0; }
  #app { padding: 6px; gap: 6px; }

  .menubar { flex-wrap: wrap; row-gap: 2px; }
  .menu-spacer { flex-basis: 100%; height: 0; }

  #hud { gap: 6px; }
  .hud-cell { padding: 4px 8px; }
  .hud-k { font-size: 10px; }
  .hud-v { font-size: 16px; }
  .center-hud { min-width: 0; padding: 2px 4px; }
  .center-hud .status, .center-hud .spam { font-size: 10px; }

  #touchControls { display: block; }

  /* overlays: scrollable and compact so the menu fits a phone */
  .overlay { align-items: flex-start; overflow-y: auto; padding: 8px; }
  .overlay-box { margin: 4px auto; }
  .dlg-body { padding: 12px 14px 16px; }
  .overlay-box h1 { font-size: 18px; }
  .overlay-box h1.hamster-msg, .overlay-box h1.notice-title { font-size: 20px; }
  .tagline { font-size: 12px; }
  .rules { font-size: 11px; }
  .how-to { flex-direction: column; align-items: stretch; }
  .how-to > div { max-width: none; }
  .notice-body { font-size: 12px; }
}
