/* The 9-to-5 — Office Life Simulator
   Warm-neutral top-down office. Light and dark themes, reduced-motion aware. */

:root {
  color-scheme: light dark;

  /* shell */
  --bg: #EFE6D8;
  --bg-2: #E4D8C6;
  --ink: #34302B;
  --ink-2: #6F675D;
  --line: #CDBFA9;
  --card: #FBF6EE;
  --card-2: #F3EADC;

  /* office */
  --outside: #DCD0BD;
  --wall: #B7A68C;
  --doorframe: #CBBBA1;
  --seam: rgba(120, 100, 74, 0.13);
  --mat: #A9977C;

  --fl-reception: #F4E9D6;
  --fl-open: #F0E5D2;
  --fl-meeting: #EBE0CC;
  --fl-kitchen: #F5EBD9;
  --fl-exec: #E9DCC7;
  --fl-hr: #F2E7D4;
  --fl-sales: #EEE3D0;
  --fl-storage: #E6DAC6;

  --wood: #C9A87C;
  --wood-dark: #A9875D;
  --counter: #D7BC93;
  --charcoal: #3E3833;
  --metal: #8E8478;
  --sink: #6E655B;
  --fridge: #D6D0C4;
  --screen: #6C7A82;
  --screen-blue: #4A6E93;
  --screen-green: #4E8062;
  --paper: #FAF6EE;
  --paper-line: #C8BDAB;
  --board: #F7F3EA;
  --board-ink: #A2937D;
  --sofa: #6E6259;
  --sofa-2: #857569;
  --plant: #6E8B58;
  --pot: #A97C57;
  --rug: #D8C7AD;
  --book: #B08A63;
  --crate: #C29C6E;
  --shadow: rgba(74, 56, 34, 0.17);
  --steam: rgba(255, 255, 255, 0.72);
  --beam: rgba(255, 240, 190, 0.42);
  --lens-off: #5A5249;
  --lens-on: #FFE9A3;
  --led-off: #5A5249;
  --led-on: #7BC96F;
  --led-bad: #E0574A;
  --tick-off: #DDD2BE;
  --tick-on: #4E8062;
  --cup: #FAF6EE;
  --coffee: #6B4327;
  --tool: #C0562F;
  --lanyard: #2F5D46;
  --cap: #B4491F;
  --cap-brim: #8E3714;
  --pack: #7A5C3E;
  --pack-2: #5E462F;

  /* people */
  --ac-alex: #3E7FD0;   --ac-alex-d: #2F63A6;
  --ac-sam: #2F9E6B;    --ac-sam-d: #237A52;
  --ac-jordan: #E0A128; --ac-jordan-d: #B67F17;
  --ac-riley: #E2762C;  --ac-riley-d: #B45A1D;
  --ac-casey: #E8C33C;  --ac-casey-d: #BE9C22;

  --skin-1: #E9B98F; --skin-1d: #D3A075;
  --skin-2: #C48A5C; --skin-2d: #AB7248;
  --skin-3: #F0CBA6; --skin-3d: #D9B189;
  --skin-4: #8D5F3C; --skin-4d: #74492B;
  --skin-5: #D8A579; --skin-5d: #BE8B60;
  --hair-1: #3A2E26;
  --hair-2: #241E1A;
  --hair-3: #6B3E22;
  --hair-5: #C1802F;

  --focus: #2F63A6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191612;
    --bg-2: #221E19;
    --ink: #EDE3D3;
    --ink-2: #A6998A;
    --line: #3B342C;
    --card: #241F19;
    --card-2: #2C261F;

    --outside: #13110E;
    --wall: #4A4034;
    --doorframe: #5A4E3F;
    --seam: rgba(255, 240, 210, 0.06);
    --mat: #3B3327;

    --fl-reception: #33291F;
    --fl-open: #302720;
    --fl-meeting: #2C241D;
    --fl-kitchen: #352B21;
    --fl-exec: #2A221B;
    --fl-hr: #322820;
    --fl-sales: #2E261E;
    --fl-storage: #272019;

    --wood: #7A6142;
    --wood-dark: #5E4A31;
    --counter: #836B48;
    --charcoal: #201C18;
    --metal: #574F45;
    --sink: #3B352E;
    --fridge: #4B463D;
    --screen: #3E4C55;
    --screen-blue: #2E4C69;
    --screen-green: #2C5340;
    --paper: #D8CFC0;
    --paper-line: #8A8071;
    --board: #D3CABA;
    --board-ink: #6E6355;
    --sofa: #40382F;
    --sofa-2: #4E4438;
    --plant: #46603A;
    --pot: #6B4E36;
    --rug: #3B3125;
    --book: #6C5539;
    --crate: #7A6042;
    --shadow: rgba(0, 0, 0, 0.42);
    --steam: rgba(255, 255, 255, 0.38);
    --beam: rgba(255, 231, 160, 0.24);
    --tick-off: #3B342C;

    --focus: #8FB6E6;
  }
}

