/* puphall.css — โถงหุ่นไม้เก่า (js/puphall.js, js/puphall_ui.js): the run's clock plate (top middle, as the picked mockup
   assets/gen/nightcamp_puprace_map_a_raw.png) and the window, layout B "the split clock" (nightcamp_puprace_board_b_raw.png:
   its window 985 px = 990 u) in the K window look (css/kui.css). Sizes in --u. */
.ph-wrap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transform-origin: 50% 50%; }

/* ---------------- the clock plate (top middle) ---------------- */
#ph-hud {
  position: absolute; left: 50%; top: calc(10 * var(--u)); transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: calc(8 * var(--u));
  pointer-events: none; font-family: 'Mitr', sans-serif;
}
#ph-hud[hidden] { display: none; }
#ph-hud .ph-plate {
  position: relative; min-width: calc(330 * var(--u)); padding: calc(4 * var(--u)) calc(22 * var(--u)) calc(7 * var(--u)); box-sizing: border-box; text-align: center;
  border-radius: calc(16 * var(--u)); border: calc(4 * var(--u)) solid #37637b; background: linear-gradient(#10283b, #17364b);
  box-shadow: inset 0 0 0 calc(3 * var(--u)) #416e87, 0 calc(3 * var(--u)) 0 rgba(0, 0, 0, 0.35);
}
#ph-hud .ph-plate::before, #ph-hud .ph-plate::after {
  content: ''; position: absolute; top: calc(8 * var(--u)); width: calc(9 * var(--u)); height: calc(9 * var(--u)); border-radius: 50%;
  background: #23516b; border: calc(2 * var(--u)) solid #37637b;
}
#ph-hud .ph-plate::before { left: calc(8 * var(--u)); }
#ph-hud .ph-plate::after { right: calc(8 * var(--u)); }
#ph-hud .ph-time { display: block; font: 800 calc(44 * var(--u)) / 1.05 'Baloo 2', 'Mitr', sans-serif; color: var(--ink); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
#ph-hud .count .ph-time { color: #d57074; }
#ph-hud .ph-sub { display: block; font: 600 calc(15.5 * var(--u)) / 1.2 'Mitr', sans-serif; color: #e8f7ff; white-space: nowrap; }
#ph-hud .ph-medal {
  display: flex; align-items: center; gap: calc(4 * var(--u)); padding: calc(4 * var(--u)) calc(10 * var(--u)) calc(4 * var(--u)) calc(4 * var(--u));
  border-radius: calc(14 * var(--u)); border: calc(3.5 * var(--u)) solid #37637b; background: linear-gradient(#081b2b, #081b2b); color: #c8e1ee;
}
#ph-hud .ph-medal img { width: calc(40 * var(--u)); height: calc(40 * var(--u)); }
#ph-hud .ph-medal span { font: 600 calc(13 * var(--u)) / 1.1 'Mitr', sans-serif; text-align: center; }
#ph-hud .ph-medal b { display: block; font: 800 calc(19 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; }
#ph-hud .ph-medal.silver { color: #e8f7ff; }
#ph-hud .ph-medal.bronze { color: #c8e1ee; }
#ph-hud .ph-leave {
  pointer-events: auto; cursor: pointer; align-self: flex-start; margin-top: calc(6 * var(--u)); padding: calc(4 * var(--u)) calc(12 * var(--u));
  border-radius: calc(12 * var(--u)); border: calc(3 * var(--u)) solid #37637b; background: linear-gradient(#17364b, #23516b);
  font: 700 calc(15 * var(--u)) / 1.2 'Mitr', sans-serif; color: var(--ink);
}
#ph-hud .ph-leave:hover { filter: brightness(1.08); }

