/*
  Portvane Ferries: teletext timetable and booking (Screenery template)
  1. Tokens: the eight teletext colours, the set's plastics, type sizes. Then the room, the drawn set and the screen.
  2. Teletext primitives: header row, lines (.ln), double-height headings (.dh), background bands, tags, mosaics, fastext row.
  3. Page parts (boards, fares, booking form, sea, islands, rules, office), the remote, the footer, then breakpoints and motion.
*/

:root {
  /* The eight colours of Level 1 teletext. Blue is only ever a background: blue text on black fails contrast. */
  --tt-black: #000000;
  --tt-red: #ff0000;
  --tt-green: #00ff00;
  --tt-yellow: #ffff00;
  --tt-blue: #0000ff;
  --tt-magenta: #ff00ff;
  --tt-cyan: #00ffff;
  --tt-white: #ffffff;

  /* The room and the set */
  --room: #0a0a0c;
  --room-glow: #0d1a2e;
  --plastic-hi: #3b3734;
  --plastic: #24211f;
  --plastic-lo: #151312;
  --remote-hi: #34343a;
  --remote: #1d1d21;
  --rkey: #46464e;
  --rkey-hi: #5a5a63;
  --rkey-text: #f2f2f4;
  --muted: #c9c6c0;           /* footer copy on --room, 11.9:1 */

  /* Type */
  --font-text: "Tiny5", ui-monospace, monospace;
  --font-dh: "Jersey 10", "Tiny5", sans-serif;
  --tt-size: clamp(20px, 2.6cqi, 27px);    /* screen text, from the set's width */

  /* Space and shape */
  --gap: clamp(16px, 3vw, 40px);
  --row: 1.32em;
  --bezel-r: 30px;
  --screen-r: 22px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ---------- Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--room); color-scheme: dark; scrollbar-color: var(--rkey) var(--room); }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--room-glow), var(--room) 60%) no-repeat, var(--room);
  color: var(--tt-white);
  font-family: var(--font-text);
  font-size: 20px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
  font-variant-numeric: tabular-nums;
}
::selection { background: var(--tt-yellow); color: var(--tt-black); }
input, select, textarea { caret-color: var(--tt-yellow); accent-color: var(--tt-yellow); }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tt-yellow); outline-offset: 3px; }
button { font: inherit; color: inherit; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; flex: none; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--tt-yellow); color: var(--tt-black); padding: 8px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Mast: one teletext-like line above the set ---------- */
.mast {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px;
  max-width: 1320px; margin: 0 auto; padding: 18px var(--gap) 14px;
}
.mast p { margin: 0; }
.mast-brand { margin: 0; font-weight: 400; font-family: var(--font-dh); font-size: 34px; line-height: 1; color: var(--tt-white); display: flex; align-items: center; gap: 12px; }
.mast-mark {
  width: 28px; height: 22px; flex: none;
  /* a mosaic hull: red funnel, white hull, blue sea */
  background:
    linear-gradient(var(--tt-red), var(--tt-red)) 16px 0 / 6px 7px no-repeat,
    linear-gradient(var(--tt-white), var(--tt-white)) 8px 7px / 14px 5px no-repeat,
    linear-gradient(var(--tt-white), var(--tt-white)) 2px 12px / 26px 5px no-repeat,
    linear-gradient(var(--tt-blue), var(--tt-blue)) 0 17px / 28px 5px no-repeat;
}
.mast-line { font-size: 18px; color: var(--muted); }
.mast-line a { color: var(--tt-cyan); }

/* ---------- The room: set and remote ---------- */
.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: clamp(20px, 3vw, 44px);
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px var(--gap) 56px;
}

