/* Nuj brand (from nujsuper.com): deep teal-navy, raspberry pill buttons, pale blue tints,
   Poppins headings, Wix Madefor Text body. Light only: easier to read in bright sun. */
:root {
  color-scheme: light;
  --navy: #012a35;
  --navy-2: #0a3548;
  --raspberry: #ec204e;
  --raspberry-dark: #c81440;
  --raspberry-tint: #fde8ee;
  --blue: #00688d;
  --sky: #d6ecf2;
  --pale: #e8f2f4;
  --yellow: #ffcb05;
  --grey: #6f777a;

  --bg: var(--pale);
  --card: #ffffff;
  --ink: var(--navy);
  --muted: var(--grey);
  --line: var(--sky);
  --good: #0f7b5f;
  --good-tint: #e2f4ee;
  --bad: #b00a30;
  --warn-bg: #fff6d1;
  --warn-ink: #5c4600;
  --radius: 16px;
  --page: 640px; /* content width; widens on bigger screens */
  --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Wix Madefor Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 var(--font-body);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
main { max-width: var(--page); margin: 0 auto; padding: 12px 16px; }
img, video { max-width: 100%; }
.nowrap { white-space: nowrap; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 10px; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 24px 0; }
.small { font-size: 0.85rem; }
.credit { font-size: 0.7rem; opacity: 0.8; }
.pre { white-space: pre-line; }

/* Top bar with logo */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-in {
  max-width: var(--page); margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar img { height: 34px; width: auto; display: block; }
.topbar .event { font-family: var(--font-head); font-weight: 600; font-size: 0.85rem; color: var(--navy); text-align: right; line-height: 1.2; }
.topbar .event span { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; }
.topbar #countdown { font-variant-numeric: tabular-nums; color: var(--raspberry); font-weight: 600; }
.topbar .event { min-width: 0; }
.topbar #team-name { display: block; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar #team-points { font-variant-numeric: tabular-nums; color: var(--raspberry); font-weight: 600; font-size: 0.85rem; }
.topbar #countdown.done { color: var(--muted); }
.event #countdown:not(:empty)::before { content: " · "; color: var(--muted); font-weight: 400; }
.brand-hero { text-align: center; padding: 28px 0 16px; }
.brand-hero img { width: 180px; max-width: 60%; height: auto; mix-blend-mode: multiply; } /* hides the JPG's white box */

.banner {
  position: sticky; top: 0; z-index: 10;
  background: var(--yellow); color: var(--navy); font-weight: 700; font-family: var(--font-head);
  padding: 10px 16px; text-align: center;
}

.header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px;
}
.header > * { min-width: 0; }
.header .place { flex-basis: 100%; text-align: center; font-size: 0.85rem; opacity: 0.85; margin-top: -4px; }
.header strong { overflow-wrap: anywhere; }
.header button { white-space: nowrap; min-height: 40px; padding: 8px 18px; flex: none; }
.header strong { font-family: var(--font-head); font-weight: 600; }
.header .score { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.header .label { font-size: 0.75rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.timeline { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 22px 10px; margin-bottom: 12px; }
.tl-rail { position: relative; height: 62px; }
.tl-place { text-align: center; font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); margin: 6px -10px 0; padding-top: 8px; }
/* Stage title and blurb under the timeline; tap the title to fold it away. */
.tl-blurb { border-top: 1px solid var(--line); margin: 6px -10px 0; padding: 8px 2px 0; }
.tl-blurb > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; padding-right: 22px; position: relative; }
.tl-blurb > summary::-webkit-details-marker { display: none; }
.tl-blurb > summary::after { content: "▸"; position: absolute; right: 2px; top: 1px; color: var(--muted); font-size: 1rem; }
.tl-blurb[open] > summary::after { content: "▾"; }
.tl-blurb-title { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; color: var(--navy); line-height: 1.3; }
.tl-blurb-place { font-size: 0.85rem; color: var(--muted); }
.tl-blurb-body { padding-top: 6px; }
.tl-blurb-body > :last-child { margin-bottom: 0; }
.tl-line { position: absolute; left: 0; right: 0; top: 34px; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--sky); }
.tl-progress { right: auto; background: var(--raspberry); }
.tl-late { right: auto; background: repeating-linear-gradient(90deg, var(--bad) 0 4px, transparent 4px 7px); height: 5px; margin-top: -2.5px; }
.tl-now { transition: opacity 0.3s; position: absolute; top: 25px; width: 2px; height: 18px; margin-left: -1px; border-radius: 1px; background: var(--navy); }
.tl-stop { position: absolute; top: 34px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--card); border: 2px solid var(--sky); box-sizing: border-box; }
.tl-stop.done .tl-dot { background: var(--raspberry); border-color: var(--raspberry); }
.tl-time { margin-top: 5px; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-stop.current .tl-time { color: var(--ink); font-weight: 700; }
.tl-boat { position: absolute; top: 4px; transform: translateX(-50%); line-height: 0; }


.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(1, 42, 53, 0.04);
}
.card.locked { opacity: 0.5; }
.card.done { border-color: var(--good); box-shadow: inset 4px 0 0 var(--good); }
.card.folded > summary { cursor: pointer; list-style: none; align-items: center; }
.card.folded > summary::-webkit-details-marker { display: none; }
.card.folded > summary h3 { margin: 0; }
.card.folded > summary h3::before { content: "✓ "; color: var(--good); }
.card.folded > summary .pts { color: var(--good); }
.card.folded > summary .pts::after { content: " ▸"; color: var(--muted); font-size: 0.8em; }
.card.folded[open] > summary { margin-bottom: 8px; }
.card.folded[open] > summary .pts::after { content: " ▾"; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.card-head > h3 { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.pts { font-family: var(--font-head); font-weight: 600; color: var(--raspberry); white-space: nowrap; }
/* Hint link under a card's points: lightbulb, "Hint −3". */
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0; margin-bottom: 6px; }
.hint-link {
  background: none; border: 0; padding: 8px 0 8px 12px; margin: -6px 0; min-height: 0; border-radius: 0; /* bigger tap area, same look */
  color: var(--muted); font-family: var(--font-body, inherit); font-weight: 500; font-size: 0.8rem; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
.hint-link:hover { background: none; color: var(--navy); text-decoration: underline; }
.hint-link:disabled { opacity: 0.5; }
.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--pale); color: var(--ink); }
.badge.good { background: var(--good-tint); color: var(--good); }
.badge.bad { background: var(--raspberry-tint); color: var(--bad); }
.badge.wait { background: var(--warn-bg); color: var(--warn-ink); }

