/* Best Place to Work Simulator — M1 pixel-beige office aesthetic.
 * Self-contained: no external fonts/images. Pixel look via chunky borders,
 * hard shadows, and a strictly beige palette. Real art lands in M3. */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --beige-0: #f2e8d5;
  --beige-1: #e3d3b7;
  --beige-2: #c9b591;
  --ink: #3a3226;
  --ink-soft: #6b5d48;
  --paper: #faf4e8;
  --rep: #b98029;
  --trust: #5a7d52;
  --san: #9c5a68;
  --danger: #b3402e;
  --px: 4px;
}

body {
  background: #d9c4a0;
  color: var(--ink);
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 26px 16px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
.btn, .audio-btn, .cal-cell { -webkit-user-select: none; user-select: none; }

/* full-bleed background picture, interrupted by the game window */
#scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.scene-svg { width: 100%; height: 100%; display: block; }
#scene.scene-image {
  background-size: cover; background-position: center;
  image-rendering: pixelated; /* keep a real pixel-art asset crisp */
}

/* audio controls, top-right over the scene */
.audio-ctl { position: fixed; top: 14px; right: 14px; z-index: 3; display: flex; gap: 8px; }
.audio-btn {
  position: relative; width: 40px; height: 40px; padding: 7px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--beige-2);
}
.audio-btn svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.audio-btn:hover { background: var(--beige-0); }
.audio-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--beige-2); }
.audio-btn .slash {
  position: absolute; inset: 0; display: none; pointer-events: none;
}
.audio-btn.muted { color: var(--ink-soft); opacity: 0.7; }
.audio-btn.muted .slash { display: block; }
.audio-btn.muted .slash::before {
  content: ""; position: absolute; top: 50%; left: 4px; right: 4px; height: 3px;
  background: var(--danger); transform: rotate(-45deg); transform-origin: center;
}

#game {
  position: relative; z-index: 1;
  width: 100%; max-width: 860px;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; margin-top: 8px;
  background: rgba(58, 50, 38, 0.10);
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(58, 50, 38, 0.35);
}

/* ---- HUD ---- */
.hud {
  background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: 8px 8px 0 var(--beige-2);
  padding: 16px 18px;
}
.bars { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 16px; align-items: end; }
.bar-block { position: relative; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; letter-spacing: 1px; margin-bottom: 5px; }
.bar-value { font-size: 15px; }
.bar {
  height: 20px; background: var(--beige-1);
  border: 3px solid var(--ink); position: relative; overflow: hidden;
}
.bar-fill { height: 100%; width: 50%; transition: width .45s cubic-bezier(.22,.61,.36,1); }
.bar-fill.rep { background: var(--rep); }
.bar-fill.trust { background: var(--trust); }
.bar-fill.san { background: var(--san); }
.bar-goal {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--ink); opacity: .55;
}
.bar-block.low .bar { animation: pulse .8s steps(2) infinite; }
@keyframes pulse { 50% { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger); } }
.delta {
  position: absolute; right: 0; top: -14px; font-size: 11px;
  opacity: 0; pointer-events: none;
}
.delta.show { animation: rise 1.1s steps(6) forwards; }
@keyframes rise { 0% { opacity: 1; transform: translateY(6px);} 100% { opacity: 0; transform: translateY(-10px);} }
.delta.up { color: var(--trust); } .delta.down { color: var(--danger); }

.face { width: 46px; height: 46px; line-height: 0; align-self: center; }
.face .pxicon { width: 100%; height: 100%; }
.pxicon { display: block; image-rendering: pixelated; }
.portrait .pxicon { width: 108px; height: 108px; }
.face.rage { animation: shake .3s steps(2) infinite; }
@keyframes shake { 50% { transform: translateX(2px) rotate(3deg); } }

/* ---- Month bar: bigger, flashier, progress-y ---- */
.calendar { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; margin-top: 16px; }
.cal-cell {
  height: 30px; border: 3px solid var(--ink); background: var(--beige-1);
  font-size: 13px; font-weight: bold; text-align: center; line-height: 24px;
  color: var(--ink-soft); overflow: visible; position: relative;
  transition: background .2s, color .2s, transform .2s;
}
.cal-cell.done { background: var(--trust); color: var(--paper); }
.cal-cell.now {
  background: var(--rep); color: var(--paper); transform: translateY(-3px) scale(1.08);
  box-shadow: 0 4px 0 var(--ink); z-index: 2;
}
.cal-cell.pop { animation: cellpop .5s ease-out; }
@keyframes cellpop { 0% { transform: scale(1); } 40% { transform: scale(1.35) translateY(-6px); } 100% { transform: scale(1); } }

/* firework burst spawned over a passed month */
.fw {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  pointer-events: none; z-index: 6; margin: -5px 0 0 -5px;
  box-shadow: 0 0 6px currentColor;
}
@keyframes fwfly {
  0% { opacity: 1; transform: translate(0,0) scale(1.2); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); }
}
.fw-flash {
  position: absolute; border-radius: 50%; pointer-events: none; z-index: 5;
  border: 3px solid #d9a441; margin: -6px 0 0 -6px;
  box-shadow: 0 0 12px #d9a441;
}
@keyframes fwflash {
  0% { opacity: .9; transform: scale(.2); }
  100% { opacity: 0; transform: scale(2.4); }
}

