/* Board geometry. --row10 (px per 10 minutes) comes from tokens.css;
   the fallback here covers a token-less load. */
:root {
  --row10: 14px;
  --gutter-w: 52px;
}

#game-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1500px;
  margin: 0 auto;
}

/* Top bar */
#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: var(--px) solid #000;
  flex-wrap: wrap;
}
#topbar .counter {
  padding: 6px 10px;
  border: 3px solid var(--ink);
  background: #12131f;
  font-size: 11px;
  white-space: nowrap;
}
#topbar .spacer { flex: 1; }
#lost-counter { color: var(--red); }

/* Left rail: caller + hold queue */
#caller-panel .portrait {
  width: 72px;
  height: 72px;
  border: var(--px) solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #000;
  flex: none;
  background: #12131f;
  overflow: hidden;
}
#caller-panel .portrait img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
#hold-queue .holdee img {
  width: 100%;
  display: block;
  image-rendering: pixelated;
}
.picker-doc img {
  width: 40px;
  height: 40px;
  vertical-align: middle;
  margin-right: 8px;
  image-rendering: pixelated;
}
#hold-queue { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
#hold-queue .holdee {
  width: 44px;
  border: 3px solid var(--ink);
  padding: 3px;
  text-align: center;
  font-size: 14px;
  color: #000;
}
#hold-queue .holdee .mini { height: 5px; background: var(--green); margin-top: 3px; }

/* Day tabs */
#day-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.day-tab {
  flex: 1;
  text-align: center;
  padding: 8px 4px 6px;
  background: var(--panel);
  border: var(--px) solid var(--ink);
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
}
.day-tab.active { background: var(--gold); color: #000; }
.day-tab .meter {
  height: 6px;
  background: #12131f;
  margin-top: 5px;
  border: 2px solid currentColor;
}
.day-tab .meter .fill { height: 100%; background: var(--green); }
.day-tab .docs { font-size: 8px; display: block; margin-top: 4px; }

/* The grid */
#board-wrap { position: relative; overflow: visible; }
#board {
  display: grid;
  grid-template-columns: var(--gutter-w) repeat(4, 1fr);
  gap: 0;
  border: var(--px) solid var(--ink);
  background: #12131f;
  position: relative;
  user-select: none;
  touch-action: none;
}
.room-head, .gutter-head {
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
  background: var(--panel2);
  border-bottom: var(--px) solid var(--ink);
  border-right: 2px solid #000;
}
.room-head .doc-chip {
  display: block;
  font-size: 8px;
  margin-top: 4px;
  color: #000;
  padding: 2px;
}
.gutter {
  position: relative;
  border-right: 2px solid var(--ink);
  background: var(--panel);
}
.gutter .hour {
  position: absolute;
  right: 4px;
  transform: translateY(-6px);
  font-size: 9px;
  color: var(--dim);
}
.opcol {
  position: relative;
  border-right: 2px solid #22253a;
  /* Hour lines heavier than 10-min lines, painted as one gradient stack. */
  background-image:
    repeating-linear-gradient(to bottom,
      #2c3050 0, #2c3050 1px, transparent 1px, transparent calc(var(--row10) * 6)),
    repeating-linear-gradient(to bottom,
      #1e2136 0, #1e2136 1px, transparent 1px, transparent var(--row10));
}

/* Blocks: interior painted by inline hard-stop gradient (X solid, / alpha). */
.block {
  position: absolute;
  left: 3px;
  right: 3px;
  border: 3px solid #000;
  font-size: 8px;
  line-height: 1.3;
  color: #000;
  padding: 3px 4px;
  overflow: hidden;
}
.block .who { font-size: 7px; opacity: 0.8; }
.block.lunch {
  background: repeating-linear-gradient(45deg, #555b76 0 6px, #464b63 6px 12px);
  color: #ccc;
  text-align: center;
}

/* Drag ghost */
#ghost {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 60;
  border: 3px dashed #000;
  opacity: 0.95;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.55);
}
#ghost.legal { outline: 4px solid var(--green); }
#ghost.illegal { outline: 4px solid var(--red); }
#ghost .ghost-label {
  font-size: 8px;
  color: #000;
  background: rgba(255, 255, 255, 0.75);
  padding: 1px 3px;
}

/* While a drag is live: grabbing cursor everywhere, source dims. */
body.dragging, body.dragging * { cursor: grabbing !important; }
.drag-source { opacity: 0.35; }

/* Player-placed blocks are adjustable — advertise it. */
.block.movable { cursor: grab; }
.block.movable:hover {
  outline: 3px solid var(--gold);
  z-index: 5;
}
.block.movable:hover::after {
  content: '⇕';
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 10px;
}

/* Fresh placement flash so the drop location registers. */
@keyframes placed-flash {
  0%, 40% { outline: 4px solid var(--gold); box-shadow: 0 0 0 3px #000, 0 0 14px var(--gold); }
  100% { outline: 0 solid transparent; box-shadow: none; }
}
.placed-flash { animation: placed-flash 0.9s steps(3) both; }

/* Tray */
#tray {
  margin-top: 12px;
  min-height: 96px;
  display: flex;
  align-items: center;
  gap: 16px;
}
#tray-block {
  position: relative;
  width: 100%;
  min-height: 72px;
  border: var(--px) solid #000;
  box-shadow: 4px 4px 0 #000;
  color: #000;
  font-size: 10px;
  padding: 8px 10px;
  cursor: grab;
  flex: none;
  touch-action: none;
  animation: tray-bob 1.6s steps(2) infinite;
}
#tray-block::after {
  content: '✊ GRAB + DRAG';
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 8px;
  background: #000;
  color: var(--gold);
  padding: 2px 5px;
}
#tray-block:hover { outline: 4px solid var(--gold); animation: none; }
#tray-block:active { cursor: grabbing; }
#tray-block.drag-source { animation: none; }
@keyframes tray-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
#tray .eligible { font-size: 9px; }
#tray .eligible .doc-chip { padding: 2px 6px; color: #000; margin-right: 6px; }

/* Doctor picker + scorecard */
#doctor-picker .btn { margin: 8px; }
#scorecard table { margin: 12px 0; }
#scorecard td, #scorecard th { font-size: 10px; padding: 6px 8px; border: 3px solid var(--panel2); }
.teamwork { color: var(--gold); font-size: 14px; }
