
:root {
  color-scheme: light;
  --bg: #eef5ff;
  --ink: #10172a;
  --line: #52627d;
  --brand-blue: #0000b3;
  --brand-blue-2: #063ecf;
  --brand-blue-3: #0b2f8f;
  --brand-sky: #e7f1ff;
  --brand-purple: #634aa5;
  --brand-yellow: #ffff00;
  --blue: #114fb3;
  --done: #b9b9b9;
  --warn: #fff4bf;
}
* { box-sizing: border-box; }
html {
  width: 100%;
  min-height: 100%;
}
body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.26), transparent 30%),
    radial-gradient(circle at 82% 10%, rgba(99, 74, 165, 0.34), transparent 28%),
    linear-gradient(180deg, var(--brand-blue) 0%, #062ea5 42%, #dcecff 42%, var(--bg) 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.page {
  width: 100vw;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0.8vh 0.8vw 1.4vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0.08)),
    var(--bg);
  border-left: 6px solid var(--brand-blue);
  border-right: 6px solid var(--brand-blue);
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  margin: -0.8vh -0.8vw 0;
  padding: 8px 96px 8px;
  color: #fffdf4;
  background:
    linear-gradient(90deg, var(--brand-blue-3), var(--brand-blue), var(--brand-blue-2), var(--brand-blue-3));
  border-bottom: 5px solid var(--brand-purple);
  box-shadow: 0 3px 10px rgba(0, 0, 80, 0.24);
}
.title-center {
  position: relative;
  z-index: 1;
}
.title-horse {
  position: absolute;
  top: 50%;
  width: clamp(58px, 10vw, 112px);
  max-height: calc(100% - 8px);
  object-fit: contain;
  transform: translateY(-50%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  opacity: 0.96;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.title-horse-left {
  left: clamp(10px, 2.4vw, 28px);
}
.title-horse-right {
  right: clamp(10px, 2.4vw, 28px);
  transform: translateY(-50%) scaleX(-1);
}
h1 {
  margin: 0;
  font-size: clamp(22px, 3.6vw, 34px);
  line-height: 1.05;
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.subline {
  font-size: clamp(12px, 1.8vw, 16px);
  margin-top: 1px;
  color: #f5f8ff;
}
.admin-link {
  position: absolute;
  right: 0;
  top: 0;
  color: #111;
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 3px 7px;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
}
.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 8px 0 4px;
  align-items: center;
}
.primary {
  background: linear-gradient(180deg, #184fff, var(--brand-blue));
  color: #fff;
  border: 3px solid #06166f;
  border-radius: 10px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(18px, 3vw, 26px);
  min-height: 34px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(6, 22, 111, 0.35);
}
.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
select {
  grid-column: span 4;
  width: 100%;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(16px, 2.7vw, 24px);
  text-align: center;
  min-height: 34px;
  color: var(--brand-blue-3);
  background: #fff;
  border: 3px solid var(--brand-blue);
}
.status {
  min-height: 16px;
  margin: 1px 0;
  font-size: 12px;
  text-align: center;
}
.status.error { color: #a40000; font-weight: 700; }
.status.ok { color: var(--brand-blue); font-weight: 700; }
.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  align-items: start;
}
.board.week-board {
  display: block;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.weather-alert {
  margin: 10px 0 0;
  padding: 10px 14px;
  border: 4px solid #7f0000;
  border-radius: 12px;
  background: #d00000;
  color: #fff;
  font-size: clamp(18px, 3vw, 30px);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.weather-alert.hidden {
  display: none;
}
.weather-alert small {
  display: block;
  margin-top: 4px;
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 600;
  color: #ffeaea;
}
.digital-clock {
  margin: 10px 0 0;
  padding: 10px 16px 12px;
  border: 4px solid var(--brand-blue-3);
  border-radius: 12px;
  background: linear-gradient(180deg, #102c78, #06184f);
  color: #fff;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.digital-clock-label {
  display: block;
  margin-bottom: 2px;
  color: #cfe1ff;
  font-size: clamp(12px, 1.8vw, 18px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.digital-clock-time {
  display: block;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(34px, 7vw, 72px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(99, 174, 255, 0.75);
}
.weather-widget {
  margin: 10px 0 0;
  padding: 10px 14px 12px;
  border: 3px solid #5d91c8;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef7ff, #dbeeff);
  color: #102c78;
  text-align: center;
  box-shadow: 0 3px 12px rgba(0, 0, 80, 0.14);
}
.weather-current {
  font-size: clamp(20px, 3.2vw, 34px);
  font-weight: 900;
  line-height: 1.1;
}
.weather-mascot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.28em;
  vertical-align: middle;
  font-size: 1.25em;
  line-height: 1;
  cursor: default;
}
.weather-mascot.fly { color: #2e3440; filter: drop-shadow(0 1px 0 rgba(255,255,255,.75)); }
.weather-mascot.shiver { animation: weather-shiver .48s ease-in-out infinite alternate; }
.weather-mascot.fire { gap: .04em; }
@keyframes weather-shiver {
  from { transform: translateX(-1px) rotate(-2deg); }
  to { transform: translateX(1px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .weather-mascot.shiver { animation: none; }
}
.weather-hourly {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}
.weather-period {
  padding: 6px 4px;
  border: 1px solid #8fb2d8;
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  min-width: 0;
}
.weather-period-time { display: block; font-weight: 900; font-size: clamp(12px, 1.8vw, 17px); }
.weather-period-temp { display: block; margin-top: 2px; font-weight: 900; font-size: clamp(18px, 2.5vw, 26px); }
.weather-period-detail { display: block; margin-top: 2px; font-size: clamp(10px, 1.45vw, 14px); line-height: 1.15; overflow-wrap: anywhere; }
.weather-updated { display: block; margin-top: 7px; color: #476782; font-size: clamp(10px, 1.4vw, 13px); }
@media (max-width: 560px) {
  .weather-hourly { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
  box-shadow: 0 2px 10px rgba(0, 0, 80, 0.14);
}
.schedule-table th,
.schedule-table td {
  border: 1px solid var(--line);
  padding: 3px 5px;
  height: clamp(36px, 4.1vh, 46px);
  line-height: 1.12;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.schedule-table th {
  font-size: clamp(13px, 1.8vw, 18px);
  color: var(--brand-blue-3);
  background: #f4f8ff;
}
.horse { width: 34%; font-weight: 700; }
.week-table {
  min-width: 1040px;
}
.week-table .sticky-horse {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 132px;
  min-width: 132px;
  background: #fff;
  box-shadow: 2px 0 0 var(--line);
}
.week-table th.sticky-horse {
  z-index: 4;
  background: #f4f8ff;
}
.week-table th.week-day {
  width: 128px;
  min-width: 128px;
  font-weight: 700;
  color: var(--brand-blue-3);
}
.week-table td.week-cell {
  width: 128px;
  min-width: 128px;
}
.week-table td.week-cell.training-split {
  display: table-cell;
  padding: 4px;
  vertical-align: middle;
}
.week-table td.week-cell .task-chip {
  width: 100%;
  margin: 2px 0;
}
.work-cell {
  cursor: pointer;
  font-size: clamp(14px, 2.1vw, 22px);
  text-align: center;
}
.work-cell.training-split {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 5px;
  align-items: stretch;
  justify-content: center;
  padding: 4px;
}
.task-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 6px;
  padding: 5px 3px;
  min-height: 28px;
  line-height: 1.08;
  cursor: pointer;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  touch-action: manipulation;
}
.work-cell.training-split:has(.task-chip:nth-child(3)) {
  flex-wrap: wrap;
}
.work-cell.training-split:has(.task-chip:nth-child(3)) .task-chip {
  flex-basis: calc(50% - 3px);
}
.task-chip.done {
  position: relative;
  background: var(--done) !important;
  color: #444 !important;
  /* A real overlay survives Chromium's flex-chip text-decoration bug. */
  text-decoration: none;
  border: 1px solid #777;
}
.task-chip.done::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: #3e3e3e;
  border-radius: 2px;
  pointer-events: none;
}
.work-cell.empty {
  cursor: default;
  background: #fafafa;
}
.work-cell.done {
  background: var(--done);
  color: #444;
  text-decoration: line-through;
}
.work-cell.pending {
  background: var(--warn);
}
.work-cell.missed-carryover,
.task-chip.missed-carryover {
  background: #ffe45c !important;
  color: #1b1b1b !important;
  border: 3px solid #111;
  font-weight: 900;
  box-shadow: inset 0 0 0 3px #ff9f1c;
}
.work-cell.trainer-shawn,
.task-chip.trainer-shawn {
  background: #1f6feb;
  color: #fff;
  font-weight: 700;
}
.work-cell.trainer-william,
.task-chip.trainer-william {
  background: #7a3db8;
  color: #fff;
  font-weight: 700;
}
.work-cell.trainer-skye,
.task-chip.trainer-skye {
  background: #d62828;
  color: #fff;
  font-weight: 700;
}
.work-cell.trainer-teaghan,
.task-chip.trainer-teaghan {
  background: #2f9e44;
  color: #fff;
  font-weight: 700;
}
.work-cell.trainer-lynda,
.task-chip.trainer-lynda {
  background: #008c8c;
  color: #fff;
  font-weight: 700;
}
.schedule-table tr.blank-row td {
  background: #fff;
  color: transparent;
  text-decoration: none;
}
.work-cell.done {
  background: var(--done);
  color: #444;
  text-decoration: line-through;
}
.foot {
  display: none;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #333;
}
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  padding: 24px;
}
.confirm-overlay.hidden {
  display: none;
}
.confirm-box {
  width: min(88vw, 560px);
  background: #fffdf5;
  border: 4px solid #111;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 24px;
  text-align: center;
}
.confirm-box h2 {
  margin: 0 0 14px;
  font-size: clamp(26px, 4vw, 44px);
}
.confirm-box p {
  margin: 0 0 22px;
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.2;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.confirm-button {
  min-height: 72px;
  border: 3px solid #111;
  border-radius: 14px;
  font-size: clamp(22px, 3.4vw, 36px);
  font-family: Georgia, 'Times New Roman', serif;
  cursor: pointer;
}
.confirm-button.cancel {
  background: #eee;
  color: #111;
}
.confirm-button.ok {
  background: var(--blue);
  color: #fff;
}
.admin-page { max-width: 760px; }
.admin-card {
  margin: 18px 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
}
#trainerForm {
  display: grid;
  grid-template-columns: 110px 1fr 100px 120px;
  gap: 10px;
  align-items: center;
}
#trainerForm input {
  font-size: 20px;
  padding: 10px;
}
.trainer-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px 100px 110px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #ddd;
  align-items: center;
}
.small {
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 8px;
}
.small.danger {
  background: #d62828;
  color: #fff;
  border: 2px solid #8f1515;
}
@media (max-width: 620px) {
  .board { grid-template-columns: 1fr; }
  .page { width: 100vw; }
  .top { padding-left: 68px; padding-right: 68px; }
  .title-horse { width: clamp(46px, 13vw, 70px); }
  #trainerForm, .trainer-row { grid-template-columns: 1fr; }
}
.rating-demo-page { max-width: 980px; }
.rating-demo-card { display: grid; gap: 18px; justify-items: start; }
.rating-label { display: grid; gap: 7px; font-size: 22px; font-weight: 700; width: min(100%, 560px); }
.rating-label select, .rating-label textarea { font: inherit; padding: 12px; border: 2px solid #111; border-radius: 10px; background: #fff; }
.rating-label textarea { min-height: 92px; resize: vertical; }
.keyboard-button { width: min(100%, 560px); min-height: 54px; border: 2px solid #111; border-radius: 10px; background: #dcecff; color: #10172a; font: inherit; font-size: 20px; font-weight: 800; cursor: pointer; }
.inline-keyboard { width: 100%; box-sizing: border-box; padding: 10px; border: 2px solid #111; border-radius: 12px; background: #d9e1ec; display: grid; gap: 7px; }
.inline-keyboard.hidden { display: none; }
.keyboard-row { display: flex; justify-content: center; gap: 5px; }
.keyboard-key { min-width: 48px; min-height: 48px; padding: 5px 9px; border: 2px solid #18243a; border-radius: 8px; background: #fff; color: #10172a; font: 800 21px/1 sans-serif; touch-action: manipulation; }
.keyboard-key.wide { min-width: 92px; }
.keyboard-key.space { flex: 1; max-width: 330px; }
.rating-overlay { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.48); padding: 18px; }
.rating-overlay.hidden, .hidden { display: none; }
.rating-box { width: min(94vw, 680px); max-height: 94vh; overflow-y: auto; box-sizing: border-box; background: #fffdf5; border: 4px solid #111; border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.4); padding: 24px; }
.rating-box h2 { margin: 0 0 6px; font-size: clamp(28px, 5vw, 42px); }
.rating-type { margin: 0 0 20px; font-size: 23px; font-weight: 700; color: #0b2f8f; }
.star-picker { display: flex; gap: 8px; margin: 2px 0 16px; }
.star-button { border: 0; background: transparent; color: #aaa; font-size: clamp(42px, 9vw, 64px); padding: 0; line-height: 1; cursor: pointer; }
.star-button.selected { color: #e6ac00; text-shadow: 0 1px 0 #805900; }
.rating-prior { margin: 6px 0 18px; padding: 10px; background: #eef5ff; border-left: 5px solid #114fb3; font-size: 18px; }