/* ---- Stage / card ---- */
.stage { min-height: 460px; display: flex; }
.screen {
  flex: 1; background: var(--paper);
  border: var(--px) solid var(--ink);
  box-shadow: 8px 8px 0 var(--beige-2);
  padding: 34px; display: flex; flex-direction: column; align-items: center;
  text-align: center; justify-content: center; gap: 18px;
}
.screen.card { will-change: transform, opacity; }
.screen.card.enter { animation: dealIn .3s cubic-bezier(.22,.61,.36,1) both; }
.screen.card.exit { animation: dealOut .2s cubic-bezier(.55,.06,.68,.19) both; }
@keyframes dealIn { 0% { transform: translateX(70px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes dealOut { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-70px); opacity: 0; } }
.hidden { display: none !important; }

.start h1 { font-size: 42px; letter-spacing: 4px; }
.subtitle { letter-spacing: 7px; font-size: 15px; color: var(--ink-soft); }
.pitch { font-size: 17px; max-width: 520px; line-height: 1.55; }
.fineprint { font-size: 12px; color: var(--ink-soft); font-weight: normal; }

.portrait {
  width: 128px; height: 128px; border: var(--px) solid var(--ink);
  background: var(--beige-1); display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 5px 5px 0 var(--beige-2);
}
.character { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft); }
.description { font-size: 22px; line-height: 1.55; min-height: 96px; max-width: 560px; }
.description::after { content: "▌"; animation: blink 1s steps(1) infinite; }
.description.done::after { content: ""; }
@keyframes blink { 50% { opacity: 0; } }

.choices { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-family: inherit; font-weight: bold; font-size: 16px;
  background: var(--paper); color: var(--ink);
  border: var(--px) solid var(--ink); box-shadow: 5px 5px 0 var(--beige-2);
  padding: 15px 24px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase;
}
.btn:hover { background: var(--beige-0); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--beige-2); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--ink-soft); }
.btn.choice { min-width: 190px; }
.btn:disabled { opacity: .4; cursor: default; }

.gameover h2 { font-size: 32px; letter-spacing: 2px; }
.gameover p { font-size: 18px; line-height: 1.6; max-width: 540px; }
.score { color: var(--ink-soft); font-size: 15px !important; }
.share-card {
  width: 100%; max-width: 480px; border: var(--px) solid var(--ink);
  box-shadow: 5px 5px 0 var(--beige-2); image-rendering: auto;
}
.over-buttons { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.screen.defeat { background: #efdcd3; }

.foot { text-align: center; font-size: 12px; color: var(--paper); font-weight: normal;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7); }

/* ---- Tablet ---- */
@media (max-width: 820px) {
  body { padding: 16px 10px; }
  #game { max-width: 100%; }
}

/* ---- Phone ---- */
@media (max-width: 600px) {
  body { padding: 50px 6px 10px; align-items: stretch; }
  #game { padding: 8px; gap: 10px; box-shadow: 0 8px 24px rgba(58,50,38,0.35); }
  .hud { padding: 12px 12px; box-shadow: 5px 5px 0 var(--beige-2); }
  .bars { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .face { display: none; }
  .bar-label { font-size: 9px; letter-spacing: 0; }
  .bar-value { font-size: 12px; }
  .bar { height: 16px; border-width: 2px; }
  .calendar { gap: 3px; margin-top: 12px; }
  .cal-cell { height: 26px; font-size: 11px; line-height: 20px; border-width: 2px; }
  .stage { min-height: 0; }
  .screen { padding: 22px 16px; box-shadow: 5px 5px 0 var(--beige-2); gap: 14px; }
  .start h1 { font-size: 28px; letter-spacing: 2px; }
  .subtitle { font-size: 12px; letter-spacing: 4px; }
  .pitch { font-size: 15px; }
  .portrait { width: 92px; height: 92px; }
  .portrait .pxicon { width: 78px; height: 78px; }
  .character { font-size: 12px; }
  .description { font-size: 18px; min-height: 72px; }
  .choices { flex-direction: column; width: 100%; gap: 12px; }
  .btn.choice { min-width: 0; width: 100%; }
  .btn { font-size: 15px; padding: 14px 18px; box-shadow: 4px 4px 0 var(--beige-2); }
  .gameover h2 { font-size: 26px; }
  .gameover p { font-size: 16px; }
  .share-card { max-width: 100%; }
  .over-buttons { flex-direction: column; width: 100%; }
  .over-buttons .btn { width: 100%; }
  .audio-ctl { top: 8px; right: 8px; gap: 6px; }
  .audio-btn { width: 34px; height: 34px; padding: 6px; }
}

/* ---- Small phone ---- */
@media (max-width: 380px) {
  .bar-label { font-size: 8px; }
  .bar-value { font-size: 11px; }
  .cal-cell { font-size: 9px; height: 22px; line-height: 16px; }
  .start h1 { font-size: 23px; }
  .pitch { font-size: 14px; }
  .description { font-size: 16px; }
}