/* ---------------- the window (B) ---------------- */
.ph-win { width: calc(990 * var(--u)); padding-bottom: calc(12 * var(--u)); }
.ph-bar { display: flex; align-items: center; justify-content: center; gap: calc(12 * var(--u)); padding: calc(10 * var(--u)) calc(14 * var(--u)) 0; position: relative; }
.ph-chips { display: flex; gap: calc(4 * var(--u)); }
.ph-chips button {
  width: calc(228 * var(--u)); height: calc(40 * var(--u)); cursor: pointer; border: calc(3.5 * var(--u)) solid #37637b; border-radius: calc(12 * var(--u));
  background: linear-gradient(#10283b, #17364b); color: var(--ink); font: 700 calc(19 * var(--u)) / 1 'Mitr', sans-serif;
}
.ph-chips button.on { background: linear-gradient(#185776, #185776); color: #e8f7ff; -webkit-text-stroke: calc(4 * var(--u)) #061421; paint-order: stroke fill; }
.ph-jobw { position: absolute; right: calc(14 * var(--u)); top: calc(10 * var(--u)); }
.ph-job {
  width: calc(200 * var(--u)); height: calc(40 * var(--u)); padding: 0 calc(12 * var(--u)); border: calc(3.5 * var(--u)) solid #37637b; border-radius: calc(12 * var(--u));
  background: #10283b; color: var(--ink); font: 600 calc(17 * var(--u)) / 1 'Mitr', sans-serif; cursor: pointer;
}
.ph-rule { padding: calc(8 * var(--u)) calc(20 * var(--u)) 0; text-align: center; font: 500 calc(17 * var(--u)) / 1.3 'Mitr', sans-serif; color: #e8f7ff; }
.ph-strip {
  display: flex; align-items: center; gap: calc(18 * var(--u)); margin: calc(8 * var(--u)) calc(14 * var(--u)) 0; padding: calc(6 * var(--u)) calc(18 * var(--u));
  border-radius: calc(14 * var(--u)); border: calc(3 * var(--u)) solid #416e87; background: #10283b; min-height: calc(54 * var(--u)); box-sizing: border-box;
}
.ph-md { display: flex; align-items: center; gap: calc(6 * var(--u)); font: 800 calc(23 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; color: var(--ink); }
.ph-md img { width: calc(38 * var(--u)); height: calc(38 * var(--u)); }
.ph-sep { width: calc(2 * var(--u)); align-self: stretch; background: #23516b; }
.ph-rew { display: flex; align-items: center; gap: calc(8 * var(--u)); font: 600 calc(16 * var(--u)) / 1.25 'Mitr', sans-serif; color: #e8f7ff; }
.ph-rew img { width: calc(40 * var(--u)); height: calc(40 * var(--u)); flex: none; }

.ph-cols { display: flex; gap: calc(12 * var(--u)); padding: calc(10 * var(--u)) calc(14 * var(--u)) 0; }
.ph-left, .ph-right {
  display: flex; flex-direction: column; border-radius: calc(14 * var(--u)); border: calc(4 * var(--u)) solid #37637b; overflow: hidden;
  background: linear-gradient(#081b2b, #081b2b); box-shadow: inset 0 0 0 calc(3 * var(--u)) #3c7d98; color: #e8f7ff;
}
.ph-left { flex: none; width: calc(436 * var(--u)); }
.ph-right { flex: 1; min-width: 0; }
.ph-h { padding: calc(6 * var(--u)) 0 calc(7 * var(--u)); text-align: center; font: 800 calc(22 * var(--u)) / 1.2 'Mitr', sans-serif; color: #e8f7ff; letter-spacing: 0.02em; background: #081b2b; border-bottom: calc(3 * var(--u)) solid #3c7d98; }
.ph-pic { position: relative; height: calc(186 * var(--u)); overflow: hidden; }
.ph-picimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph-clock { position: absolute; left: 50%; top: 50%; width: calc(190 * var(--u)); height: calc(176 * var(--u)); transform: translate(-50%, -50%); display: grid; place-items: center; }
.ph-clock img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ph-clock b { position: relative; margin-top: calc(18 * var(--u)); font: 800 calc(26 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.ph-clock em {
  position: absolute; bottom: calc(-2 * var(--u)); left: 50%; transform: translateX(-50%); padding: calc(1 * var(--u)) calc(16 * var(--u)) calc(3 * var(--u));
  border-radius: calc(10 * var(--u)); border: calc(3 * var(--u)) solid #37637b; background: linear-gradient(#17364b, #d99a1e);
  font: 800 normal calc(17 * var(--u)) / 1.1 'Mitr', sans-serif; color: var(--ink);
}
.ph-clock em.silver { background: linear-gradient(#10283b, #23516b); }
.ph-clock em.bronze { background: linear-gradient(#ffbf86, #c06a2e); }
.ph-mine { padding: calc(7 * var(--u)) calc(12 * var(--u)) calc(6 * var(--u)); text-align: center; font: 500 calc(17 * var(--u)) / 1.3 'Mitr', sans-serif; color: #e8f7ff; background: rgba(0, 0, 0, 0.25); }
.ph-mine b { color: #c8e1ee; font-weight: 700; }
.ph-splits { margin: calc(6 * var(--u)) calc(10 * var(--u)) 0; padding: calc(4 * var(--u)) calc(10 * var(--u)) calc(6 * var(--u)); border-radius: calc(10 * var(--u)); background: rgba(10, 12, 26, 0.45); }
.ph-sh { font: 700 calc(17 * var(--u)) / 1.6 'Mitr', sans-serif; color: #e8f7ff; border-bottom: calc(2 * var(--u)) solid rgba(255, 255, 255, 0.12); }
.ph-sh small { font-weight: 400; color: #c8e1ee; font-size: calc(13 * var(--u)); margin-left: calc(6 * var(--u)); }
.ph-sp { display: flex; align-items: center; gap: calc(10 * var(--u)); height: calc(34 * var(--u)); border-bottom: calc(1.5 * var(--u)) solid rgba(255, 255, 255, 0.07); font: 500 calc(17 * var(--u)) / 1 'Mitr', sans-serif; }
.ph-sp img { width: calc(26 * var(--u)); height: calc(26 * var(--u)); }
.ph-sp span { width: calc(80 * var(--u)); }
.ph-sp b { width: calc(110 * var(--u)); font: 700 calc(18 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; font-variant-numeric: tabular-nums; }
.ph-sp i { margin-left: auto; font: 600 normal calc(16 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; font-variant-numeric: tabular-nums; }
.ph-sp i.ahead { color: #8ff08a; }
.ph-sp i.behind { color: #ff7b78; }
.ph-sp.boss span { color: #c8e1ee; }
.ph-btns { display: flex; gap: calc(10 * var(--u)); padding: calc(10 * var(--u)); margin-top: auto; }
.ph-btns button {
  height: calc(64 * var(--u)); cursor: pointer; border: calc(4 * var(--u)) solid #37637b; border-radius: calc(16 * var(--u));
  font: 800 calc(28 * var(--u)) / 1 'Mitr', sans-serif; color: #e8f7ff; -webkit-text-stroke: calc(5 * var(--u)) #061421; paint-order: stroke fill;
  box-shadow: inset 0 calc(-5 * var(--u)) 0 rgba(0, 0, 0, 0.18);
}
.ph-enter { flex: 1.6; background: linear-gradient(#17364b, #f0a826); }
.ph-prac { flex: 1; background: linear-gradient(#17364b, #23516b); font-size: calc(23 * var(--u)) !important; }
.ph-btns button:disabled { filter: grayscale(0.7) brightness(0.8); cursor: default; }
.ph-btns button:not(:disabled):hover { filter: brightness(1.08); }

.ph-rows { height: calc(468 * var(--u)); overflow-y: auto; padding: calc(6 * var(--u)) calc(8 * var(--u)); display: flex; flex-direction: column; gap: calc(5 * var(--u)); }
.ph-row, .ph-me {
  display: flex; align-items: center; gap: calc(10 * var(--u)); flex: none; height: calc(52 * var(--u)); padding: 0 calc(12 * var(--u)) 0 calc(8 * var(--u)); box-sizing: border-box;
  border-radius: calc(12 * var(--u)); border: calc(3 * var(--u)) solid #416e87; background: #10283b; color: var(--ink);
}
.ph-row.t1 { background: linear-gradient(#10283b, #17364b); border-color: #c99a2a; }
.ph-row.t2 { background: linear-gradient(#10283b, #10283b); border-color: #3c7d98; }
.ph-row.t3 { background: linear-gradient(#10283b, #17364b); border-color: #c07a46; }
.ph-row.me { box-shadow: 0 0 0 calc(3 * var(--u)) #3c7d98; }
.ph-no { width: calc(40 * var(--u)); text-align: center; font: 800 calc(24 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; color: var(--ink); }
.ph-face { width: calc(40 * var(--u)); height: calc(40 * var(--u)); flex: none; border-radius: 50%; border: calc(2.5 * var(--u)) solid #37637b; background: #10283b; }
.ph-name { width: calc(140 * var(--u)); font: 700 calc(18 * var(--u)) / 1.1 'Mitr', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-job2 { display: flex; align-items: center; gap: calc(5 * var(--u)); flex: 1; min-width: 0; font: 500 calc(15 * var(--u)) / 1.1 'Mitr', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-job2 img { width: calc(26 * var(--u)); height: calc(26 * var(--u)); flex: none; }
.ph-time { font: 800 calc(25 * var(--u)) / 1 'Baloo 2', 'Mitr', sans-serif; color: #c8e1ee; -webkit-text-stroke: calc(4.5 * var(--u)) #061421; paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.ph-mdi { width: calc(32 * var(--u)); height: calc(32 * var(--u)); flex: none; }
.ph-me { margin: calc(4 * var(--u)) calc(8 * var(--u)) calc(8 * var(--u)); height: calc(62 * var(--u)); background: linear-gradient(#185776, #185776); border: calc(4 * var(--u)) solid #37637b; color: #e8f7ff; }
.ph-me .ph-no, .ph-me .ph-name { color: #e8f7ff; -webkit-text-stroke: calc(4 * var(--u)) #061421; paint-order: stroke fill; }
.ph-me .ph-job2 { color: #e8f7ff; }
.ph-empty { padding: calc(40 * var(--u)) calc(16 * var(--u)); text-align: center; font: 500 calc(18 * var(--u)) / 1.4 'Mitr', sans-serif; color: #c8e1ee; }
