/*
 * KYN Weekly Creative Challenge - stylesheet.
 * Written for phones first; wider screens are handled further down.
 * The accent colour comes from the admin site (see :root in the page head).
 */

/* ---------- Font ---------- */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/poppins-600.woff2") format("woff2");
}

/* ---------- Colours and sizes ---------- */
:root {
  --accent: #F03A1F;        /* buttons, active items, icons */
  --accent-soft: #FDE7E3;   /* active menu fill */
  --accent-ink: #C53019;    /* accent for small text */
  --ink: #18322E;           /* headings and main text */
  --muted: #5B6563;         /* secondary text */
  --bg: #F2F2F2;            /* page background */
  --panel: #FFFFFF;         /* panels and cards */
  --chip: #EFEFEF;          /* menu buttons */
  --line: #E4E4E4;
  --ok-bg: #E3F4EA;   --ok-ink: #14683A;
  --warn-bg: #FFF2D6; --warn-ink: #7A5200;
  --bad-bg: #FDE7E3;  --bad-ink: #B3240F;
  --r-panel: 24px;
  --r-card: 20px;
  --shadow: 0 6px 24px rgba(24, 50, 46, .08);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { flex: 0 0 auto; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
}
.skip-link:focus { top: 12px; }

/* ---------- Notice bar ---------- */
.notice-bar {
  background: var(--ink); color: #fff; text-align: center;
  font-size: 13px; padding: 8px 14px;
}

/* ---------- Page frame (phone) ---------- */
.app-main {
  padding: 12px 14px calc(104px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
}
.content { min-width: 0; }

/* ---------- Sidebar. On a phone it is the slide-out menu. ---------- */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
  width: min(84vw, 300px);
  background: var(--panel);
  border-radius: 0 var(--r-panel) var(--r-panel) 0;
  padding: 20px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
}
body.drawer-open .sidebar {
  transform: none; visibility: visible;
  transition: transform .22s ease;
}
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(24, 50, 46, .45);
}
.drawer-backdrop[hidden] { display: none; }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 17px; line-height: 1.1;
}
.brand img { height: 36px; width: auto; }
.brand-mobile { font-size: 15px; }
.brand-mobile img { height: 30px; }

.menu-label { font-size: 13px; color: var(--muted); margin: 20px 0 10px 6px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 16px;
  background: var(--chip); color: var(--ink);
  border-radius: 999px; text-decoration: none; font-size: 14px;
}
.menu-item:hover { background: #E6E6E6; }
.menu-item.is-active {
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}
.menu-item.is-active::before {
  content: ""; position: absolute; left: -20px; top: 50%;
  width: 4px; height: 26px; transform: translateY(-50%);
  background: var(--accent); border-radius: 0 4px 4px 0;
}
.menu-bottom {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.sidebar .menu:not(.menu-bottom) { margin-bottom: 18px; }

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "menu brand actions" "search search search";
  align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.menu-btn { grid-area: menu; }
.brand-mobile { grid-area: brand; min-width: 0; }
.brand-mobile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { grid-area: actions; display: flex; align-items: center; gap: 8px; }
.topbar-title { grid-area: search; font-weight: 600; font-size: 18px; }

.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--panel); color: var(--ink);
  display: grid; place-items: center; padding: 0;
}
.sidebar .icon-btn { background: var(--chip); }

.search {
  grid-area: search;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-radius: 999px;
  padding: 0 18px; min-height: 48px; color: var(--muted);
}
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-size: 15px; padding: 10px 0;
}
.search input::placeholder { color: #8A9290; }
.search:focus-within { outline: 3px solid var(--accent-soft); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: #fff; text-decoration: none;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
}

/* ---------- Bottom bar (phones only) ---------- */
.bottombar {
  position: fixed; z-index: 50;
  left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--panel); border-radius: 24px;
  padding: 8px 4px 6px;
  box-shadow: 0 8px 28px rgba(24, 50, 46, .16);
}
.bb-item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
  min-height: 50px; padding: 0 2px;
  color: var(--muted); text-decoration: none;
  font-size: 11px; line-height: 1.2; text-align: center;
}
.bb-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-icon { display: grid; place-items: center; width: 28px; height: 28px; }
.bb-item.is-active { color: var(--accent-ink); font-weight: 600; }
.bb-submit { color: var(--accent-ink); font-weight: 600; }
.bb-submit .bb-icon {
  width: 46px; height: 46px; margin-top: -24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 16px rgba(24, 50, 46, .28);
  border: 4px solid var(--panel);
}