/* ---------------- shell ---------------- */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px;
}

#office {
  width: 100%;
  height: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- HUD ---------------- */
#hud {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 148px;
  padding: 9px 11px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(60, 44, 24, 0.12);
  font-variant-numeric: tabular-nums;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 1.5px 0;
}

.hud-k { color: var(--ink-2); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.hud-v { font-weight: 650; font-size: 13px; }

/* ---------------- side panel ---------------- */
#panel {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 214px;
  padding: 9px 11px 11px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(60, 44, 24, 0.12);
}

.pan-title {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 6px 0 4px;
}
.pan-title:first-child { margin-top: 0; }

#roster, #resources {
  list-style: none;
  margin: 0;
  padding: 0;
}

#roster li {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 6px;
  align-items: start;
  padding: 2px 0;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 4px;
}

.r-name { font-size: 11.5px; font-weight: 650; }
.r-task { font-size: 10.5px; color: var(--ink-2); }
.r-task.blocked { color: var(--led-bad); }

#resources li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  padding: 1.5px 0;
}
.res-k { color: var(--ink-2); }
.res-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.res-v.on { color: var(--tick-on); }
.res-v.bad { color: var(--led-bad); }

#phase-note {
  margin: 0;
  font-size: 10.5px;
  color: var(--ink-2);
}

#pause-badge {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--charcoal);
  color: #F6EFE3;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------------- day end panel ---------------- */
#day-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, 76vw);
  padding: 18px 20px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(40, 28, 14, 0.3);
  text-align: center;
}

#day-headline { margin: 0 0 10px; font-size: 16px; }

#day-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  text-align: left;
}
#day-list li {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
  border-bottom: 1px solid var(--line);
}
#day-list li span:last-child { font-variant-numeric: tabular-nums; font-weight: 650; }

#day-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
#day-bar-fill {
  height: 100%;
  width: 0;
  background: var(--ac-sam);
}
.day-sub { margin: 8px 0 0; font-size: 11px; color: var(--ink-2); }

/* ---------------- control bar ---------------- */
#bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: var(--card-2);
  border-top: 1px solid var(--line);
}

.bar-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .01em; }
.bar-hint { font-size: 11px; color: var(--ink-2); }
.bar-right { display: flex; gap: 10px; }

.ctl {
  font: inherit;
  font-weight: 620;
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 15px;
  cursor: pointer;
}
.ctl:hover { background: var(--bg-2); }
.ctl:active { transform: translateY(1px); }
.ctl:focus-visible,
#office:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---------------- office art ---------------- */
.sh { fill: var(--shadow); }

.zlabel {
  fill: var(--ink);
  opacity: .34;
  font-size: 9px;
  letter-spacing: .16em;
  font-weight: 700;
  text-anchor: middle;
}

.mchair {
  fill: var(--charcoal);
  opacity: .3;
}
#meeting-chairs.ready .mchair { opacity: 1; }

#proj-beam { opacity: 0; }
#office.proj-on #proj-beam { opacity: 1; animation: beam 2.4s ease-in-out infinite alternate; }
@keyframes beam { from { opacity: .55; } to { opacity: 1; } }

#coffee-steam { opacity: 0; }
#office.brewing #coffee-steam { opacity: 1; animation: steam 1.5s ease-in-out infinite; }
@keyframes steam {
  0%   { opacity: 0; transform: translateY(0); }
  40%  { opacity: .9; }
  100% { opacity: 0; transform: translateY(-7px); }
}
#coffee-steam { transform-box: fill-box; transform-origin: center; }

.tick { fill: var(--tick-off); }
.tick.lit { fill: var(--tick-on); }

#printer-led.busy { fill: var(--led-on); }
#printer-led.broken { fill: var(--led-bad); animation: blink .45s steps(2) infinite; }
#printer-out.flash { opacity: 1; animation: blink .18s steps(2) 6; }
@keyframes blink { 50% { opacity: .18; } }

