* { box-sizing: border-box; }
body { margin: 0; font-family: "Sarabun", -apple-system, "Segoe UI", Tahoma, sans-serif; background: #f6f6f4; color: #1c1c1c; line-height: 1.5; }
main { margin: 0 auto; padding: 16px; }
main.narrow { max-width: 30rem; }
main.wide { max-width: 88rem; }
h1 { font-size: 1.4rem; }
label { display: block; margin-top: 12px; }
input:not([type=checkbox]) { display: block; width: 100%; padding: 10px; font-size: 1rem; border: 1px solid #bbb; border-radius: 6px; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
small { color: #b00020; display: block; }
.req { color: #b00020; font-weight: 600; font-size: .9em; }
.opt { color: #666; font-size: .9em; }
p.help { margin: 4px 0 0; }
button { margin-top: 12px; padding: 10px 18px; font-size: 1rem; border: 0; border-radius: 8px; background: linear-gradient(135deg, #12857b 0%, #0f6a63 55%, #0b4f4a 100%); color: #fff; font-weight: 600; cursor: pointer; }
a { color: #0f6a63; }
input[type=checkbox] { accent-color: #0f6a63; }
input:focus-visible { outline: 2px solid #0f6a63; outline-offset: 1px; }
.band { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 20px 16px; background: radial-gradient(500px 200px at 15% 20%, rgba(30, 170, 156, .35), transparent 60%), linear-gradient(155deg, #031715 0%, #052321 38%, #083a36 72%, #0b4f4a 100%); }
.lang { position: absolute; top: 8px; right: 10px; z-index: 5; padding: 4px 10px; border-radius: 999px; background: #fff; color: #8a8790; font-size: 13px; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); }
.lang a { color: #6c6a70; text-decoration: none; padding: 2px 3px; }
.lang a[aria-current="true"] { color: #0f6a63; font-weight: 700; }
.lang ~ .band { padding-top: 40px; }
.band .mark { width: 46px; height: auto; }
.band .word { height: 42px; width: auto; }
button:disabled { opacity: .5; }
button.secondary { background: #666; }
.code { font-size: 3.2rem; font-weight: 700; letter-spacing: .05em; text-align: center; margin: 4px 0 16px; color: #0b4f4a; }
/* The current event's picture above the form: whole, never cropped, and never so tall that the form is far down. */
.reg-promo { display: block; width: 100%; height: auto; max-height: 30vh; object-fit: contain; border-radius: 10px; }
.done { text-align: center; }
.actions { text-align: center; }
a.button { display: inline-block; padding: 14px 22px; border-radius: 8px; color: #fff; font-weight: 600; text-decoration: none; background: linear-gradient(135deg, #12857b 0%, #0f6a63 55%, #0b4f4a 100%); }
.done h2 { font-size: 1.55rem; line-height: 1.4; margin: 20px 0 12px; }
.done h2 span { display: inline-block; }
.done .event { font-size: clamp(30px, 6vw, 40px); font-weight: 800; line-height: 1.3; color: #c62828; overflow-wrap: anywhere; }
.event-head { margin: 0 0 6px; font-size: clamp(30px, 6vw, 40px); font-weight: 800; line-height: 1.3; color: #c62828; overflow-wrap: anywhere; }
.event-date { margin: 0 0 18px; font-size: 18px; font-weight: 600; color: #3b3940; }
.error { color: #b00020; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row button { margin-top: 0; }
.picker.auto button { display: none; }
.picker label { flex: 0 1 24rem; min-width: 0; }  /* a long event name must not widen a narrow phone */
.picker select { width: 100%; min-width: 0; }
.quiet { font-size: .85rem; opacity: .7; }

/* Staff bar: brand at the left, pages, then the account. Below 760px the pages fold behind ≡ (CSS only). */
.topbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; padding: 8px 16px; color: #fff; background: linear-gradient(155deg, #031715 0%, #052321 38%, #083a36 72%, #0b4f4a 100%); }
.topbar .home-logo { display: flex; align-items: center; gap: 8px; }
.topbar .home-logo img { height: 30px; width: auto; }
.topbar .home-logo .word { height: 26px; }
.topbar .menu { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; flex: 1; }
.topbar .menu a { color: #fff; text-decoration: none; padding: 7px 12px; border-radius: 8px; }
.topbar .menu a:hover { background: rgba(255, 255, 255, .12); }
.topbar .menu a[aria-current="page"] { background: #fff; color: #0b4f4a; font-weight: 700; }
.topbar .who { margin-left: auto; color: rgba(255, 255, 255, .75); font-size: .9rem; }
.pw { display: flex; gap: 6px; align-items: center; }
.pw input:not([type=checkbox]) { flex: 1; min-width: 0; }
button.eye { margin: 0; padding: 8px; display: grid; place-items: center; background: transparent; border: 1px solid #bbb; color: #555; }
button.eye[aria-pressed="false"] .slash { display: none; }
.topbar form { margin: 0; }
.topbar button { margin: 0 0 0 8px; padding: 6px 14px; background: transparent; border: 1px solid rgba(255, 255, 255, .6); font-size: .9rem; }
.topbar .drop { position: relative; margin: 0; }
.topbar .drop summary { color: #fff; margin: 0; padding: 7px 12px; border-radius: 8px; list-style: none; cursor: pointer; }
.topbar .drop summary::-webkit-details-marker { display: none; }
.topbar .drop summary::after { content: " ▾"; }
.topbar .drop summary.here { background: #fff; color: #0b4f4a; font-weight: 700; }
.topbar .drop > div { position: absolute; z-index: 20; left: 0; top: 100%; min-width: 11rem; padding: 6px; background: #06302c; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); display: flex; flex-direction: column; }
.state { padding: 2px 10px; border-radius: 999px; }
.state.on { background: #e5f4ea; color: #14532d; }
.state.off { background: #fdecf2; color: #8c0e2d; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 10px; margin: 12px 0; }
.tile { background: #fff; border: 1px solid #ddd; border-radius: 12px; padding: 10px 14px; }
.tile span { display: block; color: #666; font-size: .9rem; }
.tile b { display: block; font-size: 1.9rem; color: #0b4f4a; font-variant-numeric: tabular-nums; }
.shortcuts { margin: 14px 0; }
a.button { padding: 10px 18px; border-radius: 8px; }
.homeqr { max-width: 20rem; text-align: center; overflow-wrap: anywhere; }
.homeqr .qr-code { width: 100%; height: auto; aspect-ratio: 1; display: block; }
.chartbox { background: #fff; border: 1px solid #ddd; border-radius: 12px; padding: 8px; max-width: 60rem; }
.chart { width: 100%; height: auto; display: block; }
.card { background: #fff; border: 1px solid #ddd; border-radius: 12px; padding: 4px 16px 12px; margin-bottom: 14px; overflow-wrap: anywhere; }
.card h2 { margin-bottom: 4px; font-size: 1.2rem; }
.card h3 { margin: 10px 0 0; font-size: 1rem; }
.titlebar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.titlebar h1 { margin: 8px 0; }
.modal { width: min(30rem, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 12px; overflow: auto; }
.modal::backdrop { background: rgba(3, 23, 21, .6); }
.modal-box { padding: 4px 20px 20px; }
.modal h2 { margin-bottom: 4px; font-size: 1.2rem; }
.actions-row { margin-top: 16px; }
/* In a pop-up that is itself the question, "cancel" looks like the cancel button of the others. */
form[data-once] a.cancel { display: inline-block; padding: 10px 18px; border-radius: 8px; background: #666; color: #fff; font-weight: 600; text-decoration: none; }
.modal.wide { width: min(42rem, 94vw); }
.prizefields { margin: 14px 0 0; padding: 4px 12px 12px; border: 1px solid #ddd; border-radius: 10px; min-width: 0; }
.prizefields legend { padding: 0 6px; font-weight: 600; }
.prizerow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 8px; }
.prizerow .pplace { flex: 0 0 4.5rem; }
.prizerow .pname { flex: 1 1 0; min-width: 6rem; }
.prizes input[name=place] { width: 5rem; }
@media (max-width: 480px) { .prizerow .pplace { flex-basis: 100%; } .prizerow .pplace input { width: 6rem; } }
.prizerow .pqty { flex: 0 0 5rem; }
.prizerow .rm { flex: 0 0 44px; box-sizing: border-box; width: 44px; height: 44px; margin: 0 0 1px; padding: 0; border: 1px solid #b00020; border-radius: 6px; background: #fff; color: #b00020; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.prizerow label.rm { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.prizerow label.rm input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.prizerow label.rm:focus-within { outline: 2px solid #0f6a63; outline-offset: 1px; }
.prizerow .rm:disabled { border-color: #bbb; color: #999; cursor: not-allowed; }
.prizerow small { flex-basis: 100%; }
.prizerow .gone { display: none; color: #b00020; }
.prizerow:has(.rm input:checked) .gone { display: block; }
.prizerow:has(.rm input:checked) .rm { background: #b00020; color: #fff; }
.prizerow:has(.rm input:checked) .pname input { text-decoration: line-through; color: #999; }
.prizes { width: 100%; margin: 8px 0; }
.prizes td { vertical-align: middle; }
.prizes input { margin: 0; }
.prizes input[type=number] { width: 6rem; }
.prizes .taken { white-space: nowrap; }
.prizes .do { white-space: nowrap; } /* save and delete side by side */
.prizes .do button { margin: 0 4px 0 0; padding: 5px 10px; font-size: .875rem; border-radius: 6px; }
.prizes .do small { white-space: normal; }
@media (min-width: 601px) {
  .prizes td { padding-left: 4px; padding-right: 4px; }
  .prizes input[name=place] { width: 4rem; }
  .prizes input[type=number][name=quantity] { width: 4.5rem; }
}
/* On a phone: still small, but easy to hit with a thumb. */
@media (max-width: 600px) { .prizes .do button { min-height: 40px; padding: 8px 16px; margin-right: 8px; } }
.prizes .do details { display: inline-block; vertical-align: middle; }
.prizes .do details summary { margin: 0; color: #b00020; }
.prizes .do small { display: block; }
.prizes tr.new td { background: #f4f9f8; }
@media (max-width: 600px) {
  .modal.wide { width: 100%; }
  .prizes, .prizes tbody, .prizes tr, .prizes td { display: block; }
  .prizes tr.head { display: none; }
  .prizes tr { border: 1px solid #ddd; border-radius: 10px; padding: 8px; margin-bottom: 8px; }
  .prizes td { border: 0; padding: 3px 0; }
  .prizes td:empty { display: none; }
  .prizes td[data-label]::before { content: attr(data-label); display: block; color: #666; font-size: .9em; }
  .prizes input:not([type=checkbox]) { width: 100%; }
}
.events { width: 100%; }
.events td { vertical-align: top; }
.events .state { display: inline-block; margin: 0 4px 4px 0; font-size: .85rem; white-space: nowrap; }
.state.now { background: #0f6a63; color: #fff; }
.state.idle { background: #eee; color: #444; }
button.danger { background: #b00020; }
.promocard { padding-top: 4px; }
.promo-preview { display: block; max-width: 100%; max-height: 320px; height: auto; border-radius: 8px; }
.qrcard { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: flex-start; padding-top: 12px; }
.qrbox { flex: 0 0 auto; margin: 0 auto; }
.qrbox .qr-code { display: block; width: min(260px, 78vw); height: auto; }
.qrside { flex: 1 1 18rem; min-width: 0; }
.qrside h2 { margin: 0 0 6px; }
.qrside .row button { margin-top: 8px; }
.qrside .row a.button { margin-top: 8px; }
.eventhead h1 { overflow-wrap: anywhere; color: #c62828; }
.eventhead > div { min-width: 0; flex: 1 1 0; }
.tabs { display: flex; gap: 4px; margin: 14px 0; border-bottom: 2px solid #0f6a63; }
.tabs a { padding: 10px 18px; border-radius: 8px 8px 0 0; text-decoration: none; font-weight: 600; background: #fff; border: 1px solid #ddd; border-bottom: 0; }
.tabs a[aria-current="page"] { background: #0f6a63; border-color: #0f6a63; color: #fff; }
.toolbar { margin: 14px 0; align-items: flex-start; }
.toolbar form { margin: 0; }
.toolbar button { margin-top: 0; }
.toolbar .card { padding: 12px 16px; margin: 8px 0 0; max-width: 24rem; }
summary.asbutton { display: inline-block; margin: 0; padding: 10px 18px; border-radius: 8px; color: #fff; font-weight: 600; list-style: none; background: linear-gradient(135deg, #12857b 0%, #0f6a63 55%, #0b4f4a 100%); }
summary.asbutton::-webkit-details-marker { display: none; }
.drawform input[type=number] { display: inline-block; width: 6rem; margin: 0 6px 0 0; }
.drawform button { margin-top: 0; }
button.busy { opacity: .5; pointer-events: none; }
/* A list of winners on the projector: two across, five down, readable from far away. */
.stage.many { padding-top: 1vh; }
.stageround { margin: 0; font-size: clamp(1rem, 2vh, 1.4rem); color: #555; }
.stageprize { margin: 1.2vh 0 .8vh; font-size: clamp(1.6rem, 4.2vh, 3rem); color: #c62828; overflow-wrap: anywhere; }
.winners { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1vh 1vw; margin: 0; padding: 0; list-style: none; text-align: center; }
.winners li { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: .6vh 8px; overflow-wrap: anywhere; line-height: 1.25; }
.winners b { display: block; font-size: clamp(1.2rem, 3.6vh, 2.6rem); }
.winners span { font-size: clamp(1rem, 2.8vh, 2rem); font-variant-numeric: tabular-nums; }
.winners small { display: inline; margin-left: 12px; color: #555; font-size: clamp(.8rem, 1.8vh, 1.2rem); }
.turn { margin: 1.5vh 0 0; }
.groups.crowded { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5vw; align-items: start; }
.groups.crowded .winners { grid-template-columns: 1fr; }
.groups.crowded .stageprize { font-size: clamp(1.4rem, 3.4vh, 2.4rem); }
@media (max-width: 600px) { .groups.crowded { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .winners { grid-template-columns: 1fr; } }
/* The code to scan for one event, also shown full screen at the door. */
.qrpage { text-align: center; background: #f6f6f4; }
.qrpage:fullscreen { overflow: auto; padding: 2vh 4vw; background: #fff; }
.qrpage:fullscreen .qractions, .qrpage:fullscreen .opt { display: none; }
.qrpage h1.event-head { margin: 8px 0 4px; }
/* The heading above a QR code (event_head.html); the same in login.css for the public pages. */
:root { --event-blue: #1e3a8a; }
.eventtitle { text-align: center; margin: 0 0 14px; }
.eventtitle h1.event-head { margin: 8px 0 2px; }
.eventtitle h3.event-day { margin: 0; font-size: clamp(20px, 3.5vw, 26px); font-weight: 700; line-height: 1.35; color: var(--event-blue); }
.eventtitle h6.event-time { margin: 2px 0 0; font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--event-blue); }
.bigqr .qr-code { display: block; width: min(92vw, 62vh, 640px); height: auto; margin: 0 auto; }
.qrhow { margin: 6px 0; font-size: 1.1rem; }
.qractions { justify-content: center; margin-top: 12px; }
.warn { background: #fff8e1; border: 2px solid #e0a800; border-radius: 12px; padding: 4px 16px 12px; margin: 8px 0 12px; }
.warn form button { margin-top: 0; }
/* One gear per table row; its menu opens below it, against the right edge. */
.gear { position: relative; display: inline-block; }
.gear > summary { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 36px; margin: 0; border: 1px solid #0f6a63; border-radius: 8px; background: #fff; color: #0f6a63; font-size: 1.3rem; list-style: none; }
.gear > summary::-webkit-details-marker { display: none; }
.gear[open] > summary { background: #0f6a63; color: #fff; }
.gearmenu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; width: 15rem; padding: 6px 0; background: #fff; border: 1px solid #ccc; border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); text-align: left; }
.gearmenu form { margin: 0; }
.gearmenu a, .gearmenu button, .gearmenu .confirm > summary { display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 10px 16px; border: 0; border-radius: 0; background: none; color: #1c1c1c; font: inherit; font-weight: 400; text-align: left; text-decoration: none; cursor: pointer; }
.gearmenu a:hover, .gearmenu a:focus-visible, .gearmenu button:hover:not(:disabled), .gearmenu button:focus-visible, .gearmenu .confirm > summary:hover { background: #e6f3f1; }
.gearmenu .danger { color: #b00020; }
.gearmenu button:disabled { color: #999; cursor: not-allowed; }
.gearmenu small { display: block; padding: 0 16px 6px; color: #666; }
.gearmenu .confirm form button { color: #b00020; font-weight: 600; }
@media (max-width: 600px) {
  .modal { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
}
.secret { background: #fff8e1; border: 2px solid #e0a800; border-radius: 12px; padding: 4px 16px; margin: 12px 0; }
.secret code { font-size: 1.5rem; user-select: all; overflow-wrap: anywhere; }
.navtoggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.navbutton { display: none; }
@media (max-width: 1100px) {
  .topbar { justify-content: space-between; }
  .navbutton { display: block; margin: 0; padding: 0 12px; font-size: 1.8rem; line-height: 1.4; border: 1px solid rgba(255, 255, 255, .5); border-radius: 8px; cursor: pointer; }
  .navtoggle:focus-visible + .navbutton { outline: 2px solid #fff; outline-offset: 2px; }
  .topbar .menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
  .navtoggle:checked ~ .menu { display: flex; }
  .topbar .who { margin: 6px 12px 0; }
  .topbar .drop > div { position: static; box-shadow: none; background: transparent; padding: 0 0 0 16px; }
  .topbar button { width: 100%; margin: 4px 0 0; }
}
select { padding: 9px; font-size: 1rem; border: 1px solid #bbb; border-radius: 6px; max-width: 82vw; }
.row label select { display: block; }
details summary { cursor: pointer; color: #0f6a63; margin-top: 6px; }
td form { margin: 6px 0 0; }
td form button { margin-top: 6px; }
.row label input:not([type=checkbox]) { width: min(22rem, 82vw); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border: 1px solid #ddd; padding: 6px 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { overflow-wrap: normal; }
input, select, textarea { max-width: 100%; }
textarea { display: block; width: 100%; padding: 10px; font: inherit; font-size: 1rem; border: 1px solid #bbb; border-radius: 6px; resize: vertical; }
.confirmbox p { white-space: pre-line; overflow-wrap: anywhere; }
.modal label select { display: block; width: 100%; max-width: 100%; }

/* Registrations: a full table on a computer; on a tablet the less used columns fold into each row;
   on a phone each row is a card. The page never scrolls sideways. */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0; }
.pager[hidden] { display: none; }
.pager a, .pager b, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; box-sizing: border-box; padding: 0 10px; border-radius: 8px; text-decoration: none; }
.pager a { border: 1px solid #0f6a63; background: #fff; color: #0f6a63; }
.pager b { background: #0f6a63; color: #fff; }
.pager span.off { color: #999; border: 1px solid #ddd; }
.people .more { display: none; font-size: .9em; }
.people .c-code, .people .c-phone, .people .c-time { white-space: nowrap; overflow-wrap: normal; }
.people .c-email { max-width: 16rem; }
.people .c-line { max-width: 19rem; }
.people .uid { font-size: .8em; color: #666; overflow-wrap: anywhere; }
@media (max-width: 1199.98px) {
  .people .c-email, .people .c-lineid { display: none; }
  .people .more { display: block; }
}
@media (max-width: 600px) {
  .people, .people tbody { display: block; background: transparent; }
  .people thead { display: none; }
  .people tr { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; background: #fff; border: 1px solid #ddd;
    border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .people td { border: 0; padding: 1px 0; grid-column: 1 / -1; white-space: normal; }
  .people td.c-code { grid-column: 1; grid-row: 1; font-size: 1.5rem; font-weight: 700; color: #0b4f4a; }
  .people td.c-time { grid-column: 2; grid-row: 1; align-self: center; color: #666; white-space: nowrap; }
  .people td.c-name { font-size: 1.1rem; font-weight: 600; }
  .people td.c-name .more { font-weight: 400; }
  .people td.c-event { color: #0f6a63; }
  .people td.c-line { max-width: none; margin-top: 4px; border-top: 1px dashed #ddd; padding-top: 4px; }
}

/* Draw results and events: cards with labels when the table would not fit. */
@media (max-width: 1099.98px) {
  .stack, .stack tbody, .stack tr, .stack td { display: block; }
  .stack { background: transparent; }
  .stack tr.head { display: none; }
  .stack tr { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
  .stack td { border: 0; padding: 2px 0; }
  .stack td::before { content: attr(data-label) ": "; color: #666; }
  .stack td:empty { display: none; }
  /* In a card the menu opens in place: it can never leave the screen. */
  .stack .gearmenu { position: static; width: 100%; margin-top: 4px; box-shadow: none; }
  .stack .gear[open] { display: block; }
}
.stage { text-align: center; padding-top: 10vh; }
.stage .prize { font-size: 2.5rem; }
.stage .winner { font-size: 4rem; font-weight: 700; }
.stage .phone { font-size: 5rem; font-variant-numeric: tabular-nums; }
