/* مُبدِعات — منصة المسابقات الإبداعية */
:root {
  --plum: #4a1d5c;
  --plum-2: #6d2f84;
  --rose: #d9578f;
  --rose-soft: #fbe6ef;
  --gold: #e3a93b;
  --mint: #1f9d84;
  --mint-soft: #e2f5f0;
  --ink: #23182f;
  --muted: #6f6680;
  --line: #ece5f1;
  --bg: #faf7fb;
  --card: #ffffff;
  --danger: #c23b4a;
  --danger-soft: #fde8ea;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --info-soft: #ede7f6;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(40, 20, 60, .05), 0 8px 28px rgba(40, 20, 60, .07);
  --shadow-lg: 0 20px 50px rgba(40, 20, 60, .16);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --display: "El Messiri", "Tajawal", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--plum-2); text-decoration: none; }
a:hover { color: var(--rose); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.4; margin: 0 0 .5em; color: var(--plum); }
p { margin: 0 0 1em; }
img { max-width: 100%; }
.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(720px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 1rem; } .mt-2 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 1rem; } .mb-2 { margin-bottom: 2rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid rgba(217, 87, 143, .45); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--plum); }
.brand:hover { color: var(--plum); }
.brand-mark { width: 42px; height: 42px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-family: var(--display); font-size: 1.3rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.topnav a, .linkish {
  padding: 6px 12px; border-radius: 999px; color: var(--ink); font-weight: 500;
  background: none; border: 0; font: inherit; cursor: pointer;
}
.topnav a:hover, .linkish:hover { background: var(--info-soft); color: var(--plum); }
.topnav .pill { background: var(--plum); color: #fff; }
.topnav .pill:hover { background: var(--plum-2); color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--plum-2), var(--rose)); color: #fff; box-shadow: 0 6px 18px rgba(217, 87, 143, .3); }
.btn-primary:hover { color: #fff; box-shadow: 0 10px 24px rgba(217, 87, 143, .38); }
.btn-dark { background: var(--plum); color: #fff; }
.btn-dark:hover { color: #fff; background: var(--plum-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--plum); }
.btn-ghost:hover { border-color: var(--plum-2); color: var(--plum); }
.btn-light { background: #fff; color: var(--plum); }
.btn-light:hover { color: var(--plum); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.btn-glass { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; }
.btn-glass:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #f6c8ce; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .875rem; }
.btn-block { width: 100%; }

/* ---------- Cards, alerts, badges ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card + .card { margin-top: 20px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title h2, .card-title h3 { margin: 0; }
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.alert-ok { background: var(--mint-soft); color: #11604f; border-color: #bfe6dc; }
.alert-error { background: var(--danger-soft); color: #8e2230; border-color: #f6c8ce; }
.alert-warn { background: var(--warn-soft); color: #7a4f10; border-color: #f2dcb2; }
.alert-info { background: var(--info-soft); color: var(--plum); border-color: #ddd1ec; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-upcoming { background: #eef0f6; color: #4c5878; }
.badge-open { background: var(--mint-soft); color: #11795f; }
.badge-review { background: var(--warn-soft); color: #9a6413; }
.badge-closed { background: #f1ecf6; color: #6d2f84; }
.badge-published { background: var(--rose-soft); color: #b3366c; }
.badge-plain { background: var(--info-soft); color: var(--plum); }
.badge-plain::before { display: none; }
.badge-gold { background: #fff3d6; color: #8a5a00; }
.badge-gold::before { display: none; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 700; color: var(--ink); margin-bottom: 14px; font-size: .95rem; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid #e2d9ea; background: #fff; color: var(--ink);
  font: inherit; font-weight: 400; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--plum-2); box-shadow: 0 0 0 4px rgba(109, 47, 132, .12); }
textarea { min-height: 120px; resize: vertical; line-height: 1.9; }
input[type=file] { display: block; margin-top: 6px; font: inherit; max-width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--plum-2); flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 6px; margin: 0 0 20px; }
legend { font-family: var(--display); font-weight: 700; color: var(--plum); padding: 0 8px; font-size: 1.05rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* ---------- Home hero ---------- */
.home-hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 210, 122, .35), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(217, 87, 143, .55), transparent 40%),
    url("../themes/default.svg"),
    linear-gradient(135deg, #3d1650, #7b2f86 55%, #c64f8a);
  padding: 64px 0 88px;
}
.home-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: .3em; }
.home-hero p { font-size: 1.15rem; opacity: .92; max-width: 620px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 36px; align-items: center; }
.eyebrow { display: inline-block; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); font-size: .85rem; font-weight: 700; margin-bottom: 14px; }
.id-box { background: rgba(255, 255, 255, .97); color: var(--ink); border-radius: 24px; padding: 26px; box-shadow: var(--shadow-lg); }
.id-box h2 { font-size: 1.35rem; }
.id-input { font-size: 1.35rem !important; letter-spacing: .25em; text-align: center; direction: ltr; font-weight: 700 !important; }
.wave { position: absolute; inset: auto 0 -1px 0; height: 48px; width: 100%; }

.section { padding: 44px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: 1.6rem; }

/* ---------- Competition cards ---------- */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.comp-card { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease; }
.comp-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.comp-cover { position: relative; min-height: 132px; padding: 18px; color: #fff; display: flex; flex-direction: column; justify-content: space-between; background-size: auto, cover; }
.comp-cover .badge { align-self: flex-start; background: rgba(255, 255, 255, .92); }
.comp-cover h3 { color: #fff; margin: 12px 0 0; font-size: 1.3rem; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.comp-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .88rem; }
.meta span { display: inline-flex; gap: 6px; align-items: center; }
.meta svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.comp-body .btn { margin-top: auto; align-self: flex-start; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 64px; height: 64px; stroke: #cdbfdb; fill: none; stroke-width: 1.5; margin-bottom: 8px; }

/* ---------- Themed competition hero ---------- */
.theme-hero { position: relative; color: #fff; padding: 46px 0 70px; overflow: hidden; background-size: auto, cover; }
.theme-hero h1 { color: #fff; font-size: clamp(1.7rem, 4vw, 2.6rem); text-shadow: 0 3px 16px rgba(0, 0, 0, .25); }
.theme-hero .meta { color: rgba(255, 255, 255, .9); font-size: .95rem; }
.theme-hero .eyebrow { background: rgba(255, 255, 255, .18); }
.teacher-chip { display: inline-flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .3); padding: 6px 14px 6px 6px; border-radius: 999px; margin-bottom: 14px; }
.teacher-chip .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent, #ffd27a); color: var(--plum); display: grid; place-items: center; font-weight: 800; }
.overlap { margin-top: -44px; position: relative; z-index: 2; }
.prompt-card { border-top: 5px solid var(--rose); }
.prompt-text { font-size: 1.15rem; line-height: 2; white-space: pre-line; }
.countdown { display: inline-flex; gap: 8px; direction: rtl; }
.countdown span { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); border-radius: 12px; padding: 6px 10px; min-width: 62px; text-align: center; line-height: 1.2; }
.countdown b { display: block; font-size: 1.35rem; font-family: var(--display); }
.countdown small { font-size: .72rem; opacity: .85; }

.student-card { display: flex; align-items: center; gap: 16px; }
.student-avatar { width: 64px; height: 64px; border-radius: 20px; flex: none; display: grid; place-items: center; font-family: var(--display); font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--plum-2), var(--rose)); }
.student-card h2 { margin: 0; }

.counter { font-size: .88rem; color: var(--muted); text-align: left; margin-top: -8px; margin-bottom: 14px; }
.counter.bad { color: var(--danger); font-weight: 700; }
.submitted-text { background: #fbf8fd; border: 1px dashed #dccfe8; border-radius: var(--radius-sm); padding: 16px; white-space: pre-wrap; line-height: 2; }

/* ---------- Entries (judging & voting) ---------- */
.entry { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; scroll-margin-top: 90px; }
.entry-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; background: #fbf8fd; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.entry-code { font-family: var(--display); font-weight: 700; color: var(--plum); font-size: 1.1rem; }
.entry-body { padding: 18px; white-space: pre-wrap; line-height: 2; max-height: 420px; overflow: auto; }
.entry-foot { padding: 16px 18px; border-top: 1px solid var(--line); background: #fff; }
.entry.done { border-color: #bfe6dc; }
.entry.done .entry-head { background: var(--mint-soft); }
.crit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.crit-grid label { margin: 0; }
.score-input { text-align: center; font-weight: 800 !important; font-size: 1.1rem !important; }
.progress { height: 10px; background: #f0e9f5; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--plum-2)); border-radius: 999px; }
.sticky-bar { position: sticky; top: 76px; z-index: 5; }

.vote-option { display: block; cursor: pointer; margin: 0 0 16px; font-weight: 400; }
.vote-option input { position: absolute; opacity: 0; }
.vote-option .entry { margin: 0; transition: border-color .15s, box-shadow .15s; }
.vote-option input:checked + .entry { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(217, 87, 143, .18), var(--shadow); }
.vote-option input:focus-visible + .entry { outline: 3px solid rgba(217, 87, 143, .45); }
.vote-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #d6c8e2; display: grid; place-items: center; color: transparent; font-weight: 900; }
.vote-option input:checked + .entry .vote-mark { background: var(--rose); border-color: var(--rose); color: #fff; }

/* ---------- Results ---------- */
.winner-card { text-align: center; position: relative; overflow: hidden; background: linear-gradient(180deg, #fffaf0, #fff); border: 1px solid #f3e2b8; }
.crown { width: 74px; height: 74px; margin: 0 auto 6px; display: block; }
.winner-name { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: 4px 0; }
.score-big { display: inline-block; font-family: var(--display); font-size: 1.5rem; color: var(--plum); background: #fff3d6; border-radius: 999px; padding: 2px 20px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; margin-top: 24px; }
.podium-step { text-align: center; }
.podium-step .bar { border-radius: 16px 16px 6px 6px; color: #fff; padding: 14px 8px; font-family: var(--display); font-size: 1.6rem; }
.podium-step.p1 .bar { height: 130px; background: linear-gradient(180deg, #f2c14e, #d99a1e); }
.podium-step.p2 .bar { height: 100px; background: linear-gradient(180deg, #b9c0cc, #8b93a3); }
.podium-step.p3 .bar { height: 80px; background: linear-gradient(180deg, #e0a37a, #b8703f); }
.podium-step .who { font-weight: 800; margin-bottom: 6px; line-height: 1.4; }
.podium-step .who small { display: block; color: var(--muted); font-weight: 500; }
.weights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.weight { border-radius: var(--radius-sm); padding: 14px; text-align: center; background: #fbf8fd; border: 1px solid var(--line); }
.weight b { display: block; font-family: var(--display); font-size: 1.6rem; color: var(--plum); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- Auth & message pages ---------- */
.page-auth, .page-message { background: radial-gradient(circle at 20% 10%, #f8dcea, transparent 40%), radial-gradient(circle at 80% 90%, #e5d8f3, transparent 40%), var(--bg); }
.auth-wrap, .message-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card.wide { width: min(640px, 100%); }
.auth-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.auth-head h1 { margin: 0; font-size: 1.5rem; }
.auth-head p { margin: 0; color: var(--muted); }
.message-card { width: min(480px, 100%); text-align: center; }
.message-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 900; background: var(--info-soft); color: var(--plum); }
.message-ok .message-icon { background: var(--mint-soft); color: var(--mint); }
.message-warn .message-icon { background: var(--warn-soft); color: var(--warn); }
.message-error .message-icon { background: var(--danger-soft); color: var(--danger); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .88rem; padding: 18px 0; margin-top: 40px; }
.footer .wrap { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
body.admin { background: #f6f3f8; }
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #3b154b, #4f1f63 60%, #5e2771); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand-light, .brand-light:hover { color: #fff; }
.brand-light small { color: rgba(255, 255, 255, .7); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; color: rgba(255, 255, 255, .82); padding: 10px 14px; border-radius: 12px; font-weight: 500; }
.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a.active { background: #fff; color: var(--plum); font-weight: 700; }
.side-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; color: rgba(255, 255, 255, .8); }
.admin-main { min-width: 0; }
.admin-top { display: flex; align-items: center; gap: 12px; padding: 18px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.admin-top h1 { margin: 0; font-size: 1.35rem; }
.menu-btn { display: none; background: var(--info-soft); color: var(--plum); border: 0; border-radius: 10px; width: 40px; height: 40px; font-size: 1.2rem; cursor: pointer; }
.admin-content { padding: 26px 28px 48px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: .88rem; }
.stat b { display: block; font-family: var(--display); font-size: 2rem; color: var(--plum); line-height: 1.3; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: .93rem; }
th, td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #faf6fc; color: var(--muted); font-weight: 700; font-size: .84rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.is-winner td { background: #fffaf0; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-field { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.link-field input { margin: 0; direction: ltr; font-size: .85rem; background: #fbf8fd; }
.link-list { display: grid; gap: 14px; }
.link-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: #fff; }
.link-item h4 { margin: 0; font-size: 1rem; }
.link-item p { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.link-item.private { border-color: #f2dcb2; background: #fffcf5; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 16px; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--plum); border-bottom-color: var(--rose); }
.theme-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.theme-opt { margin: 0; cursor: pointer; font-weight: 500; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt .sw { display: flex; align-items: flex-end; height: 74px; border-radius: 12px; padding: 8px 10px; color: #fff; font-size: .82rem; font-weight: 700; background-size: auto, cover; border: 3px solid transparent; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.theme-opt input:checked + .sw { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(217, 87, 143, .25); }
.theme-opt input:focus-visible + .sw { outline: 3px solid rgba(217, 87, 143, .5); }
.weight-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.weight-sum { font-weight: 800; }
.weight-sum.bad { color: var(--danger); }
.weight-sum.good { color: var(--mint); }
.preview-hero { border-radius: var(--radius); padding: 22px; color: #fff; min-height: 120px; background-size: auto, cover; }
.preview-hero h3 { color: #fff; margin: 0; }
details.entry-details summary { cursor: pointer; color: var(--plum-2); font-weight: 700; }
details.entry-details div { white-space: pre-wrap; background: #fbf8fd; padding: 12px; border-radius: 10px; margin-top: 8px; max-height: 300px; overflow: auto; line-height: 1.9; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.pager span { background: var(--plum); color: #fff; border-color: var(--plum); }
.danger-zone { border-color: #f6c8ce; }
.danger-zone h3 { color: var(--danger); }
code.sample { display: block; direction: ltr; text-align: left; background: #2a1d36; color: #f6e9ff; padding: 12px 14px; border-radius: 10px; font-size: .85rem; white-space: pre; overflow-x: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 0 0 auto; width: 270px; transform: translateX(100%); transition: transform .25s ease; z-index: 60; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .admin-content { padding: 20px 16px 40px; }
  .admin-top { padding: 14px 16px; }
}
@media (max-width: 640px) {
  /* Compact one-line top bar */
  .topbar-in { min-height: 58px; gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-text b { font-size: 1.15rem; }
  .topnav { flex-wrap: nowrap; gap: 2px; }
  .topnav .nav-home { display: none; }
  .topnav a, .linkish { padding: 5px 8px; font-size: .86rem; white-space: nowrap; }
  .topnav .pill { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
  .sticky-bar { top: 66px; }

  /* Tables become stacked cards */
  .table-wrap.cards { border: 0; overflow: visible; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable thead { display: none; }
  .rtable { background: transparent; }
  .rtable tr { display: flex; flex-direction: column; }
  .rtable td.cell-main { order: -1; }
  .rtable tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; padding: 8px 0; box-shadow: var(--shadow); }
  .rtable tr.is-winner { border-color: #f3e2b8; }
  .rtable td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 6px 14px; text-align: left; min-width: 0 !important; }
  .rtable td::before { content: attr(data-label); font-weight: 700; color: var(--muted); font-size: .8rem; text-align: right; flex: none; }
  .rtable td.cell-main { display: block; text-align: right; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 4px; }
  .rtable td.cell-main::before, .rtable td.cell-actions::before { display: none; }
  .rtable td.cell-actions { justify-content: flex-start; flex-wrap: wrap; }
  .rtable td.cell-actions:empty { display: none; }
  .rtable td .progress { flex: 1; }

  .crit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .crit-grid label { font-size: .82rem; line-height: 1.4; display: flex; flex-direction: column; justify-content: space-between; }
  .crit-grid .hint { display: none; }

  .grid-2, .grid-3, .weight-inputs, .weights { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .home-hero { padding: 40px 0 70px; }
  .brand-text small { display: none; }
  .topnav a, .linkish { padding: 6px 9px; font-size: .9rem; }
  .podium { gap: 8px; }
  .podium-step .bar { font-size: 1.2rem; }
  .countdown span { min-width: 54px; padding: 5px 6px; }
  .link-field { flex-direction: column; }
}
@media print {
  .topbar, .footer, .sidebar, .admin-top, .btn, form { display: none !important; }
  .admin-shell { display: block; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