/* The set: brown-black plastic bezel, the screen sunk into it, a speaker strip below */
.set {
  container-type: inline-size;
  position: relative;
  padding: clamp(18px, 3cqi, 36px) clamp(18px, 3cqi, 36px) 0;
  border-radius: var(--bezel-r);
  background: linear-gradient(170deg, var(--plastic-hi), var(--plastic) 35%, var(--plastic-lo));
  box-shadow:
    0 30px 60px -20px rgb(0 0 0 / .8),
    0 2px 0 rgb(255 255 255 / .06) inset,
    0 -3px 0 rgb(0 0 0 / .5) inset;
}
.screen {
  position: relative;
  aspect-ratio: 4 / 3;
  display: flex; flex-direction: column;
  padding: 2.2cqi 3.4cqi 1.6cqi;
  background: var(--tt-black);
  border-radius: var(--screen-r) / calc(var(--screen-r) * 1.2);
  font-size: var(--tt-size);
  line-height: var(--row);
  box-shadow: 0 0 0 3px #0b0a09, 0 0 0 5px #3d3935;
}
.screen:focus { outline: none; }
/* Glass: a dark rim where the tube curves away. Decoration only, never over the text. */
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 5cqi rgb(0 0 0 / .9);
}
.set-foot {
  display: flex; align-items: center; gap: 14px;
  height: clamp(44px, 6cqi, 64px);
  padding: 0 6px;
}
.grille {
  flex: 1; height: 40%;
  background: repeating-linear-gradient(90deg, #0d0c0b 0 4px, transparent 4px 9px);
  border-radius: 3px;
}
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--tt-red); box-shadow: 0 1px 1px rgb(0 0 0 / .6); }
.knob {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #55504b, #1c1a18 70%);
  box-shadow: 0 2px 3px rgb(0 0 0 / .6);
}

/* ---------- Row 0: header ---------- */
.hdr {
  display: flex; gap: .55em; white-space: nowrap;
  color: var(--tt-white);
  margin-bottom: .35em;
}
.hdr-req { min-width: 3.1em; }
.hdr-req.is-typing { color: var(--tt-green); }
.hdr-num.is-rolling { color: var(--tt-green); }
.hdr-svc { color: var(--tt-yellow); }
.hdr-date { color: var(--tt-cyan); margin-left: auto; }
.hdr-clock { color: var(--tt-yellow); }

/* ---------- Pages ---------- */
.pages { flex: 1; position: relative; }
.page { padding-bottom: .4em; }
.js .page { display: none; }
.js .page.is-current { display: block; }
/* Without JS every page is listed, separated by a blue band like a page change */
html:not(.js) .page + .page { margin-top: 1.2em; padding-top: 1em; border-top: .4em solid var(--tt-blue); }
html:not(.js) .mosaic, html:not(.js) .page-missing, html:not(.js) #p401, html:not(.js) .remote, html:not(.js) .loading { display: none; }
.js .page[data-subs] .sub { display: none; }
.js .page[data-subs] .sub.is-current { display: block; }
.js .page[data-subs] fieldset.sub.is-current { display: block; }

/* A "line" of teletext text */
.ln { margin: 0 0 .25em; line-height: var(--row); max-width: 64ch; text-wrap: pretty; }
.ln-white, .c-white { color: var(--tt-white); }
.ln-cyan, .c-cyan { color: var(--tt-cyan); }
.ln-yellow, .c-yellow { color: var(--tt-yellow); }
.ln-green, .c-green { color: var(--tt-green); }
.c-red { color: var(--tt-red); }
.c-magenta { color: var(--tt-magenta); }
.c-black { color: var(--tt-black); }

/* Double height: Jersey 10 stretched to two rows, the way a teletext set doubled a row */
.dh {
  font-family: var(--font-dh); font-weight: 400;
  font-size: 1.75em; line-height: 1;
  margin: .1em 0 .6em;
  transform: scaleY(1.5); transform-origin: 0 0;
  letter-spacing: .01em;
  text-wrap: balance;
}
.dh:focus { outline: none; }
/* headings take focus only so screen readers land on the new page; they are not controls */
.dh-yellow { color: var(--tt-yellow); }
.dh-cyan { color: var(--tt-cyan); }
.dh-green { color: var(--tt-green); }
.dh-white { color: var(--tt-white); }
.dh-magenta { color: var(--tt-magenta); }
.dh-red { color: var(--tt-red); }