.task { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.card.untitled > .task:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.task-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.task-act { display: flex; align-items: center; gap: 10px; flex: none; }
.task-act:has(.icon-btn) { margin-top: -6px; } /* keep the prompt's first line level with the button's middle */

/* Buttons: Nuj raspberry pills */
button, .btn {
  font: 600 0.95rem/1.2 var(--font-head); cursor: pointer;
  border: 0; border-radius: 999px; padding: 12px 22px;
  background: var(--raspberry); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; text-decoration: none; min-height: 46px;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--raspberry-dark); }
button.secondary, .btn.secondary { background: var(--pale); color: var(--navy); }
button.secondary:hover, .btn.secondary:hover { background: var(--sky); }
button.accent { background: var(--raspberry); color: #fff; }
button.dark { background: var(--navy); }
button.block, .btn.block { display: flex; width: 100%; }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
/* Rows wrap on narrow screens: the field takes the line, the button drops below and fills it. */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input, .row > select, .row > textarea { flex: 999 1 170px; min-width: 0; }
.row > button, .row > .btn { flex: 1 0 auto; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > input { flex: 1 1 auto; }
/* Round icon buttons: send, camera, video. */
.icon-btn, .row > .icon-btn { flex: none; width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 50%; }
.row > label.check { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
input.narrow { flex: 0 0 96px !important; width: 96px; }
.stack > * + * { margin-top: 10px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  font: inherit; width: 100%; padding: 11px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); min-height: 46px;
}
textarea { border-radius: 14px; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; }
.options { display: grid; gap: 8px; }
.options button {
  background: #fff; color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 14px; justify-content: flex-start; text-align: left;
  font-family: var(--font-body); font-weight: 500;
}
.options button:hover { background: var(--pale); }
.options button.right { border-color: var(--good); background: var(--good); color: #fff; }
.options button.wrong { border-color: var(--bad); background: var(--bad); color: #fff; }

.media { margin: 10px 0; }
.media img, .media video { width: 100%; border-radius: 12px; display: block; background: var(--pale); }
.media audio { width: 100%; }
.placeholder {
  border: 2px dashed var(--sky); border-radius: 12px; padding: 18px; text-align: center;
  color: var(--muted); font-size: 0.9rem; background: #fbfdfd;
}
.thumb { max-width: 160px; max-height: 160px; border-radius: 10px; display: block; margin-top: 6px; }
.progress { height: 8px; background: var(--pale); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--raspberry); width: 0; transition: width 0.2s; }
.msg { font-size: 0.9rem; margin-top: 8px; }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--good); }

.clue { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; line-height: 1.35; margin: 8px 0 14px; color: var(--navy); }
.clue::before { content: "“"; color: var(--raspberry); }
.clue::after { content: "”"; color: var(--raspberry); }
.travel-tip { margin: -4px 0 14px; font-size: 0.95rem; }
/* A travel clue with a heading reads like a stage blurb: same title style, plain text under it. */
.travel-heading { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; color: var(--navy); line-height: 1.3; margin: 6px 0 4px; }
.travel-text { margin: 0 0 14px; }
.voucher {
  border: 3px dashed var(--raspberry); border-radius: var(--radius); padding: 18px; text-align: center;
  background: var(--raspberry-tint); color: var(--navy);
}
.voucher .big { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; color: var(--raspberry); }

table.lb { width: 100%; border-collapse: collapse; }
table.lb td, table.lb th { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.lb th { font-family: var(--font-head); font-weight: 600; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
table.lb td.num, table.lb th.num { text-align: right; }


.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(1, 42, 53, 0.75);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box { background: var(--card); border-radius: var(--radius); padding: 16px; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
/* Square board that also fits short (landscape) screens */
.puzzle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; aspect-ratio: 1; width: min(100%, calc(100vh - 230px)); width: min(100%, calc(100dvh - 230px)); min-width: 180px; margin: 10px auto; touch-action: manipulation; }
.puzzle div { background-size: 300% 300%; border-radius: 6px; cursor: pointer; }
.puzzle div.blank { background: var(--pale) !important; cursor: default; }

ul.rules { padding-left: 20px; margin: 0 0 10px; }
ul.rules li { margin-bottom: 4px; }
ul.rules li::marker { color: var(--raspberry); }

/* ---- Responsive ------------------------------------------------------------ */

/* Small phones (iPhone SE and similar) */
@media (max-width: 380px) {
  main { padding: 10px 12px; }
  .topbar-in { padding: 6px 12px; }
  .topbar img { height: 30px; }
  .banner { font-size: 0.9rem; padding: 8px 12px; }
  .card { padding: 14px; }
  .header { padding: 10px 12px; gap: 8px; }
  .header .score { font-size: 1.45rem; }
  h1 { font-size: 1.35rem; }
  .clue { font-size: 1.15rem; }
  button, .btn { padding: 11px 16px; }
}

/* Phones on their side: don't let the banner eat the short screen */
@media (max-height: 480px) and (orientation: landscape) {
  .banner { position: static; }
}

/* Tablets */
@media (min-width: 700px) {
  :root { --page: 720px; }
  h1 { font-size: 1.75rem; }
  .clue { font-size: 1.45rem; }
}

/* Laptops and desktops: cards two across */
@media (min-width: 1000px) {
  :root { --page: 1080px; }
  main { padding: 20px 24px; }
  .topbar-in { padding: 10px 24px; }
  .topbar img { height: 40px; }
  .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
  .cards > .card { margin: 0; }
  .card .pre, .card > p { max-width: 75ch; }
  button.block.accent { max-width: 520px; margin-left: auto; margin-right: auto; }
}
.results > summary { cursor: pointer; list-style: none; align-items: center; }
.results > summary::-webkit-details-marker { display: none; }
.results > summary h3 { margin: 0; }
.results > summary h3::after { content: " ▸"; color: var(--muted); font-size: 0.8em; }
.results[open] > summary h3::after { content: " ▾"; }
.results-stage { margin-top: 12px; }
.results-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.results-row > div:last-child { flex-shrink: 0; }
.results-total { margin-top: 10px; }