/* ---------- Text ---------- */
.h1 { font-size: 22px; font-weight: 600; line-height: 1.25; }
.h2 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.muted { color: var(--muted); }
.center { text-align: center; }
.greeting { font-size: 18px; font-weight: 400; margin: 4px 2px 14px; line-height: 1.3; }
.greeting strong { font-weight: 600; }

/* Page text written in the admin editor */
.prose h2 { font-size: 17px; font-weight: 600; margin: 22px 0 8px; }
.prose h3 { font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose > :first-child { margin-top: 0; }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border-radius: var(--r-panel); padding: 20px; margin-bottom: 16px; }
.panel > * + * { margin-top: 12px; }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.empty { background: var(--panel); border-radius: var(--r-card); padding: 32px 16px; text-align: center; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 22px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 999px;
  font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.2;
}
.btn:hover { filter: brightness(.95); }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-ghost { background: var(--panel); color: var(--ink); }
.btn-grey { background: var(--chip); color: var(--ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.btn-block { display: flex; width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input, .field input[type="text"], .field input[type="email"], .field input[type="tel"],
.field input[type="password"], .field input[type="date"], .field input[type="number"],
.field input[type="datetime-local"], .field input[type="time"],
.field input[type="url"], .field select, .field textarea {
  display: block; width: 100%; min-height: 48px;
  padding: 11px 14px; background: #fff;
  border: 1.5px solid #D5D5D5; border-radius: 14px;
  font-size: 16px; /* 16px stops phones zooming in on the field */
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--accent); outline: 3px solid var(--accent-soft);
}
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--bad-ink); margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 12px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.trap { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Messages ---------- */
.alert { padding: 12px 16px; border-radius: 16px; margin-bottom: 14px; font-size: 14px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--bad-bg); color: var(--bad-ink); }
.alert-info { background: var(--panel); color: var(--ink); border: 1.5px solid var(--line); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--chip); color: var(--ink);
}
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-bad { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- "What is open now" strip ---------- */
.status-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  background: var(--panel); border-radius: var(--r-card);
  padding: 12px 16px; margin-bottom: 14px; font-size: 14px;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.status-strip strong { font-weight: 600; }
.countdown { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.status-strip .btn { margin-left: auto; }

/* ---------- Banners ---------- */
.banners { margin-bottom: 18px; }
.banner-track {
  display: flex; gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
  border-radius: var(--r-panel);
}
.banner-track::-webkit-scrollbar { display: none; }
.banner {
  position: relative; overflow: hidden; isolation: isolate;
  flex: 0 0 100%; scroll-snap-align: start;
  min-height: 176px; padding: 22px;
  border-radius: var(--r-panel);
  display: flex; align-items: center;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .14), rgba(0, 0, 0, 0) 70%),
    linear-gradient(100deg, var(--b1, #F03A1F), var(--b2, #FF6A3D));
}
.banner.is-light {
  color: var(--ink);
  background: linear-gradient(100deg, var(--b1), var(--b2));
}
/* Simple shapes on the right. The admin can add a photo later. */
.banner::before, .banner::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}
.banner::before { width: 190px; height: 190px; right: -50px; top: -60px; }
.banner::after { width: 120px; height: 120px; right: 46px; bottom: -58px; background: rgba(255, 255, 255, .12); }
.banner-img {
  position: absolute; z-index: -1; right: 0; top: 0;
  width: 46%; height: 100%; object-fit: cover;
  /* the picture fades into the banner colour on its left edge */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 32%);
  mask-image: linear-gradient(90deg, transparent, #000 32%);
}
.banner.has-img::before, .banner.has-img::after { display: none; }
.banner.has-img .banner-body { max-width: 56%; }
.banner-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 74%; }
.banner-tag {
  font-size: 12px; padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .4);
}
.banner.is-light .banner-tag { background: rgba(255, 255, 255, .45); border-color: rgba(24, 50, 46, .18); }
.banner-title { font-size: 22px; font-weight: 600; line-height: 1.2; }
.banner-text { font-size: 14px; line-height: 1.45; }
.banner-btn {
  margin-top: 4px; display: inline-flex; align-items: center;
  min-height: 40px; padding: 8px 18px; border-radius: 999px;
  background: #fff; color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 10px; }
.dot {
  position: relative; width: 8px; height: 5px; padding: 0; border: 0;
  border-radius: 999px; background: #C9C9C9; transition: width .2s ease;
}
.dot::after { content: ""; position: absolute; inset: -12px -3px; }  /* bigger tap area */
.dot.is-active { width: 22px; background: var(--accent); }

/* ---------- Category chips ---------- */
.chips {
  display: flex; gap: 10px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  padding: 2px; margin: 0 -2px 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 18px;
  background: var(--panel); color: var(--ink);
  border-radius: 999px; text-decoration: none; font-size: 14px;
}
.chip .icon { color: var(--accent); }
.chip.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ---------- Section headings ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 2px 12px; }
.section-title { font-size: 17px; font-weight: 600; }
.section-tools { display: flex; align-items: center; gap: 8px; }
.pill-link {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 36px; padding: 4px 14px; border-radius: 999px;
  background: var(--panel); color: var(--ink); text-decoration: none; font-size: 13px;
}
.round-btn {
  display: none; place-items: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--panel); color: var(--ink);
}
.round-btn[disabled] { opacity: .4; cursor: default; }

