:root {
  color-scheme: light;
  --ink: #152235;
  --muted: #46566b;
  --faint: #5f6f82;
  --bg: #f4f3ef;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #cfd6df;
  --blue: #1467a8;
  --cyan: #1467a8;
  --amber: #9b6500;
  --green: #18724f;
  --red: #a33b3b;
  --school-red: #a51f2d;
  --school-blue: #173f70;
  --radius: .8rem;
}

body {
  background: var(--bg);
  color: var(--ink);
}

.selection-shell {
  width: min(76rem, calc(100% - 3rem));
  padding: clamp(2rem, 6vh, 4.5rem) 0 3rem;
}

.institution-lockup {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.logo-pair {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex: 0 0 auto;
}

.logo-slot {
  display: grid;
  place-content: center;
  width: 5.5rem;
  height: 3.25rem;
  padding: .35rem;
  color: #566579;
  background: #fff;
  border: 1px dashed #9aa6b5;
  border-radius: .35rem;
  text-align: center;
  line-height: 1.05;
}

.logo-slot span {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.logo-slot small {
  margin-top: .2rem;
  color: #6b7889;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.logo-slot-ib {
  width: 4.75rem;
  margin: .25rem .55rem;
}

.logo-loaded { display: flex; align-items: center; justify-content: center; border: 0; background: transparent; }
.logo-loaded img { display: block; width: 100%; height: 100%; object-fit: contain; }

.correct-time { display: inline; padding: 0; margin: .2rem .35rem 0 0; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .75rem; text-decoration: underline; text-underline-offset: .15em; }
.correct-time:hover { color: var(--school-blue); }
.time-entry { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: clamp(1rem, 3vw, 1.75rem); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 1rem 4rem #15223533; }
.time-entry::backdrop { background: #15223588; }
.time-entry h2 { font-size: 1.45rem; line-height: 1.2; }
.time-entry p { margin: .9rem 0; line-height: 1.5; }
.time-entry input { display: block; max-width: 100%; margin-top: .5rem; padding: .7rem; color: var(--ink); background: #fff; border: 1px solid #9da8b6; border-radius: .4rem; font: inherit; font-size: 1.2rem; }
.time-entry-note { font-size: .85rem; color: var(--muted); }
.time-entry-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.time-entry-actions button { min-height: 2.75rem; }
#time-entry-error { color: var(--red); }
#time-entry-confirmation { border-left: 3px solid var(--amber); padding-left: .8rem; }
@media print { .correct-time, .time-entry { display: none !important; } }


.logo-divider {
  width: 1px;
  height: 2.8rem;
  background: #c7ced7;
}

.exam-identity {
  display: grid;
  gap: .2rem;
  min-width: 0;
  padding-left: 1.1rem;
  border-left: .3rem solid var(--school-red);
}

.exam-identity span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.exam-identity strong {
  color: var(--school-blue);
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.brand-mark { display: none; }

.selection-shell h1 {
  margin: clamp(2.5rem, 7vh, 5rem) 0 1rem;
  color: var(--school-blue);
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 850;
  line-height: .96;
  letter-spacing: -.055em;
}

.intro { color: var(--muted); font-weight: 550; }

.picker-card {
  margin-top: clamp(2rem, 5vh, 4rem);
  background: #fff;
  border: 1px solid var(--line);
  border-top: .3rem solid var(--school-red);
  box-shadow: none;
}

.field-label { color: #35465b; }

select {
  color: var(--ink);
  background: #fff;
  border-color: #9faaba;
  border-radius: .45rem;
  font-weight: 650;
}

select:focus-visible,
button:focus-visible { outline-color: var(--blue); }

.primary-button {
  color: #fff;
  background: var(--school-blue);
  border-color: var(--school-blue);
  border-radius: .45rem;
}

.selection-summary { color: var(--muted); }
.selection-summary strong { color: var(--ink); }
.source-note { color: var(--muted); }

.clock-view {
  min-height: 100vh;
  padding: 1rem clamp(1rem, 2.2vw, 2.25rem) 1.1rem;
  background: var(--bg);
}

.clock-header {
  display: block;
  padding-bottom: .9rem;
  border-bottom: 2px solid #b9c2ce;
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.5rem;
}

.clock-header .institution-lockup { transform: scale(.86); transform-origin: left center; }

.back-button {
  color: #34465b;
  background: #fff;
  border-color: #aab4c1;
  border-radius: .45rem;
  font-weight: 800;
}

.back-button:hover { color: var(--school-blue); border-color: var(--school-blue); }

.clock-focus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  margin-top: .4rem;
}

.current-time {
  grid-column: 2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.time-kicker {
  display: block;
  margin-bottom: .15rem;
  color: #4a5b70;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.time-value {
  color: #101b2a;
  font-size: clamp(4.6rem, 8.2vw, 8.2rem);
  font-weight: 850;
  line-height: .8;
  letter-spacing: -.065em;
}

.date-value {
  margin-top: .65rem;
  color: #3d4e62;
  font-size: clamp(.95rem, 1.35vw, 1.18rem);
  font-weight: 700;
}

.room-identity {
  grid-column: 3;
  justify-self: end;
  padding-left: clamp(1rem, 2.5vw, 2.5rem);
  border-left: .32rem solid var(--school-red);
  text-align: left;
}

.room-label {
  color: #4a5b70;
  font-size: .78rem;
  font-weight: 850;
}

.room-name {
  margin-top: 0;
  color: var(--school-blue);
  font-size: clamp(2rem, 3.4vw, 3.75rem);
  font-weight: 900;
}

.session-name { color: #3d4e62; font-size: .93rem; font-weight: 700; }

.clock-main {
  width: min(118rem, 100%);
  padding-top: .75rem;
}

.clock-toolbar { margin-bottom: .65rem; }
.paper-count { color: #3d4e62; font-weight: 750; }

.start-all,
.select-all,
.reset-session {
  border-radius: .4rem;
  font-weight: 850;
}

.start-all {
  color: #fff;
  background: var(--school-blue);
  border-color: var(--school-blue);
}

.start-all:hover { background: #0e315b; }
.start-all:disabled { opacity: .45; cursor: default; }

.select-all {
  padding: .45rem .65rem;
  color: #34465b;
  background: #fff;
  border-color: #aab4c1;
}

.select-all:hover { color: var(--school-blue); border-color: var(--school-blue); }

.reset-session {
  color: #4b5b6e;
  background: #fff;
  border-color: #aab4c1;
}

.reset-session:not(:disabled):hover { color: var(--school-red); border-color: var(--school-red); }

.paper-list { gap: .55rem; }

.paper-card,
.paper-card.has-reading {
  min-height: 5.9rem;
  padding: .5rem clamp(.8rem, 1.25vw, 1.2rem);
  gap: clamp(.5rem, 1.05vw, 1.15rem);
  background: #fff;
  border: 1px solid #c8d0da;
  border-left: .38rem solid #8996a6;
  border-radius: .55rem;
  box-shadow: none;
}

.paper-card.is-reading { border-left-color: var(--blue); background: #f4f8fc; }
.paper-card.is-active { border-left-color: var(--green); background: #f5fbf8; }
.paper-card.is-warning { border-left-color: var(--amber); background: #fffaf0; }
.paper-card.is-elapsed { border-left-color: var(--red); background: #fff7f7; }
.paper-card.is-finished { border-left-color: #8792a0; background: #f2f4f6; opacity: .82; }

.paper-title.is-selectable {
  display: grid;
  grid-template-columns: 1.2rem minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
}

.paper-select {
  width: 1.1rem;
  height: 1.1rem;
  margin: .08rem 0 0;
  accent-color: var(--school-blue);
  cursor: pointer;
}

.paper-select:focus-visible { outline: .2rem solid var(--cyan); outline-offset: .15rem; }

.paper-title h2 {
  margin-bottom: .25rem;
  color: #182539;
  font-size: clamp(1.08rem, 1.45vw, 1.46rem);
  font-weight: 850;
  line-height: 1.12;
}

.paper-meta { color: #4e5f73; font-size: .78rem; font-weight: 700; }

.milestone {
  padding: .48rem .28rem;
  border-left: 1px solid #d8dde4;
  border-radius: 0;
}

.milestone-label {
  margin-bottom: .14rem;
  color: #4f5f72;
  font-size: .7rem;
  font-weight: 900;
}

.milestone-time {
  color: #152235;
  font-size: clamp(1.22rem, 1.65vw, 1.65rem);
  font-weight: 900;
}

.milestone-range { font-size: clamp(.95rem, 1.2vw, 1.2rem); }

.milestone.is-reached {
  background: #fff0ca;
  border-left-color: #d09a23;
  border-radius: .3rem;
}

.milestone.is-reached .milestone-label { color: #744b00; }

.status-pill {
  min-height: 2.15rem;
  color: #34465b;
  background: #eef1f4;
  border-color: #9ca8b6;
  border-radius: .35rem;
  font-size: .8rem;
  font-weight: 900;
}

.status-pill.active { color: #0d5a3b; background: #e5f4ec; border-color: #4c9a78; }
.status-pill.reading { color: #0d5185; background: #e8f2fa; border-color: #5b91b8; }
.status-pill.warning { color: #754900; background: #fff0ca; border-color: #c4932c; }
.status-pill.elapsed { color: #8d2929; background: #fbe6e6; border-color: #bf7070; }
.status-pill.finished { color: #566271; background: #e7eaee; border-color: #9ba5b0; }

.start-button,
.finish-button {
  min-height: 2.2rem;
  margin-top: .35rem;
  border-radius: .35rem;
  font-weight: 850;
}

.start-button { color: #fff; background: var(--school-blue); }
.finish-button { color: #34465b; background: #fff; border-color: #9da8b6; }
.finish-button:hover { color: var(--school-blue); border-color: var(--school-blue); }

.footnote { margin-top: .65rem; color: #536275; font-weight: 650; }

@media (max-width: 1180px) {
  .clock-header .institution-lockup { transform: scale(.76); }
  .paper-card,
  .paper-card.has-reading { min-height: auto; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .clock-view { padding-top: .65rem; }
  .brand-row { min-height: 3rem; }
  .clock-focus { margin-top: 0; }
  .clock-header { padding-bottom: .6rem; }
  .clock-main { padding-top: .55rem; }
  .clock-toolbar { margin-bottom: .45rem; }
  .paper-list { gap: .4rem; }
  .paper-card {
    grid-template-columns: minmax(15rem, 2fr) repeat(4, minmax(4rem, .55fr)) minmax(7.2rem, .75fr);
    min-height: 5rem;
    padding-block: .3rem;
  }
  .paper-card.has-reading {
    grid-template-columns: minmax(15rem, 2fr) repeat(5, minmax(4rem, .55fr)) minmax(7.2rem, .75fr);
  }
  .paper-title,
  .paper-state { grid-column: auto; }
  .paper-state { display: block; text-align: right; }
  .paper-state .status-pill { min-height: 1.9rem; }
  .paper-state button { width: 100%; min-width: 0; min-height: 2.05rem; margin-top: .2rem; }
  .footnote { margin-top: .35rem; }
}

@media (max-width: 760px) {
  .selection-shell { width: min(100% - 1.5rem, 76rem); }
  .institution-lockup { align-items: flex-start; gap: .75rem; }
  .logo-slot { width: 4.4rem; height: 2.8rem; }
  .logo-slot-ib { width: 3.9rem; margin-inline: .15rem; }
  .exam-identity { padding-left: .7rem; }
  .exam-identity span { font-size: .62rem; }
  .exam-identity strong { font-size: .86rem; white-space: normal; }
  .clock-header .institution-lockup { transform: none; }
  .brand-row { align-items: flex-start; }
  .clock-focus { grid-template-columns: 1fr auto; gap: 1rem; }
  .current-time { grid-column: 1 / -1; grid-row: 1; }
  .room-identity { grid-column: 2; grid-row: 2; }
  .paper-card.has-reading { grid-template-columns: repeat(5, minmax(3.7rem, 1fr)); }
}

@media (max-width: 520px) {
  .brand-row { display: grid; }
  .back-button { justify-self: start; }
  .clock-focus { margin-top: .85rem; }
  .time-value { font-size: 4.2rem; }
  .toolbar-actions { justify-content: flex-start; }
  .milestone-time { font-size: 1rem; }
  .milestone-range { font-size: .82rem; }
}

@media print {
  .back-button,
  .toolbar-actions,
  .start-button,
  .finish-button { display: none !important; }
}