/* Page title row: small mosaic, double-height title, subpage counter at the right */
.ph { display: flex; align-items: flex-start; gap: .6em; }
.ph .dh { margin-bottom: .75em; }
.ph-aside { margin: .35em 0 0 auto; }
.subcount { margin: .1em 0 0 auto; color: var(--tt-white); white-space: nowrap; }
.subcount b { color: var(--tt-yellow); font-weight: 400; }

/* Background bands (the "new background" control) */
.band { margin: .3em 0 .45em; padding: .15em .45em; }
.band .ln { margin: 0; max-width: none; }
.band h3 { font-weight: 400; font-size: 1em; }
.band-blue { background: var(--tt-blue); color: var(--tt-white); }
.band-red { background: var(--tt-red); color: var(--tt-black); }
.band-red .ln { color: var(--tt-black); }

.tag { display: inline-block; padding: 0 .35em; color: var(--tt-black); }
.tag-green { background: var(--tt-green); }
.tag-yellow { background: var(--tt-yellow); }
.tag-red { background: var(--tt-red); }

/* Mosaics: canvases drawn by script.js at sixel resolution, scaled with crisp pixels */
.mosaic { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.mosaic-banner { width: 100%; height: auto; aspect-ratio: 40 / 8.4; margin-bottom: .45em; background: linear-gradient(transparent 70%, var(--tt-blue) 70%); }
.mosaic-icon { width: 3.2em; aspect-ratio: 6 / 2.4; margin-top: .15em; flex: none; }

/* ---------- P100 index ---------- */
.status-list { margin: 0 0 .5em; display: grid; gap: .15em; }
.status-row { display: grid; grid-template-columns: 8.5em 1fr; gap: .5em; }
.status-row dt, .status-row dd { margin: 0; }
.index-list {
  list-style: none; margin: .4em 0 .5em; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.2em;
}
.index-list a { display: flex; gap: .6em; padding: .05em .2em; text-decoration: none; color: var(--tt-cyan); min-height: 1.4em; align-items: center; }
.index-list .pn { color: var(--tt-white); }
.index-list a:hover, .index-list a:focus-visible { background: var(--tt-cyan); color: var(--tt-black); outline: none; }
.index-list a:hover .pn, .index-list a:focus-visible .pn { color: var(--tt-black); }
.hint { margin-top: .5em; }

/* ---------- P200 boards ---------- */
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.4em; margin-bottom: .35em; }
.board { width: 100%; border-collapse: collapse; }
.board caption { text-align: left; color: var(--tt-cyan); padding-bottom: .1em; }
.board th { text-align: left; font-weight: 400; color: var(--tt-white); padding: 0 .3em 0 0; border-bottom: 2px solid var(--tt-blue); }
.board td { padding: .02em .3em .02em 0; color: var(--tt-white); vertical-align: top; }
.board td:first-child { width: 4.2em; padding-left: .8em; position: relative; }
.board tr.is-next td:first-child::before {
  /* a pixel pointer made of three stacked blocks, like a mosaic arrow */
  content: ""; position: absolute; left: .1em; top: .3em; width: .45em; height: .6em;
  background: var(--tt-yellow); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.board td.st-ok { color: var(--tt-green); }
.board td.st-late { color: var(--tt-yellow); }
.board td.st-cancel { color: var(--tt-red); }
.board td.st-gone { color: var(--tt-white); }
.board td.st-board { color: var(--tt-black); background: var(--tt-yellow); }
@media (prefers-reduced-motion: no-preference) {
  .st-board { animation: tt-flash 2s steps(1) infinite; }
}
@keyframes tt-flash { 50% { background: transparent; color: var(--tt-yellow); } }
tr.is-cancel td:first-child { text-decoration: line-through; text-decoration-color: var(--tt-red); text-decoration-thickness: 3px; }

/* ---------- Generic data table (fares, sea) ---------- */
.grid-table { width: 100%; max-width: 26em; border-collapse: collapse; margin: .2em 0 .45em; }
.grid-table th, .grid-table td { padding: .03em .3em; font-weight: 400; }
.grid-table thead th { color: var(--tt-yellow); text-align: right; border-bottom: 2px solid var(--tt-blue); }
.grid-table thead th:first-child { text-align: left; }
.grid-table tbody th { text-align: left; color: var(--tt-cyan); }
.grid-table td { text-align: right; color: var(--tt-white); }
.grid-table .row-warn th, .grid-table .row-warn td { color: var(--tt-black); background: var(--tt-yellow); }

/* ---------- P400 booking form ---------- */
.book { margin: 0; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step legend { display: block; width: 100%; float: left; padding: .15em .45em; margin: 0 0 .5em; }
.step legend + * { clear: both; }
.field { margin: 0 0 .5em; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1em; clear: both; }
.label { display: block; color: var(--tt-cyan); margin-bottom: .1em; }
.inp {
  width: 100%; min-height: 1.75em;
  font: inherit; color: var(--tt-white); background: var(--tt-black);
  border: 2px solid var(--tt-white); border-radius: 0;
  padding: .1em .35em;
}
.inp:focus-visible { outline: 3px solid var(--tt-yellow); outline-offset: 1px; border-color: var(--tt-yellow); }
.inp::placeholder { color: #9a9a9a; }
.inp[aria-invalid="true"] { border-color: var(--tt-red); }
select.inp { appearance: none; background: var(--tt-black) linear-gradient(var(--tt-white), var(--tt-white)) right .5em center / .5em .5em no-repeat; padding-right: 1.5em; }
select.inp option { background: var(--tt-black); color: var(--tt-white); }
input[type="date"].inp::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.inp-short { max-width: 7em; }
.err { margin: .1em 0 0; color: var(--tt-red); min-height: 0; }
.err:empty { display: none; }
.help { margin: .1em 0 .3em; color: var(--tt-white); }
.choice { display: grid; gap: .15em; }
.choice-row { grid-template-columns: repeat(auto-fit, minmax(7em, max-content)); column-gap: 1.2em; }
.opt { display: flex; align-items: center; gap: .5em; cursor: pointer; min-height: 1.5em; }
.opt input {
  appearance: none; margin: 0; flex: none;
  width: .9em; height: .9em; border: 2px solid var(--tt-white); background: var(--tt-black);
}
.opt input:checked { background: var(--tt-yellow); border-color: var(--tt-yellow); box-shadow: inset 0 0 0 2px var(--tt-black); }
.opt input:focus-visible { outline: 3px solid var(--tt-yellow); outline-offset: 2px; }
.opt input:checked + span { color: var(--tt-yellow); }
.step-note { clear: both; }
.pax { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1em; }
.stepper-box { display: flex; align-items: stretch; }
.stepper-box .inp { text-align: center; border-left: 0; border-right: 0; -moz-appearance: textfield; min-width: 0; }
.stepper-box .inp::-webkit-inner-spin-button, .stepper-box .inp::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sbtn {
  flex: none; width: 1.75em; border: 2px solid var(--tt-white); background: var(--tt-white); color: var(--tt-black);
  cursor: pointer; line-height: 1; padding: 0;
}
.sbtn:hover { background: var(--tt-cyan); border-color: var(--tt-cyan); }
.sbtn:disabled { background: var(--tt-black); color: #8c8c8c; cursor: not-allowed; }
.step-nav { display: flex; flex-wrap: wrap; gap: .6em; margin-top: .5em; clear: both; }
.key {
  font: inherit; border: 0; cursor: pointer; padding: .15em .7em; min-height: 1.7em;
  color: var(--tt-black); border-radius: 0;
}
.key-green { background: var(--tt-green); }
.key-yellow { background: var(--tt-yellow); }
.key-plain { background: var(--tt-black); color: var(--tt-white); box-shadow: inset 0 0 0 2px var(--tt-white); }
.key:hover { filter: brightness(.85); }
.key-plain:hover { background: var(--tt-white); color: var(--tt-black); filter: none; }
.key:disabled { opacity: .6; cursor: progress; }
.form-alert { margin: 0 0 .5em; padding: .15em .45em; background: var(--tt-red); color: var(--tt-black); }

/* Price written out: lines with a dotted leader */
.price { margin: .3em 0 .3em; padding: .3em .45em .2em; box-shadow: inset 0 0 0 2px var(--tt-yellow); }
.price h3 { font-weight: 400; font-size: 1em; }
.price-lines { list-style: none; margin: 0; padding: 0; }
.price-lines li, .price-total { display: flex; align-items: baseline; gap: .4em; margin: 0; }
.price-lines li { color: var(--tt-white); }
.dots { flex: 1; min-width: 1em; height: .25em; background: radial-gradient(circle, currentColor 1.2px, transparent 1.6px) 0 0 / .5em .25em repeat-x; opacity: .7; }
.price-total { color: var(--tt-yellow); margin-top: .15em; padding-top: .15em; border-top: 2px solid var(--tt-blue); }

.loading { padding: .5em 0; }
.mosaic-wait { width: 50%; aspect-ratio: 20 / 2.4; margin-bottom: .4em; }

/* ---------- P401 reference ---------- */
.ref-band { padding: .4em .6em .7em; }
.ref-code { font-family: var(--font-dh); font-size: 2.6em; line-height: 1; margin: .1em 0 .3em; transform: scaleY(1.4); transform-origin: 0 0; }
.ref-list { display: grid; grid-template-columns: max-content 1fr; gap: .05em 1em; margin: .3em 0 .5em; }
.ref-list dt { color: var(--tt-cyan); }
.ref-list dd { margin: 0; color: var(--tt-white); }

/* ---------- P500 sea ---------- */
.sea { display: grid; grid-template-columns: minmax(0, 10fr) minmax(0, 30fr); gap: 1em; align-items: end; margin: .3em 0 .3em; }
.sea figure { margin: 0; }
.mosaic-compass { width: 100%; aspect-ratio: 10 / 7.2; }
.mosaic-bars { width: 100%; aspect-ratio: 34 / 8.4; }
.sea figcaption { margin-top: .2em; }
.sea-legend { display: flex; flex-wrap: wrap; gap: 0 1em; }
.sea-legend span { white-space: nowrap; }
.sea-table { max-width: 24em; }

/* ---------- P600/P610 islands ---------- */
.island { display: grid; grid-template-columns: minmax(0, 18fr) minmax(0, 22fr); gap: 1em; align-items: start; margin-bottom: .3em; }
.island-map { margin: 0; }
.mosaic-map { width: 100%; aspect-ratio: 18 / 10.8; background: var(--tt-blue); }
.key-list { display: flex; flex-wrap: wrap; gap: 0 1em; margin-top: .25em; color: var(--tt-white); }
.key-list span { display: inline-flex; align-items: center; gap: .35em; }
.sw { display: inline-block; width: .6em; height: .6em; }
.sw-yellow { background: var(--tt-yellow); }
.sw-white { background: var(--tt-white); }
.sw-red { background: var(--tt-red); }
.sw-magenta { background: var(--tt-magenta); }
.quay { margin: 0 0 .6em; }
.mosaic-deck { width: 100%; aspect-ratio: 40 / 4.8; }
.mosaic-quay { width: 100%; aspect-ratio: 40 / 7.2; }
.facts, .rules { list-style: none; margin: 0; padding: 0; display: grid; gap: .3em; color: var(--tt-white); }
.rules { counter-reset: rule; max-width: 60ch; }
.rules li { position: relative; padding-left: 1.6em; }
.rules li::before { counter-increment: rule; content: counter(rule); color: var(--tt-white); position: absolute; left: 0; top: 0; }
.facts li, .rules li { line-height: var(--row); }

/* ---------- P800 office ---------- */
.office { display: grid; gap: .25em; margin: 0; }
.office div { display: grid; grid-template-columns: 5em 1fr; gap: .6em; }
.office dt, .office dd { margin: 0; }
.office dd { color: var(--tt-white); overflow-wrap: anywhere; }
.office a { color: var(--tt-white); }

/* ---------- Row 24: fastext ---------- */
.fastext {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5em;
  margin-top: auto; padding-top: .3em;
}
.fx { text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .15em; min-height: 1.4em; display: flex; align-items: center; }
.fx-red { color: var(--tt-red); }
.fx-green { color: var(--tt-green); }
.fx-yellow { color: var(--tt-yellow); }
.fx-cyan { color: var(--tt-cyan); }
.fx:hover, .fx:focus-visible { color: var(--tt-black); outline: none; }
.fx-red:hover, .fx-red:focus-visible { background: var(--tt-red); }
.fx-green:hover, .fx-green:focus-visible { background: var(--tt-green); }
.fx-yellow:hover, .fx-yellow:focus-visible { background: var(--tt-yellow); }
.fx-cyan:hover, .fx-cyan:focus-visible { background: var(--tt-cyan); }

/* ---------- The remote ---------- */
.remote {
  position: sticky; top: 20px;
  display: grid; gap: 16px;
  padding: 26px 20px 30px;
  border-radius: 46px 46px 64px 64px / 40px 40px 90px 90px;
  background: linear-gradient(160deg, var(--remote-hi), var(--remote) 40%, #131316);
  box-shadow: 0 24px 40px -16px rgb(0 0 0 / .85), 0 1px 0 rgb(255 255 255 / .08) inset;
}
.pgform { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin: 0; }
.pg-label { color: var(--rkey-text); font-size: 18px; }
.pg {
  width: 100%; min-width: 0; height: 48px; padding: 0 10px;
  font-family: var(--font-dh); font-size: 38px; line-height: 1; letter-spacing: .08em; text-align: center;
  color: var(--tt-yellow); background: var(--tt-black);
  border: 0; border-radius: 6px; box-shadow: inset 0 2px 6px rgb(0 0 0 / .9), 0 0 0 2px #0b0b0d;
}
.pg::placeholder { color: #8f8f3a; }
.pg[aria-invalid="true"] { outline: 2px solid var(--tt-red); outline-offset: 1px; }
.pg-go, .keypad button, .subkeys button {
  min-height: 44px; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(var(--rkey-hi), var(--rkey));
  color: var(--rkey-text); font-size: 18px;
  box-shadow: 0 3px 5px -1px rgb(0 0 0 / .7), 0 1px 0 rgb(255 255 255 / .12) inset;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.pg-go { padding: 0 12px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { font-family: var(--font-dh); font-size: 28px; }
.keypad .kp-wide { font-family: var(--font-text); font-size: 16px; }
.subkeys { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.subkeys button[aria-pressed="true"] { background: var(--tt-yellow); color: var(--tt-black); }
.pg-go:active, .keypad button:active, .subkeys button:active, .fxk:active { transform: translateY(2px); box-shadow: 0 1px 2px rgb(0 0 0 / .7); }
.fxkeys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
.fxk {
  display: grid; grid-template-rows: auto auto; justify-items: center; gap: 4px;
  min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--rkey-text);
  font-size: 16px; transition: transform .12s var(--ease);
}
.fxk-dot { width: 100%; height: 22px; border-radius: 12px; box-shadow: 0 3px 5px -1px rgb(0 0 0 / .7), inset 0 2px 0 rgb(255 255 255 / .35); }
.fxk-red .fxk-dot { background: var(--tt-red); }
.fxk-green .fxk-dot { background: var(--tt-green); }
.fxk-yellow .fxk-dot { background: var(--tt-yellow); }
.fxk-cyan .fxk-dot { background: var(--tt-cyan); }
.fxk-t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remote-help { margin: 0; font-size: 16px; line-height: 1.45; color: var(--muted); }

/* ---------- Footer ---------- */
.foot { border-top: 0; }
.foot-band {
  height: 18px;
  /* a row of separated mosaic blocks in the eight colours */
  background:
    repeating-linear-gradient(90deg,
      var(--tt-red) 0 18px, transparent 18px 24px,
      var(--tt-green) 24px 42px, transparent 42px 48px,
      var(--tt-yellow) 48px 66px, transparent 66px 72px,
      var(--tt-cyan) 72px 90px, transparent 90px 96px);
}
.foot-in {
  display: grid; grid-template-columns: 1.3fr 1.2fr 1fr; gap: 28px var(--gap);
  max-width: 1320px; margin: 0 auto; padding: 36px var(--gap) 12px;
  font-size: 20px; color: var(--muted);
}
.foot-col p { margin: 0 0 8px; max-width: 42ch; }
.foot-brand { font-family: var(--font-dh); font-size: 36px; line-height: 1; color: var(--tt-white); }
.foot-h { color: var(--tt-yellow); }
.foot a { color: var(--tt-cyan); }
.foot-pages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, max-content); gap: 2px 24px; }
.foot-pages a { color: var(--tt-white); text-decoration: none; display: inline-block; padding: 3px 0; }
.foot-pages a:hover { color: var(--tt-cyan); text-decoration: underline; }
.foot-small { max-width: 1320px; margin: 0 auto; padding: 8px var(--gap) 40px; font-size: 16px; color: var(--muted); }

/* ---------- Page change: the authored moment is the header roll (script.js); the new page snaps in like a set ---------- */
@media (prefers-reduced-motion: no-preference) {
  .page.is-arriving { animation: tt-arrive .26s steps(4) both; }
}
@keyframes tt-arrive {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* ---------- Breakpoints ---------- */
@media (max-width: 1100px) {
  .room { grid-template-columns: minmax(0, 1fr) 200px; }
  .remote { padding: 22px 14px 26px; }
  .fxk { font-size: 15px; }
}

/* Tablet and phone: the set loses its bezel, the screen fills the width, the remote sits under it */
@media (max-width: 860px) {
  :root { --tt-size: clamp(20px, 3.6cqi, 26px); }
  .room { grid-template-columns: 1fr; padding-bottom: 32px; }
  .set { padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .screen { aspect-ratio: auto; min-height: 70vh; border-radius: 0; box-shadow: 0 0 0 2px #26231f; padding: 14px 16px 12px; }
  .screen::after { box-shadow: none; }
  .set-foot { display: none; }
  .remote {
    position: static; border-radius: 28px;
    grid-template-columns: 1fr 1fr; align-items: start;
  }
  .pgform { grid-column: 1 / -1; }
  .keypad { display: none; }
  .subkeys { grid-column: 1 / 2; }
  .fxkeys { grid-column: 2 / 3; }
  .remote-help { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  :root { --tt-size: 20px; }
  .mast-brand { font-size: 30px; }
  .mast-line { font-size: 16px; }
  .room { padding-left: 0; padding-right: 0; }
  .remote { margin: 0 12px; grid-template-columns: 1fr; padding: 20px 16px 22px; }
  .subkeys, .fxkeys { grid-column: auto; }
  .fxkeys { grid-template-columns: repeat(4, 1fr); }
  .hdr { gap: .45em; font-size: 18px; }
  .hdr-svc { display: none; }
  .boards { grid-template-columns: 1fr; }
  .board + .board { margin-top: .4em; }
  .index-list { grid-template-columns: 1fr; }
  .status-row { grid-template-columns: 1fr; gap: 0; }
  .field-row, .pax { grid-template-columns: 1fr; }
  .sea { grid-template-columns: minmax(0, 1fr); }
  .sea-wind { max-width: 11em; }
  .island { grid-template-columns: 1fr; }
  .fastext { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .2em; }
  .ph-aside { display: none; }
  .foot-in { grid-template-columns: 1fr; }
  .dh { font-size: 1.6em; }
}
#ref-phone { white-space: nowrap; }
