:root {
  color-scheme: light;
  --navy-950: #081b31;
  --navy-900: #0d2947;
  --navy-800: #153c63;
  --navy-700: #1d527e;
  --white: #ffffff;
  --paper: #f4f8fc;
  --ink: #15324e;
  --muted: #6b8197;
  --line: #dce7f0;
  --orange: #ff8a1f;
  --orange-dark: #dc6810;
  --shadow: 0 18px 48px rgba(8, 27, 49, 0.14);
  --shadow-soft: 0 10px 28px rgba(8, 27, 49, 0.1);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.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; }
.app-shell { min-height: 100vh; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 44px 32px;
  overflow: hidden;
  position: relative;
  background: radial-gradient(circle at 10% 8%, rgba(255, 138, 31, 0.18), transparent 24rem), radial-gradient(circle at 94% 90%, rgba(51, 174, 193, 0.18), transparent 25rem), var(--navy-900);
}
.auth-shell::before, .auth-shell::after { content: ""; position: absolute; border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 50%; pointer-events: none; }
.auth-shell::before { width: 520px; height: 520px; right: -210px; top: -260px; }
.auth-shell::after { width: 370px; height: 370px; left: -190px; bottom: -180px; }
.auth-card { width: min(100%, 456px); position: relative; z-index: 1; padding: 44px 42px 38px; border: 1px solid rgba(255, 255, 255, 0.26); border-radius: var(--radius-xl); background: rgba(255, 255, 255, 0.97); box-shadow: 0 26px 75px rgba(0, 10, 30, 0.28); text-align: center; animation: rise-in 0.45s ease both; }
.auth-card.is-admin { border-top: 5px solid var(--orange); }
.brand-lockup { display: inline-flex; align-items: center; justify-content: center; }
.brand-lockup img { display: block; width: min(100%, 285px); height: auto; }
.auth-card .brand-lockup { width: 100%; min-height: 148px; margin-bottom: 28px; padding: 16px; border-radius: 16px; background: var(--navy-900); }
.auth-card .brand-lockup img { width: 275px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--orange-dark); font-size: 0.77rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.auth-card h1 { margin: 0; color: var(--navy-900); font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.03; letter-spacing: -0.045em; }
.auth-card .lead { margin: 16px auto 28px; max-width: 31ch; color: var(--muted); line-height: 1.55; font-size: 1rem; }
.form-stack { display: grid; gap: 14px; text-align: left; }
.field { display: grid; gap: 7px; }
.field label { color: var(--navy-900); font-size: 0.9rem; font-weight: 750; }
.field input, .field textarea, .field select { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); outline: none; color: var(--navy-900); background: #fbfdff; transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease; }
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--orange); background: var(--white); box-shadow: 0 0 0 4px rgba(255, 138, 31, 0.16); }
.field input::placeholder, .field textarea::placeholder { color: #9aabbb; }
.field-hint { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.primary-button, .secondary-button, .danger-button, .icon-button { border: 0; border-radius: 12px; transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease; }
.primary-button { min-height: 50px; padding: 0 20px; color: var(--white); background: var(--orange); box-shadow: 0 9px 18px rgba(220, 104, 16, 0.22); font-weight: 800; }
.primary-button:hover { background: var(--orange-dark); transform: translateY(-2px); box-shadow: 0 12px 22px rgba(220, 104, 16, 0.28); }
.primary-button:disabled { opacity: 0.65; transform: none; box-shadow: none; }
.secondary-button { min-height: 44px; padding: 0 16px; color: var(--navy-900); background: #e8f0f7; font-weight: 750; }
.secondary-button:hover { background: #d8e6f1; transform: translateY(-1px); }
.danger-button { min-height: 40px; padding: 0 13px; color: #a73a32; background: #fff0ee; font-weight: 750; }
.danger-button:hover { background: #ffe2df; }
.icon-button { width: 40px; height: 40px; color: var(--navy-800); background: #edf4f9; font-weight: 900; font-size: 1.1rem; }
.icon-button:hover:not(:disabled) { background: #dcebf4; transform: translateY(-1px); }
.icon-button:disabled { opacity: 0.38; }
.auth-submit { width: 100%; margin-top: 8px; }
.auth-footer { margin: 22px 0 0; color: #8b9bac; font-size: 0.78rem; }
.text-button { padding: 0; border: 0; color: var(--navy-700); background: transparent; font-weight: 750; }
.text-button:hover { color: var(--orange-dark); }
.message { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; text-align: left; }
.message.error { color: #923c35; border: 1px solid #ffd4cf; background: #fff3f1; }
.message.success { color: #216b56; border: 1px solid #c3ecde; background: #eefbf7; }
.message.info { color: var(--navy-700); border: 1px solid #cfe0ec; background: #f1f7fb; }

.portal-shell, .admin-shell { min-height: 100vh; background: linear-gradient(145deg, #edf5fa 0%, #f7fafc 60%, #fff8f0 100%); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1400px; margin: 0 auto; padding: 20px 42px; }
.topbar .brand-lockup { width: 260px; height: 54px; padding: 4px 12px; border-radius: 12px; background: var(--navy-900); }
.topbar .brand-lockup img { width: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-note { color: var(--muted); font-size: 0.9rem; }
.topbar-note strong { color: var(--navy-900); }
.portal-content, .admin-content { max-width: 1400px; margin: 0 auto; padding: 32px 42px 72px; }
.portal-intro { display: flex; align-items: end; justify-content: space-between; gap: 40px; padding: 34px 0 38px; }
.portal-intro h1, .admin-heading h1 { margin: 0; color: var(--navy-900); font-size: clamp(2.55rem, 5vw, 4.8rem); line-height: 0.96; letter-spacing: -0.075em; }
.portal-intro p { max-width: 51ch; margin: 18px 0 0; color: var(--muted); font-size: 1.06rem; line-height: 1.55; }
.stats-card { min-width: 190px; padding: 18px 20px; border: 1px solid #dbe9f2; border-radius: 18px; background: rgba(255,255,255,0.76); box-shadow: var(--shadow-soft); }
.stats-card strong { display: block; color: var(--navy-900); font-size: 2rem; line-height: 1; }
.stats-card span { display: block; margin-top: 8px; color: var(--muted); font-size: 0.84rem; }
.quiz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.quiz-card { min-height: 308px; display: flex; flex-direction: column; position: relative; overflow: hidden; padding: 25px; border: 1px solid rgba(255,255,255,0.65); border-radius: var(--radius-lg); color: var(--white); box-shadow: var(--shadow-soft); isolation: isolate; animation: rise-in 0.45s ease both; animation-delay: calc(var(--card-index, 0) * 70ms); }
.quiz-card::after { content: ""; position: absolute; z-index: -1; width: 200px; height: 200px; right: -76px; bottom: -84px; border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; box-shadow: 0 0 0 20px rgba(255,255,255,0.04), 0 0 0 42px rgba(255,255,255,0.03); }
.accent-0 { background: linear-gradient(148deg, #1c5b83, #163a65); }
.accent-1 { background: linear-gradient(148deg, #db7135, #a84340); }
.accent-2 { background: linear-gradient(148deg, #286f72, #164b66); }
.accent-3 { background: linear-gradient(148deg, #6b5ea5, #354d82); }
.quiz-card.is-disabled { filter: saturate(0.72); }
.quiz-card.is-disabled::before { content: ""; position: absolute; inset: 0; background: rgba(9, 30, 52, 0.12); pointer-events: none; }
.quiz-card:hover:not(.is-disabled) { transform: translateY(-7px); box-shadow: 0 22px 44px rgba(8, 27, 49, 0.2); transition: transform 0.22s ease, box-shadow 0.22s ease; }
.quiz-card-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quiz-number { color: rgba(255,255,255,0.64); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; }
.status-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; color: #fff4e7; background: rgba(255,138,31,0.3); font-size: 0.72rem; font-weight: 800; }
.status-badge.soon { color: rgba(255,255,255,0.86); background: rgba(255,255,255,0.14); }
.card-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: -2; pointer-events: none; }
.quiz-card.has-photo::after { inset: 0; width: auto; height: auto; border: 0; border-radius: inherit; box-shadow: none; background: linear-gradient(180deg, rgba(7,27,47,.65) 0%, rgba(7,27,47,.30) 28%, rgba(7,27,47,.76) 62%, rgba(7,27,47,.91) 100%); pointer-events: none; }
.quiz-card.has-photo .quiz-number, .quiz-card.has-photo .card-age, .quiz-card.has-photo .soon-note { color: #fff; }
.quiz-card.has-photo .status-badge { background: rgba(12,38,62,.88); color: #fff; }
.card-details { margin-top: auto; padding-top: 72px; }
.quiz-card .play-cta, .quiz-card .soon-note { margin-top: 0; }
.quiz-card .play-cta:focus-visible { outline-color: #fff; }
.card-title { margin: 0; font-size: 1.9rem; line-height: 1; letter-spacing: -0.045em; }
.card-age { min-height: 23px; margin: 10px 0 0; color: rgba(255,255,255,0.77); font-size: 0.91rem; }
.play-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 26px; color: var(--white); text-decoration: none; font-size: 1rem; font-weight: 850; }
.play-cta span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--navy-900); background: var(--orange); font-size: 1.2rem; transition: transform 0.2s ease; }
.quiz-card:hover .play-cta span { transform: rotate(45deg); }
.soon-note { margin-top: auto; padding-top: 26px; color: rgba(255,255,255,0.62); font-size: 0.91rem; }
.loading-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.skeleton { height: 308px; border-radius: var(--radius-lg); background: linear-gradient(100deg, #dfeaf2 20%, #edf4f8 38%, #dfeaf2 56%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.empty-state { padding: 56px 28px; border: 1px dashed #bad0df; border-radius: 22px; text-align: center; background: rgba(255,255,255,0.66); }
.empty-state h2 { margin: 0; color: var(--navy-900); font-size: 1.5rem; }
.empty-state p { margin: 10px auto 0; max-width: 44ch; color: var(--muted); line-height: 1.5; }

.admin-content { padding-top: 38px; }
.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 24px 0 34px; }
.admin-heading p { margin: 14px 0 0; color: var(--muted); line-height: 1.5; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-panel { border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,0.78); box-shadow: var(--shadow-soft); }
.admin-form { padding: 26px; margin-bottom: 22px; }
.admin-form h2 { margin: 0 0 22px; color: var(--navy-900); font-size: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field.full { grid-column: 1 / -1; }
.image-upload { display:flex; align-items:center; gap:20px; padding:18px; border:1px dashed #aabed0; border-radius:16px; background:#f5f9fc; }
.image-preview { display:grid; place-items:center; width:112px; height:112px; flex-shrink:0; border-radius:18px; background:white; overflow:hidden; color:var(--muted); font-size:1rem; }
.image-preview img { width:100%; height:100%; object-fit:contain; }
.image-preview span { padding:8px; overflow-wrap:anywhere; text-align:center; }
.image-upload-controls { min-width:0; flex:1; }
.image-upload input[type=file] { max-width:100%; padding:8px; cursor:pointer; }
.image-upload input::file-selector-button { border:0; border-radius:8px; padding:10px 14px; margin-right:10px; background:var(--navy-900); color:white; cursor:pointer; font:inherit; }
.image-upload-controls .secondary-button { margin-top:8px; }
@media(max-width:600px) { .image-upload { flex-direction:column; align-items:flex-start; } .image-upload-controls { width:100%; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 48px; color: var(--navy-900); font-weight: 750; }
.check-row input { width: 19px; height: 19px; accent-color: var(--orange); }
.admin-list { overflow: hidden; }
.admin-list-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.admin-list-head h2 { margin: 0; color: var(--navy-900); font-size: 1.1rem; }
.admin-list-head span { color: var(--muted); font-size: 0.86rem; }
.admin-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid #edf2f6; }
.admin-item:last-child { border-bottom: 0; }
.sort-controls { display: flex; flex-direction: column; gap: 4px; }
.sort-controls .icon-button { width: 34px; height: 27px; font-size: 0.9rem; border-radius: 8px; }
.admin-item-main { min-width: 0; display: flex; align-items: center; gap: 14px; }
.admin-item-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: var(--navy-900); background: #e8f1f7; font-size: 1.35rem; overflow: hidden; }
.admin-item-icon img { width: 100%; height: 100%; object-fit: cover; }
.admin-item-copy { min-width: 0; }
.admin-item-copy strong { display: block; overflow: hidden; color: var(--navy-900); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-item-copy small { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-item-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.active-pill { display: inline-flex; align-items: center; gap: 7px; margin-right: 8px; color: #1c765b; font-size: 0.8rem; font-weight: 800; }
.active-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #35b888; }
.active-pill.off { color: #8998a5; }
.active-pill.off::before { background: #b5c1cb; }
.admin-login-note { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; color: #8a9baa; font-size: 0.78rem; }
.admin-login-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #48bb99; }
.date-meta { color: #97a8b6; font-size: 0.76rem; }
.toast-region { position: fixed; z-index: 20; right: 22px; bottom: 22px; display: grid; gap: 10px; width: min(360px, calc(100vw - 44px)); pointer-events: none; }
.toast { padding: 14px 16px; border: 1px solid #c8e9dd; border-radius: 14px; color: #216b56; background: #f0fcf8; box-shadow: var(--shadow-soft); font-size: 0.9rem; animation: rise-in 0.3s ease both; }
.toast.error { border-color: #ffd4cf; color: #923c35; background: #fff3f1; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
button:focus-visible, a:focus-visible { outline: 3px solid #2879b8; outline-offset: 4px; }
.primary-button { color: var(--navy-950); }
.quiz-card { min-height: 308px; }
.card-title { overflow-wrap: anywhere; }
.loading-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.topbar .brand-lockup { height: 90px; }
.auth-card .brand-lockup img { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 1120px) { .quiz-grid, .loading-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .portal-intro { align-items: start; } }
@media (max-width: 760px) { .auth-shell { padding: 22px 16px; } .auth-card { padding: 32px 22px 28px; } .topbar { padding: 14px 18px; } .topbar .brand-lockup { width: 218px; height: 48px; } .topbar .brand-lockup img { width: 190px; } .topbar-note { display: none; } .portal-content, .admin-content { padding: 20px 18px 48px; } .portal-intro, .admin-heading { display: block; padding: 18px 0 28px; } .portal-intro h1, .admin-heading h1 { font-size: clamp(2.6rem, 13vw, 4rem); } .stats-card { margin-top: 24px; } .quiz-grid, .loading-grid { grid-template-columns: 1fr; } .quiz-card, .skeleton { min-height: 270px; height: auto; } .form-grid { grid-template-columns: 1fr; } .field.full { grid-column: auto; } .admin-list-head { padding: 18px; } .admin-item { grid-template-columns: 42px minmax(0, 1fr); padding: 16px 18px; } .admin-item-actions { grid-column: 2; justify-content: flex-start; } .active-pill { margin-right: 0; } .admin-actions { margin-top: 22px; } }
@media (max-width: 480px) { .topbar { gap: 10px; } .topbar .brand-lockup { width: 184px; } .topbar .brand-lockup img { width: 164px; } .form-actions { flex-direction: column-reverse; } .form-actions button { width: 100%; } }