/* ---------- Entry cards ---------- */
.card-grid, .card-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.entry-card {
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 3 / 4; border-radius: var(--r-card);
  background: #D9DDDC;
}
.entry-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.entry-img-empty { background: linear-gradient(160deg, #9AA5A2, #5B6563); }
.entry-link { position: absolute; inset: 0; z-index: 1; }
.entry-tag, .entry-badge {
  position: absolute; z-index: 2; top: 10px; left: 10px; pointer-events: none;
  max-width: calc(100% - 66px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; line-height: 1.5; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .9); color: var(--ink);
}
.entry-badge {
  top: 38px;   /* sits just under the category tag */
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.has-badge .entry-tag { max-width: calc(100% - 20px); }
.entry-vote { margin: 0; }
.heart-btn {
  position: absolute; z-index: 3; top: 8px; right: 8px;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: #fff; color: var(--accent);
  display: grid; place-items: center; text-decoration: none;
}
.heart-btn:hover .icon, .heart-btn.is-voted .icon { fill: var(--accent); }
.entry-play {
  position: absolute; z-index: 2; left: 50%; top: 42%;
  width: 50px; height: 50px; transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff;
  display: grid; place-items: center; pointer-events: none;
}
.entry-play .icon { margin-left: 3px; fill: #fff; }
.entry-info {
  position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px;
  padding: 9px 11px; border-radius: 14px; pointer-events: none;
  background: rgba(16, 24, 22, .62); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.entry-title {
  font-size: 13.5px; font-weight: 600; line-height: 1.25; margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry-by, .entry-votes { display: flex; align-items: center; gap: 5px; font-size: 12.5px; line-height: 1.5; }
.entry-by span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Account pages: join, log in, reset, account ---------- */
.narrow-wide { max-width: 640px; }
.panel form > .btn { margin-top: 4px; }
.form-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px;
  margin-top: 16px; font-size: 14px; color: var(--muted);
}
.form-foot.center { display: block; text-align: center; }
.form-foot form { margin: 0; }
.link-btn {
  min-height: 40px; padding: 8px 4px; border: 0; background: none;
  color: var(--accent-ink); text-decoration: underline; font-size: 14px;
}
.field input.code-input {
  text-align: center; letter-spacing: .4em; font-size: 24px; font-weight: 600;
  padding-left: 14px; padding-right: 4px;
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--muted); display: grid; place-items: center;
}
.pw-toggle.is-on { color: var(--accent-ink); }
.fieldset {
  min-width: 0; margin: 0 0 16px; padding: 12px 16px 2px;
  border: 1.5px solid var(--line); border-radius: 16px;
}
.fieldset legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.fieldset > .hint { margin: 0 0 12px; }
.fieldset[hidden] { display: none; }
.field-check { margin-bottom: 14px; }
.field-check .check { margin-bottom: 4px; }
.has-error input { border-color: var(--bad-ink); }
.readonly-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 600; }

/* ---------- Admin site ---------- */
body.is-admin .app-main { padding-bottom: 32px; }
/* The admin menu is long, so it is a little tighter. */
body.is-admin .menu { gap: 5px; }
body.is-admin .menu-item { min-height: 40px; padding: 8px 16px; }
body.is-admin .menu-label { margin: 12px 0 6px 6px; }
body.is-admin .sidebar .menu:not(.menu-bottom) { margin-bottom: 8px; }
body.is-admin .menu-bottom { padding-top: 10px; }
.inline-form { display: inline; margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.section-title.plain { margin: 22px 2px 12px; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin-bottom: 4px; }
.panel > .clock-lines { margin-top: 12px; font-size: 14px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.hide-small { display: none; }

/* Headline numbers */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border-radius: var(--r-card); padding: 16px; }
.stat-label { font-size: 13px; color: var(--muted); line-height: 1.35; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 6px; color: var(--ink); }

/* Meter: the fill shows how serious it is; the track is a paler step of the same colour */
.meter-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meter-line strong { font-size: 22px; font-weight: 600; }
.meter { height: 12px; border-radius: 999px; overflow: hidden; background: #DDEFE5; }
.meter span { display: block; height: 100%; min-width: 4px; border-radius: 999px; background: #1E7A4A; }
.meter-warn { background: #FCEFD2; }
.meter-warn span { background: #B7791F; }
.meter-bad { background: #FBDAD3; }
.meter-bad span { background: #C53019; }

/* Warnings and notes: an icon and a word, never colour alone */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.panel > .notes { margin-top: 14px; }
.note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.note .icon { margin-top: 2px; color: var(--muted); }
.note-warn .icon { color: var(--warn-ink); }
.note-bad .icon { color: var(--bad-ink); }

/* Contests list */
.switch-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.switch-panel > * { margin-top: 0; }
.week-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.week-times { margin-top: 6px; }
.cell-action { text-align: right; white-space: nowrap; }
.table td.cell-action { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.table-wrap.flat { background: none; border-radius: 0; }
.table-wrap.flat .table th:first-child, .table-wrap.flat .table td:first-child { padding-left: 0; }
.table-wrap.flat .table th:last-child, .table-wrap.flat .table td:last-child { padding-right: 0; }
.sub-row td { border-top: 0; padding-top: 0; }
.sub-row summary { cursor: pointer; font-size: 13px; color: var(--accent-ink); }
.inline-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 10px; }
.inline-fields .field { margin-bottom: 0; flex: 1 1 220px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 16px; margin: 0 0 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.filter-row .input { width: auto; min-height: 40px; padding: 6px 12px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 14px; }
.pager .pill-link { background: var(--chip); }
.panel .pill-link { background: var(--chip); }

/* Front-end editor pages */
.field input[type="file"] {
  display: block; width: 100%; max-width: 100%; padding: 10px 12px; background: #fff;
  border: 1.5px dashed #C9C9C9; border-radius: 14px; font-size: 14px;
}
.field input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 999px;
  background: var(--chip); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
.color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.color-input {
  width: 64px; height: 48px; padding: 4px; background: #fff; cursor: pointer;
  border: 1.5px solid #D5D5D5; border-radius: 14px;
}
.color-code { font-weight: 600; font-variant-numeric: tabular-nums; }
.color-sample { pointer-events: none; }
.swatch {
  display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px;
  border-radius: 50%; border: 1px solid rgba(24, 50, 46, .25);
}
.thumb { max-width: 220px; max-height: 140px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 10px; }
body.is-admin .round-btn.small { display: inline-grid; width: 40px; height: 40px; background: var(--chip); }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }
.with-icon .icon { color: var(--accent); }
.theme-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }
.day-time .inline-fields { margin-top: 0; margin-bottom: 14px; }
.day-time > .field-error { margin: -6px 0 12px; }
.has-error select, .has-error textarea { border-color: var(--bad-ink); }
.logo-now { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.logo-now img { width: auto; height: 72px; }
.panel > form + form { margin-top: 12px; }

/* The page text editor */
.editor-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.editor-bar[hidden], .editor-link[hidden], .editor-area[hidden] { display: none; }
.editor-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 14px; border: 0; border-radius: 999px;
  background: var(--chip); color: var(--ink); font-size: 13.5px;
}
.editor-btn:hover { background: #E4E4E4; }
.editor-link { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.editor-link .input { flex: 1 1 260px; width: auto; min-height: 40px; padding: 8px 12px; }
.editor-link .field-error { flex: 1 1 100%; margin-top: 0; }
.editor-area {
  min-height: 320px; max-height: 70vh; overflow-y: auto; padding: 14px 16px; background: #fff;
  border: 1.5px solid #D5D5D5; border-radius: 14px; font-size: 15px; overflow-wrap: anywhere;
}
.editor-area:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.has-error .editor-area { border-color: var(--bad-ink); }
.field textarea[name="body"] { min-height: 420px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }

/* ---------- Entries: submit, My Entries, review queue ---------- */
.pick-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.pick-grid .panel { margin-bottom: 0; }
.pick-grid + * { margin-top: 16px; }
.upload-progress { margin: 4px 0 14px; }
.upload-progress progress { display: block; width: 100%; height: 12px; accent-color: var(--accent); }
.my-entry, .review { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.my-entry > *, .review > * { margin-top: 0; min-width: 0; }
.my-entry-body > * + *, .review-body > * + * { margin-top: 10px; }
.my-entry-media {
  position: relative; overflow: hidden; border-radius: var(--r-card); background: #D9DDDC;
  aspect-ratio: 4 / 3; max-width: 320px;
}
.my-entry-media img { width: 100%; height: 100%; object-fit: cover; }
.my-entry-empty {
  display: grid; place-items: center; width: 100%; height: 100%; min-height: 140px;
  color: var(--muted); background: #D9DDDC; border-radius: var(--r-card);
}
.status-reason { padding: 10px 14px; border-radius: 14px; background: var(--bad-bg); color: var(--bad-ink); font-size: 14px; overflow-wrap: anywhere; }
.review-media { border-radius: var(--r-card); overflow: hidden; background: #111; align-self: start; }
.review-media img { width: 100%; max-height: 520px; object-fit: contain; background: #111; }
.review-media video { display: block; width: 100%; max-height: 520px; background: #000; }
.review-media a { display: block; }
.review-media .hint { padding: 8px 12px; color: #fff; }
.review-text { overflow-wrap: anywhere; }
.review-form .field { margin-bottom: 10px; }
.review .h2 { overflow-wrap: anywhere; }
.chips-tight { margin: 0; }
.stat-link { font-size: 13px; margin-top: 4px; }

/* ---------- Public pages: contest, entry, leaderboard ---------- */
.more-line { text-align: center; margin-top: 14px; }
.section-tools .pill-link.is-on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.entry-rank {
  position: absolute; z-index: 2; top: 10px; right: 10px; min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 13px;
}
.entry-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.entry-hero { border-radius: var(--r-panel); overflow: hidden; background: #111; }
.entry-hero img { width: 100%; max-height: 78vh; object-fit: contain; margin: 0 auto; }
.entry-hero video { display: block; width: 100%; max-height: 78vh; background: #000; }
.entry-hero .my-entry-empty { border-radius: 0; min-height: 240px; }
.hero-note { display: flex; align-items: center; gap: 6px; margin: 0; padding: 10px 16px; font-size: 13px; background: var(--ink); color: #fff; }
.entry-side { margin-bottom: 0; }
.entry-h1, .entry-text { overflow-wrap: anywhere; }
.entry-creative { display: flex; align-items: center; gap: 6px; }
.vote-box { padding: 14px 16px; border-radius: 16px; background: var(--bg); }
.vote-box > * + * { margin-top: 8px; }
.vote-count strong { font-size: 26px; font-weight: 600; line-height: 1.1; }
.vote-btn { min-height: 52px; font-size: 16px; }
.share-box > * + * { margin-top: 8px; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-row {
  display: grid; grid-template-columns: 30px 56px minmax(0, 1fr); gap: 4px 12px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.rank-row:first-child { border-top: 0; }
.rank-place { font-weight: 600; font-size: 16px; text-align: center; color: var(--muted); }
.rank-row.is-first .rank-place { color: var(--accent-ink); }
.rank-thumb { display: block; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: #D9DDDC; }
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-main { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 14px; }
.rank-title { flex: 1 1 100%; font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.rank-title:hover { text-decoration: underline; }
.rank-votes { grid-column: 3; font-size: 14px; white-space: nowrap; }
.rank-votes strong { font-size: 16px; }
.empty > * + * { margin-top: 10px; }

/* ---------- Voting ---------- */
.vote-panel > * + * { margin-top: 14px; }
.vote-for { display: flex; align-items: center; gap: 12px; }
.vote-for img { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; flex: 0 0 auto; }
.vote-for p { min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.vote-ok .icon, .voted-note .icon { color: var(--ok-ink); }
.voted-note { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ok-ink); }
.vote-next > * + * { margin-top: 8px; }
.vote-device { margin: 0; }
.turnstile-box { min-height: 65px; }
.link-btn { vertical-align: baseline; }
.hint .link-btn { min-height: 0; padding: 0; font-size: inherit; }

/* Admin: votes, winners, export */
.votes-table td { font-size: 13px; }
.votes-table td:nth-child(3) { min-width: 150px; }
.votes-table tr.is-removed td { background: #FAFAFA; color: var(--muted); }
.votes-table input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.vote-actions { margin-top: 16px; }
.winner-card > * + * { margin-top: 12px; }
.pay-form .inline-fields { margin-top: 0; }
.export-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.export-row p { flex: 1 1 240px; }
.filter-row select.input { max-width: 100%; min-width: 0; flex: 1 1 220px; }
.filter-row input.input { flex: 1 1 200px; min-width: 0; max-width: 100%; }
.facts .badge { white-space: normal; text-align: left; border-radius: 12px; }

/* ---------- Text pages (Rules, Privacy, About, Support) ---------- */
.prose-panel { max-width: 780px; }
.prose { overflow-wrap: anywhere; }
.prose a { color: var(--accent-ink); }

/* ---------- Tables (admin site) ---------- */
.table-wrap { position: relative; overflow-x: auto; background: var(--panel); border-radius: var(--r-card); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 12px 14px; white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 32px; padding: 16px 4px 4px; font-size: 13px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-bottom: 8px; }
.footer-links a { color: var(--ink); text-decoration: none; padding: 9px 0; }
.footer-links a:hover { text-decoration: underline; }
.footer-social { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.footer-social a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--ink); text-decoration: none; }
.footer-social a:hover { text-decoration: underline; }

/* ---------- Tablets and up ---------- */
@media (min-width: 720px) {
  .hide-small { display: inline-flex; }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rank-row { grid-template-columns: 36px 56px minmax(0, 1fr) auto; }
  .rank-votes { grid-column: auto; text-align: right; }
  .my-entry { grid-template-columns: 220px minmax(0, 1fr); gap: 22px; }
  .review { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; }
  .stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .banner { flex-basis: calc(50% - 7px); min-height: 200px; padding: 26px; }
  .banner-title { font-size: 24px; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .card-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .entry-title { font-size: 15px; }
  .entry-by, .entry-votes { font-size: 12.5px; }
  .entry-info { left: 10px; right: 10px; bottom: 10px; padding: 11px 13px; }
  .greeting { font-size: 20px; }
}

/* ---------- Computers: sidebar on the left, no bottom bar ---------- */
@media (min-width: 960px) {
  .app {
    display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 22px;
    max-width: 1440px; margin: 0 auto; padding: 20px; align-items: start;
  }
  .sidebar {
    position: sticky; top: 20px; z-index: 1;
    width: auto; height: calc(100vh - 40px); min-height: 520px;
    border-radius: var(--r-panel);
    transform: none; visibility: visible; transition: none;
  }
  .drawer-backdrop, .drawer-close, .menu-btn, .brand-mobile, .bottombar { display: none !important; }
  .app-main { padding: 0 0 8px; }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search actions";
    gap: 16px; margin-bottom: 18px;
  }
  .search { max-width: 560px; min-height: 52px; }

  /* Entry rows scroll sideways with the arrow buttons. */
  .round-btn { display: grid; }
  .card-row {
    display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x proximity;
    scrollbar-width: none; -ms-overflow-style: none; border-radius: var(--r-card);
  }
  .card-row::-webkit-scrollbar { display: none; }
  .entry-page { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 22px; }
  .card-row .entry-card { flex: 0 0 calc((100% - 32px) / 3); scroll-snap-align: start; }
  .panel { padding: 26px; }
}

@media (min-width: 1240px) {
  .pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-row .entry-card { flex-basis: calc((100% - 48px) / 4); }
}

/* ---------- Less movement for people who ask for it ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- KYN Dance Festival ---- */
.festival-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  padding: 24px 20px; margin-bottom: 16px; border-radius: var(--r-panel);
  background: linear-gradient(120deg, #18322E, #2F5D55); color: #fff;
}
.festival-hero > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; flex: 1 1 260px; }
.festival-logo { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 20px; padding: 8px; flex: 0 0 auto; }
.festival-title { font-size: 28px; font-weight: 600; line-height: 1.15; margin: 0; }
.festival-partner { font-size: 15px; opacity: .92; }
.festival-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; font-weight: 600; }
.festival-when .icon { flex: 0 0 auto; }
.festival-when span { margin-right: 10px; }
.festival-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.festival-grid .panel { margin-bottom: 0; }
.festival-grid .panel > * + * { margin-top: 10px; }
.fee-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fee { background: var(--chip); border-radius: var(--r-card); padding: 14px; }
.fee-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fee-amount { font-size: 22px; font-weight: 600; margin-top: 4px; }
.signup > * + * { margin-top: 12px; }
details.more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 0; }
details.more > form { margin-top: 8px; }
@media (min-width: 900px) {
  .festival-hero { padding: 32px; }
  .festival-title { font-size: 36px; }
  .festival-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}
.panel .h1 + .facts, .panel .h2 + .facts, .panel p + .facts, .panel .alert + .facts { margin-top: 12px; }
#signup > * + * { margin-top: 12px; }
.inline-fields + .hint { margin: 6px 0 16px; }

/* ---------- Live vote counter, Status picture button, Winners nudge (13 Oct 2026) ---------- */
.vote-counter {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 16px; padding: 8px 14px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 14px; line-height: 1.3;
}
.vote-counter .icon { flex: none; }
.vote-counter strong { color: var(--ink); font-weight: 600; }
.panel > .vote-counter { margin-bottom: 0; }
.winners-nudge { text-align: center; }
.winners-nudge .h2 { color: var(--ink); margin: 0 0 8px; }
.winners-nudge .btn-row { justify-content: center; margin-top: 14px; }

/* ---------- Vote bar on phone entry pages (13 Oct 2026, after the site audit) ----------
   A copy of the Vote button stays just above the bottom bar until the real one is in view
   (the little script in public/entry.php). The chat button is hidden on those pages. */
.vote-sticky {
  position: fixed; z-index: 51;
  left: 10px; right: 10px; bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  border-radius: 999px; box-shadow: 0 8px 22px rgba(24, 50, 46, .25);
}
.vote-sticky .vote-btn { min-height: 50px; }
@media (max-width: 959px) {
  body.has-vote-sticky .app-main { padding-bottom: calc(168px + env(safe-area-inset-bottom, 0px)); }
  body.has-vote-sticky .chat-fab { display: none; }
}
@media (min-width: 960px) {
  .vote-sticky { display: none !important; }
}

/* An empty category invites the first entry (contest page and Leaderboard, 13 Oct 2026). */
.empty-first > * + * { margin-top: 10px; }
.empty-first strong { color: var(--ink); }
