/* ============================================================
   Horse Racing Broadcast CG — styles
   Operator UI + 1920x1080 broadcast display pages
   ============================================================ */

:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c232d;
  --line: #2a323d;
  --txt: #e6edf3;
  --muted: #8b97a7;
  --accent: #3b82f6;
  --accent2: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
}

* { box-sizing: border-box; }

/* ---------------- OPERATOR UI ---------------- */
body.op {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 15px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 700;
  letter-spacing: .3px;
}
.operator-brand-logo {
  height: 42px;
  width: auto;
  max-width: 118px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.45));
}
.topbar .spacer { flex: 1; }
.version-pill {
  color: #9fb0c3; border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 8px; font-size: 11px; background: #0f141b;
}
.save-status {
  color: #cbd5e1; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; font-size: 12px; background: #0f141b;
}
.save-status.saved { color: #86efac; border-color: #166534; }
.save-status.syncing { color: #fde68a; border-color: #a16207; }
.save-status.offline { color: #fca5a5; border-color: #991b1b; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
  font-size: 13px;
}
.nav-links a:hover { color: var(--txt); }

.logout-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.logout-card {
  width: min(560px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 34px;
  text-align: center;
}
.logout-kicker {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-weight: 800;
}
.logout-card h1 { margin: 8px 0 12px; font-size: 34px; }
.logout-card p { color: var(--muted); line-height: 1.55; }
.logout-note {
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.28);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
}
.logout-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

.wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1500px;
  margin: 0 auto;
}
.show-control {
  max-width: 1500px; margin: 14px auto 0; padding: 14px 16px;
  display: grid; grid-template-columns: 1.2fr 2fr auto; gap: 14px; align-items: center;
  background: linear-gradient(135deg, #122033, #161b22); border: 1px solid var(--line);
  border-radius: 10px;
}
.sc-kicker { color: #93a4b8; font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
.sc-title { font-size: 20px; font-weight: 800; margin-top: 2px; }
.sc-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.sc-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.sc-links { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.sc-links a { color: #93c5fd; text-decoration: none; }
.sc-links a:hover { color: #fff; }
.link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #67e8f9;
  text-align: left;
  padding: 0;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.link-btn:hover { color: #fff; text-decoration: underline; }
.preset-select {
  background: var(--bg); border: 1px solid var(--line); color: var(--txt);
  border-radius: 5px; padding: 5px 8px; font-size: 12px;
}
.editor-actions { margin-top:16px; display:flex; gap:10px; align-items:center; flex-wrap: wrap; }
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  .show-control { grid-template-columns: 1fr; }
  .sc-links { flex-direction: row; flex-wrap: wrap; }
}

.btn {
  background: var(--panel2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.green { background: var(--accent2); border-color: var(--accent2); }
.btn.danger { background: transparent; border-color: var(--danger); color: #f87171; }
.btn.warn { background: transparent; border-color: #a16207; color: #fde68a; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.live { background: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* race list */
.racelist { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: fit-content; }
.racelist .head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.racelist .head h2 { margin: 0; font-size: 14px; flex: 1; }
.race-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.race-item:hover { background: var(--panel2); }
.race-item.active { background: #1d2b45; border-left: 3px solid var(--accent); }
.race-item .rn { font-weight: 700; font-size: 15px; }
.race-item .meta { color: var(--muted); font-size: 12px; }
.race-item .spacer { flex: 1; }
.race-item .reorder { display: flex; flex-direction: column; gap: 2px; margin-right: 4px; }
.race-item .reorder .ord {
  padding: 1px 6px; font-size: 10px; line-height: 1.1; font-weight: 700;
}
.race-item .reorder .ord:disabled { opacity: .3; cursor: default; }

/* editor */
.operator-preview {
  background: linear-gradient(180deg, #111923, #0f141b);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.preview-head h2 { margin: 2px 0 0; font-size: 17px; }
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mini-card { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
.mini-meta { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.mini-row {
  display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto;
  text-align: left; gap: 0 8px; padding: 7px 9px; border-radius: 7px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt); cursor: pointer;
}
.mini-row b { grid-row: 1 / span 2; display: grid; place-items: center; background: #1d2b45; border-radius: 5px; }
.mini-row span { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row.sel { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(0,194,255,.25); }
.editor.locked { opacity: .72; position: relative; }
.editor.locked::before {
  content: 'SHOW MODE LOCKED — unlock to edit race data'; display: block;
  margin: -2px 0 12px; color: #fde68a; font-weight: 800; font-size: 12px;
}
.login-logo { height: 54px; width: auto; margin-bottom: 10px; }
.login-form { display: grid; gap: 12px; margin-top: 16px; text-align: left; }
.login-form label { color: var(--muted); font-size: 12px; font-weight: 700; display: grid; gap: 5px; }
.login-form input { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--txt); padding: 10px; font-size: 16px; }
.login-error { color: #fca5a5; min-height: 20px; text-align: center; font-weight: 700; }

/* editor */
.editor { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.editor h2 { margin: 0 0 14px; font-size: 16px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--txt);
  padding: 8px;
  font-size: 14px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

table.horses { width: 100%; border-collapse: collapse; }
table.horses th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
table.horses td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.horses input[type=text] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--txt);
  padding: 7px;
  font-size: 14px;
}
table.horses input[type=text]:focus { outline: none; border-color: var(--accent); }
.post-badge {
  width: 30px; height: 30px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}
.color-cell { display: flex; align-items: center; gap: 6px; }
.color-cell input[type=color] { width: 34px; height: 30px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); padding: 2px; cursor: pointer; }
.scratch-chk { width: 18px; height: 18px; cursor: pointer; }
.row-scratched input[type=text] { opacity: .45; text-decoration: line-through; }

.onair-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px;
}
.onair-bar .lbl { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.onair-bar .horse-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.hp-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--txt);
  border-radius: 5px; padding: 6px 10px; cursor: pointer; font-weight: 700; font-size: 13px;
}
.hp-btn.sel { outline: 2px solid var(--accent); }
.toggle-live { position: relative; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #555; display: inline-block; margin-right: 6px; }
.status-dot.on { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--accent2); color: #fff; padding: 10px 18px; border-radius: 6px;
  font-weight: 600; z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------------- DISPLAY / BROADCAST PAGES ---------------- */
body.display-body {
  margin: 0;
  width: 100vw; height: 100vh; overflow: hidden;
  font-family: "Segoe UI", system-ui, Roboto, Arial, sans-serif;
}
/* Transparent for overlay/key use; ?bg=black or ?bg=green via JS */
body.display-body.bg-transparent { background: transparent; }
body.display-body.bg-black { background: #000; }
body.display-body.bg-green { background: #00FF00; }
body.display-body.bg-green .cphcard { background: #00FF00; }
body.display-body.bg-green .res-wrap { background: transparent; }

.hidden { display: none !important; }

/* ----- RACE CARD ----- */
.card-wrap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 60px 50px;
}
.card-header {
  display: flex; align-items: flex-end; gap: 20px;
  margin-bottom: 14px;
}
.card-racebadge {
  background: linear-gradient(135deg, #c0152b, #7a0d1c);
  color: #fff; border-radius: 10px; padding: 10px 22px;
  font-weight: 900; text-align: center; line-height: 1;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.card-racebadge .rsmall { font-size: 20px; letter-spacing: 2px; opacity: .85; }
.card-racebadge .rbig { font-size: 56px; }
.card-titlebox { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.card-titlebox .t1 { font-size: 34px; font-weight: 800; }
.card-titlebox .t2 { font-size: 22px; font-weight: 500; opacity: .92; margin-top: 4px; }
.card-titlebox .t2 span { margin-right: 22px; }
.card-titlebox .t2 b { color: #ffd24a; font-weight: 800; }

.card-rows { display: flex; flex-direction: column; gap: 8px; }
.hrow {
  display: grid;
  grid-template-columns: 84px 1fr 1fr 120px;
  align-items: center;
  background: rgba(12,16,22,.86);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  height: 74px;
}
.hrow.scratched { opacity: .4; }
.hrow .pp {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.hrow .hname {
  padding: 0 22px; color: #fff; font-size: 30px; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hrow .hname .scr { color: #ff6b6b; font-size: 18px; font-weight: 700; margin-left: 10px; }
.hrow .meta-jk { padding: 0 16px; color: #dbe4ee; }
.hrow .meta-jk .jk { font-size: 22px; font-weight: 700; }
.hrow .meta-jk .st { font-size: 16px; color: #93a1b3; }
.hrow .finishbox {
  height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 900; color: #ffd24a;
  background: rgba(255,255,255,.04);
}

/* ----- LOWER THIRD (single horse) ----- */
.lt-wrap {
  position: absolute; left: 60px; bottom: 86px;
  display: flex; align-items: stretch;
  box-shadow: 0 10px 34px rgba(0,0,0,.56);
  border-radius: 11px; overflow: hidden;
  min-width: 640px;
}
.lt-pp {
  width: 104px; display: flex; align-items: center; justify-content: center;
  font-size: 62px; font-weight: 900;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.lt-body { background: rgba(10,14,20,.92); padding: 15px 29px; display: flex; flex-direction: column; justify-content: center; }
.lt-name { color: #fff; font-size: 45px; font-weight: 900; line-height: 1; }
.lt-sub { color: #cdd8e4; font-size: 23px; margin-top: 6px; }
.lt-sub b { color: #ffd24a; }
.lt-accent { width: 12px; }
.lt-wrap.preset-spotlight { left: 50%; transform: translateX(-50%); bottom: 76px; min-width: 790px; }
.lt-wrap.preset-spotlight .lt-body { background: linear-gradient(90deg, rgba(10,14,20,.96), rgba(29,43,69,.94)); }
.lt-wrap.preset-spotlight .lt-name { color: #fff7cc; }
.lt-wrap.preset-winner .lt-body { background: linear-gradient(90deg, rgba(58,36,5,.96), rgba(12,16,22,.94)); }
.lt-wrap.preset-winner .lt-name { color: #ffd24a; }
.lt-wrap.preset-scratch .lt-body { background: linear-gradient(90deg, rgba(80,7,7,.96), rgba(12,16,22,.94)); }
.lt-wrap.preset-scratch .lt-name { color: #fecaca; }
.lt-wrap.preset-upcoming { left: 60px; top: 70px; bottom: auto; min-width: 560px; transform: none; }
.lt-wrap.preset-upcoming .lt-pp { display: none; }
.lt-wrap.preset-upcoming .lt-body { padding: 12px 23px; background: rgba(10,14,20,.88); }
.lt-wrap.preset-upcoming .lt-name { font-size: 34px; }
.lt-wrap.preset-upcoming .lt-sub { font-size: 19px; }

/* ----- RESULTS ----- */
.res-wrap {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(6,9,13,.55);
  padding: 5vh 3vw;
  box-sizing: border-box;
}
.res-title {
  color: #fff;
  font-size: clamp(58px, 6.2vh, 76px);
  font-weight: 900;
  margin-bottom: 8px;
  text-shadow: 0 4px 14px #000;
}
.res-subtitle {
  color: #ffd24a;
  font-size: clamp(34px, 4.0vh, 48px);
  font-weight: 900;
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-shadow: 0 4px 14px #000;
}
.res-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(1420px, 92vw);
}
.res-empty {
  width: min(1420px, 92vw);
  padding: 44px;
  border-radius: 18px;
  background: rgba(12,16,22,.92);
  color: #cbd5e1;
  font-size: clamp(46px, 5.4vh, 66px);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.res-row {
  display: grid;
  grid-template-columns: 150px 140px 1.45fr 1fr;
  align-items: center;
  background: rgba(12,16,22,.94);
  border-radius: 16px;
  height: clamp(96px, 10.8vh, 122px);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
}
.res-row .fin { font-size: clamp(56px, 6.2vh, 74px); font-weight: 900; text-align: center; color: #ffd24a; }
.res-row .pp2 { height: 100%; display: flex; align-items: center; justify-content: center; font-size: clamp(46px, 5.2vh, 62px); font-weight: 900; box-shadow: inset 0 0 0 3px rgba(255,255,255,.38); }
.res-row .nm { padding: 0 28px; color: #fff; font-size: clamp(40px, 4.7vh, 58px); font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-row .jk2 { padding: 0 28px; color: #dbeafe; font-size: clamp(30px, 3.5vh, 42px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 700px) {
  .res-title { font-size: 46px; margin-bottom: 6px; }
  .res-subtitle { font-size: 27px; margin-bottom: 18px; }
  .res-list { width: min(1060px, 92vw); gap: 10px; }
  .res-empty { width: min(1060px, 92vw); padding: 28px; font-size: 34px; }
  .res-row { grid-template-columns: 98px 92px 1.35fr 1fr; height: 70px; border-radius: 10px; }
  .res-row .fin { font-size: 40px; }
  .res-row .pp2 { font-size: 32px; }
  .res-row .nm { font-size: 28px; padding: 0 18px; }
  .res-row .jk2 { font-size: 20px; padding: 0 18px; }
}

.preview-note {
  position: fixed; top: 8px; left: 8px;
  background: rgba(0,0,0,.6); color: #9fb0c3; font-size: 12px;
  padding: 4px 10px; border-radius: 4px; font-family: system-ui, sans-serif;
  pointer-events: none;
}
.fullscreen-enter {
  position: fixed;
  inset: auto 32px 32px auto;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 14px;
  background: rgba(7,10,15,.84);
  color: #fff;
  padding: 16px 20px;
  min-width: 270px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.fullscreen-enter span { font-size: 22px; font-weight: 900; }
.fullscreen-enter small { color: #cbd5e1; font-size: 13px; }
.fullscreen-enter.hidden { display: none; }
.fullscreen-enter:hover { border-color: #67e8f9; background: rgba(12,18,28,.92); }

/* ============================================================
   CLINTON PHIPPS SR. RACETRACK — full-frame race card
   Designed for 1920x1080. Scales via vw/vh units.
   ============================================================ */
.cphcard {
  position: absolute; inset: 0;
  width: 100vw; height: 100vh;
  display: flex; flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  /* soft pastel blurred backdrop, echoing the reference */
  background:
    radial-gradient(120vw 80vh at 20% 0%, #cfe0f2 0%, rgba(207,224,242,0) 60%),
    radial-gradient(100vw 80vh at 100% 30%, #f6d9c2 0%, rgba(246,217,194,0) 55%),
    radial-gradient(90vw 70vh at 60% 100%, #f2d4e2 0%, rgba(242,212,226,0) 60%),
    linear-gradient(135deg, #d7e3f0 0%, #e9dccb 55%, #ecd6e0 100%);
  overflow: hidden;
}

/* ---- header ---- */
.cph-header {
  flex: 0 0 auto;
  padding: 2.2vh 4vw 0;
  display: flex; flex-direction: column; align-items: center;
}
.cph-logo {
  height: 15vh; width: auto; object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
}
.cph-raceinfo {
  width: calc(100% - 5vw);
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 3.6vh;
  padding: 1.0vh 2.2vw;
  color: #0a0a0a;
  background: rgba(255,255,255,.95);
  border: 2px solid rgba(0,0,0,.55);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.26);
}
.cph-race {
  font-size: 3.0vh; font-weight: 700; font-style: italic;
  letter-spacing: .5px; justify-self: start;
}
.cph-center { text-align: center; line-height: 1.05; }
.cph-dist { font-size: 3.0vh; font-weight: 700; }
.cph-class { font-size: 2.3vh; font-weight: 700; }
.cph-purse {
  font-size: 3.0vh; font-weight: 700; font-style: italic;
  justify-self: end;
}
.cph-title {
  margin-top: 0.9vh;
  padding: 0.55vh 2.2vw;
  border: 1.5px solid rgba(0,0,0,.45);
  border-radius: 9px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 5px 16px rgba(0,0,0,.18);
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.35vh;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
  max-width: 88vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- table ---- */
.cph-table {
  flex: 0 1 auto;
  margin: auto 2.4vw 4.2vh;
  width: calc(100% - 4.8vw);
  background: #ffffff;
  border: 3px solid #111;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.30);
}
.cph-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1.08fr 1.38fr 1fr;
  border-bottom: 2px solid #111;
  min-height: 0;
  height: clamp(92px, 10.1vh, 116px);
}
.cph-row:last-child { border-bottom: none; }
.cph-row:nth-child(even) { background: #eef3f8; }   /* alternating stripe */
.cph-row.scratched { position: relative; }
.cph-row.scratched .cph-c1,
.cph-row.scratched .cph-c2,
.cph-row.scratched .cph-c3 { opacity: .55; }
.cph-row.scratched::after {
  content: '';
  position: absolute;
  left: 1.2vw; right: 1.2vw; top: 50%;
  height: 5px;
  background: #000;
  transform: translateY(-50%);
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.45);
}

.cph-c1, .cph-c2, .cph-c3 {
  padding: 0.75vh 2.0vw;
  display: flex; flex-direction: column; justify-content: center;
  border-right: 2px solid #111;
  min-width: 0;
}
.cph-c3 { border-right: none; }

.cph-top {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(16px, 1.75vh, 22px); font-weight: 800;
  text-transform: uppercase; letter-spacing: .35px;
  color: #1a1a1a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cph-bot {
  font-family: Arial, Helvetica, sans-serif;
  margin-top: 0.45vh;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cph-horse { font-size: clamp(34px, 3.9vh, 46px); font-weight: 900; color: #000; }
.cph-weight { font-size: clamp(34px, 3.9vh, 46px); font-weight: 900; color: #000; }
.cph-postwrap { display: flex; align-items: center; }
.cph-pp {
  display: inline-flex; align-items: center; justify-content: center;
  width: clamp(48px, 5.4vh, 64px); height: clamp(48px, 5.4vh, 64px); border-radius: 9px;
  font-size: clamp(32px, 3.8vh, 46px); font-weight: 900;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.28);
}
.cph-debut { font-size: clamp(22px, 2.35vh, 28px); font-weight: 800; color: #b00; vertical-align: middle; }
.cph-scr { font-size: clamp(20px, 2.2vh, 26px); font-weight: 900; color: #c00; margin-left: .6vw; }
@media (max-height: 700px) {
  .cph-table { margin: auto 3.5vw; width: calc(100% - 7vw); border-width: 2px; }
  .cph-row { grid-template-columns: 1fr 1.25fr 1fr; height: 8.4vh; border-bottom-width: 1.5px; }
  .cph-c1, .cph-c2, .cph-c3 { padding: 0.4vh 1.6vw; border-right-width: 1.5px; }
  .cph-top { font-size: 1.5vh; font-weight: 700; }
  .cph-bot { margin-top: 0.25vh; }
  .cph-horse, .cph-weight { font-size: 2.5vh; font-weight: 800; }
  .cph-pp { width: 3.8vh; height: 3.8vh; border-radius: 6px; font-size: 2.4vh; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
  .cph-debut { font-size: 1.7vh; font-weight: 700; }
  .cph-scr { font-size: 1.6vh; font-weight: 800; margin-left: .5vw; }
}