.amb-plant { animation: leaf 5.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes leaf { from { transform: scale(1); } to { transform: scale(1.05); } }

/* ---------------- characters ---------------- */
.char { pointer-events: none; }

.ch-shadow { fill: var(--shadow); }

.ch-ring {
  fill: none;
  stroke-width: 1.6;
  opacity: .5;
}

.ch-glow {
  fill: none;
  stroke: var(--led-bad);
  stroke-width: 2;
  opacity: 0;
}
.char.urgent .ch-glow { opacity: 1; animation: glow .62s ease-in-out infinite alternate; }
@keyframes glow {
  from { opacity: .25; stroke-width: 1.4; }
  to   { opacity: .95; stroke-width: 3.2; }
}

.ch-body, .arm {
  transform-box: fill-box;
  transform-origin: center;
}

.ch-name {
  fill: var(--ink);
  opacity: .62;
  font-size: 7.5px;
  font-weight: 650;
  text-anchor: middle;
}

.ch-yawn {
  fill: var(--ink);
  opacity: 0;
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
}
.char.yawning .ch-yawn { animation: zzz .85s ease-out; }
@keyframes zzz {
  from { opacity: 0; transform: translate(0, 0) scale(.7); }
  40%  { opacity: .9; }
  to   { opacity: 0; transform: translate(4px, -8px) scale(1.2); }
}
.ch-yawn { transform-box: fill-box; transform-origin: center; }

.ch-bubble { opacity: 0; }
.char.blocked .ch-bubble { opacity: 1; }
.ch-bubble rect, .ch-bubble path { fill: var(--card); stroke: var(--line); stroke-width: 1; }
.bub-t {
  fill: var(--ink);
  font-size: 6.8px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-anchor: middle;
}

.it { display: none; }
.ch-item[data-item="cup"]   .it-cup   { display: block; }
.ch-item[data-item="tool"]  .it-tool  { display: block; }
.ch-item[data-item="paper"] .it-paper { display: block; }
.ch-item[data-item="box"]   .it-box   { display: block; }
.ch-item[data-item="phone"] .it-phone { display: block; }

/* animation vocabulary — exactly one state at a time */
.a-walk { animation: bob .32s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-1px) scaleX(1); } to { transform: translateY(1px) scaleX(1.05); } }
.a-walk .arm-l { animation: swl .32s ease-in-out infinite alternate; }
.a-walk .arm-r { animation: swr .32s ease-in-out infinite alternate; }
@keyframes swl { from { transform: translateY(-1.5px); } to { transform: translateY(1.5px); } }
@keyframes swr { from { transform: translateY(1.5px); } to { transform: translateY(-1.5px); } }

.a-sit { }

.a-type { animation: typ .22s ease-in-out infinite alternate; }
@keyframes typ { from { transform: translateY(0); } to { transform: translateY(.95px); } }
.a-type .arm-l { animation: swl .16s ease-in-out infinite alternate; }
.a-type .arm-r { animation: swr .19s ease-in-out infinite alternate; }

.a-talk { animation: talk .5s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scale(1); } to { transform: scale(1.075); } }

.a-wait { animation: sway 1.45s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-3.5deg); } to { transform: rotate(3.5deg); } }

.a-celebrate { animation: cel .42s ease-in-out infinite alternate; }
@keyframes cel { from { transform: scale(1) translateY(0); } to { transform: scale(1.24) translateY(-1.8px); } }

.a-eat { animation: eat .52s ease-in-out infinite alternate; }
@keyframes eat { from { transform: translateY(0) rotate(-2.2deg); } to { transform: translateY(.8px) rotate(2.2deg); } }

.a-urgent { animation: typ .15s ease-in-out infinite alternate; }
.a-urgent .arm-l { animation: swl .12s ease-in-out infinite alternate; }
.a-urgent .arm-r { animation: swr .13s ease-in-out infinite alternate; }

/* ---------------- responsive ---------------- */
@media (max-width: 760px), (max-height: 520px) {
  #panel { display: none; }
  #hud { top: 10px; right: 10px; min-width: 120px; padding: 6px 8px; }
  .hud-v { font-size: 12px; }
  .bar-hint { display: none; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  #proj-beam { opacity: 0; }
  #office.proj-on #proj-beam { opacity: 1; }
  #coffee-steam { opacity: 0 !important; }
  .char.urgent .ch-glow { opacity: .9; }
  .amb-plant { transform: none; }
}
