/* ============ JUZ40 design system ============ */
@font-face {
  font-family: 'JUZ40';
  src: url('https://cdn.jsdelivr.net/gh/NuraPernebek/nurnurnurnur@main/JUZ40%20FONTS%20Regular.otf') format('opentype');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'JUZ40';
  src: url('https://cdn.jsdelivr.net/gh/NuraPernebek/nurnurnurnur@main/JUZ40%20FONTS%20Medium.otf') format('opentype');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'JUZ40';
  src: url('https://cdn.jsdelivr.net/gh/NuraPernebek/nurnurnurnur@main/JUZ40%20FONTS%20Bold.otf') format('opentype');
  font-weight: 700; font-display: swap;
}

:root {
  --primary: #275B6E;
  --dark: #173942;
  --white: #FFFFFF;
  --primary-08: rgba(39, 91, 110, 0.08);
  --primary-14: rgba(39, 91, 110, 0.14);
  --primary-30: rgba(39, 91, 110, 0.30);
  --dark-60: rgba(23, 57, 66, 0.60);
  --dark-40: rgba(23, 57, 66, 0.40);
  --surface: #F4F7F8;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 8px 30px rgba(23, 57, 66, 0.10);
  --shadow-lift: 0 16px 48px rgba(23, 57, 66, 0.18);
  --font: 'JUZ40', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* The [hidden] attribute is only a UA-stylesheet rule, and author styles beat
   the UA stylesheet in the cascade. So ANY author rule setting `display` on a
   hidden element silently un-hides it — which is exactly what
   `a.tab-btn { display: inline-flex }` (further down) did to the admin link:
   participants could see "Админ" despite the hidden attribute. Author-level
   !important puts the attribute back beyond reach of every rule in this file. */
[hidden] { display: none !important; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--dark);
  min-height: 100vh;
  line-height: 1.5;
}

/* Circular crop so any background baked into the source PNG never shows square corners */
img.g-av {
  display: block; border-radius: 50%; object-fit: cover;
  background: var(--white); box-shadow: 0 0 0 1px var(--primary-14) inset;
}

button { font-family: var(--font); cursor: pointer; border: none; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary-30); outline-offset: 2px; border-radius: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 28px; border-radius: var(--radius-md);
  font-size: 16px; font-weight: 700; letter-spacing: 0.04em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--primary); color: var(--white); box-shadow: var(--shadow-soft); }
.btn-primary:hover:not(:disabled) { background: var(--dark); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary-30); }
.btn-ghost:hover { background: var(--primary-08); }
.btn-block { width: 100%; }

/* ---------- Auth pages ---------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--dark);
}
.auth-shell {
  width: 100%; max-width: 920px; display: flex;
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift); overflow: hidden;
}

/* Brand panel: the one bold move on these pages — a slow-turning sunburst
   that echoes the prize wheel, so the login screen already feels like JUZ40. */
.auth-brand {
  flex: 0 0 40%; position: relative; overflow: hidden;
  padding: 44px 36px; color: var(--white);
  background: linear-gradient(155deg, var(--dark) 0%, var(--primary) 120%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand::before {
  content: ''; position: absolute; inset: -30%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.07) 0deg 6deg, transparent 6deg 24deg);
  animation: brandSpin 90s linear infinite;
}
@keyframes brandSpin { to { transform: rotate(360deg); } }
.auth-brand .logo { width: 56px; height: 56px; position: relative; z-index: 1; }
.auth-brand .brand-copy { position: relative; z-index: 1; margin-top: 28px; }
.auth-brand .brand-copy h2 { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 10px; }
.auth-brand .brand-copy p { font-size: 14px; color: rgba(255,255,255,0.75); line-height: 1.5; }
.auth-brand .brand-facts { position: relative; z-index: 1; list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.auth-brand .brand-facts li { font-size: 13px; color: rgba(255,255,255,0.85); display: flex; align-items: center; gap: 8px; }
.auth-brand .brand-facts li::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--white); flex: none; }

.auth-card { flex: 1; padding: 44px 40px; min-width: 0; }
.auth-card .logo { display: none; } /* brand panel already carries the mark on desktop */
.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { color: var(--dark-60); margin-bottom: 28px; font-size: 15px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--dark-60); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 16px; font-family: var(--font); font-size: 16px;
  color: var(--dark); background: var(--surface);
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus { outline: none; border-color: var(--primary); background: var(--white); }
.field input.invalid { border-color: #B23A3A; background: rgba(178,58,58,0.04); }
.field .hint { font-size: 12px; color: var(--dark-40); margin-top: 4px; }

.field-password { position: relative; }
.field-password input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; top: 6px; bottom: 6px; width: 36px;
  background: transparent; border-radius: var(--radius-sm);
  color: var(--dark-40); font-size: 13px; font-weight: 500;
}
.pw-toggle:hover { color: var(--primary); background: var(--primary-08); }

.pw-checklist { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.pw-checklist li {
  font-size: 12px; color: var(--dark-40); display: flex; align-items: center; gap: 6px;
  transition: color 0.15s ease;
}
.pw-checklist li::before { content: '○'; font-size: 10px; color: var(--dark-40); }
.pw-checklist li.ok { color: var(--primary); font-weight: 500; }
.pw-checklist li.ok::before { content: '●'; color: var(--primary); }

.form-error {
  display: none; background: rgba(178, 58, 58, 0.08); color: #8C2F2F;
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 16px;
}
.form-error.show { display: block; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--dark-60); }

/* ---------- App shell ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--white); box-shadow: 0 1px 0 var(--primary-14);
  padding: 0 24px;
}
.app-header .inner {
  max-width: 960px; margin: 0 auto; height: 64px;
  display: flex; align-items: center; gap: 24px;
}
.app-header .logo { width: 34px; height: 34px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab-btn {
  background: transparent; color: var(--dark-60);
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500; transition: color 0.15s, background 0.15s;
}
.tab-btn.active { color: var(--primary); background: var(--primary-08); font-weight: 700; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 500; color: var(--dark);
  background: var(--primary-08); padding: 8px 14px; border-radius: 999px;
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.logout-btn { background: none; color: var(--dark-40); font-size: 14px; padding: 8px; }
.logout-btn:hover { color: var(--primary); }

.app-main { max-width: 960px; margin: 0 auto; padding: 32px 24px 110px; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Wheel view ---------- */
.wheel-hero { text-align: center; }
.wheel-hero .eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.22em;
  color: var(--primary); text-transform: uppercase; margin-bottom: 4px;
}
.wheel-hero h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 700; margin-bottom: 24px; }

.wheel-stage {
  position: relative; margin: 0 auto 28px;
  width: min(88vw, 420px); height: min(88vw, 420px);
}
.wheel-stage::before {
  /* signature element: a slow sunburst behind the wheel — the one bold move on this page */
  content: ''; position: absolute; inset: -16%; border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, var(--primary-08) 0deg 4deg, transparent 4deg 20deg),
    radial-gradient(circle, var(--primary-14) 0%, transparent 68%);
  animation: brandSpin 70s linear infinite;
}
#wheelCanvas { position: relative; width: 100%; height: 100%; display: block; }

@media (prefers-reduced-motion: reduce) { .wheel-stage::before { animation: none; } }

.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 5;
  border-left: 16px solid transparent; border-right: 16px solid transparent;
  border-top: 26px solid var(--dark);
  filter: drop-shadow(0 3px 4px rgba(23, 57, 66, 0.35));
}
.wheel-pointer::after {
  content: ''; position: absolute; top: -25px; left: -9px;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 15px solid var(--white);
}

.spin-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 27%; height: 27%; border-radius: 50%; z-index: 4;
  background: var(--white); color: var(--primary);
  font-size: clamp(12px, 2.6vw, 15px); font-weight: 700; letter-spacing: 0.06em;
  box-shadow: 0 0 0 6px var(--white), 0 8px 24px rgba(23, 57, 66, 0.35);
  transition: transform 0.15s ease;
}
.spin-center:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.05); }

.attempts { font-size: 15px; color: var(--dark-60); }
.attempts strong { color: var(--primary); font-weight: 700; }
.spin-status { min-height: 24px; font-size: 16px; font-weight: 500; color: var(--primary); margin-top: 8px; }

/* ---------- Eligibility card (replaces the plain attempts line) ---------- */
.eligibility { margin: 4px 0 8px; }
.eligibility .status-line { font-size: 15px; font-weight: 600; color: var(--primary); }
.eligibility .countdown {
  font-variant-numeric: tabular-nums; font-size: clamp(26px, 6vw, 32px);
  font-weight: 700; color: var(--dark); letter-spacing: 0.02em; margin-top: 2px;
}
.eligibility .sub-line { font-size: 13px; color: var(--dark-60); margin-top: 2px; }

/* ---------- Trust row ---------- */
.trust-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 32px 0 0; }
.trust-pill {
  font-size: 13px; font-weight: 500; color: var(--primary); background: var(--primary-08);
  padding: 8px 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
}

/* ---------- How it works ---------- */
.how-it-works {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  max-width: 760px; margin: 44px auto 0; text-align: left;
}
.how-step { background: var(--white); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-soft); }
.how-step .how-icon { font-size: 22px; margin-bottom: 10px; }
.how-step h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.how-step p { font-size: 13px; color: var(--dark-60); line-height: 1.5; }

/* ---------- Win modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(23, 57, 66, 0.55); backdrop-filter: blur(4px);
}
.modal-backdrop.show { display: flex; }
.win-modal {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 44px 32px 36px; max-width: 380px; width: 100%; text-align: center;
  box-shadow: var(--shadow-lift);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
.win-modal .gift { font-size: 48px; margin-bottom: 8px; }
.win-modal h2 { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.win-modal .win-sub { color: var(--dark-60); margin-bottom: 12px; }
.win-modal .prize-name {
  font-size: 22px; font-weight: 700; color: var(--primary);
  background: var(--primary-08); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 24px;
}

/* ---------- Prizes view ---------- */
.prizes-head { margin-bottom: 20px; }
.prizes-head h1 { font-size: 28px; font-weight: 700; }
.prize-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.prize-card {
  background: var(--white); border-radius: var(--radius-md);
  padding: 22px; box-shadow: var(--shadow-soft);
  border-top: 4px solid var(--primary);
}
.prize-card .gift { font-size: 28px; margin-bottom: 8px; }
.prize-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.prize-card .meta { font-size: 13px; color: var(--dark-60); margin-bottom: 3px; }
.prize-card .meta b { color: var(--dark); font-weight: 500; }
.status-pill {
  display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; padding: 6px 12px; border-radius: 999px;
  background: var(--primary-08); color: var(--primary);
}
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--dark-40);
  background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-soft);
}
.empty-state .gift { font-size: 40px; margin-bottom: 10px; }

/* ---------- Profile ---------- */
.profile-card {
  background: var(--white); border-radius: var(--radius-md); padding: 28px;
  box-shadow: var(--shadow-soft); max-width: 460px;
}
.profile-card h1 { font-size: 24px; margin-bottom: 18px; }
.profile-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--primary-08); font-size: 15px; }
.profile-row span { color: var(--dark-60); }
.profile-row b { font-weight: 500; }

/* ---------- Toast / loading ---------- */
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: var(--white); font-size: 14px;
  padding: 12px 20px; border-radius: var(--radius-sm); opacity: 0;
  transition: opacity 0.25s, transform 0.25s; z-index: 60; pointer-events: none;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loader { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--primary-30); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Confetti ---------- */
.confetti-piece {
  position: fixed; top: -12px; width: 9px; height: 14px; z-index: 55;
  pointer-events: none; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Admin panel ---------- */
.admin-shell { max-width: 1100px; }
.admin-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 8px; }
.admin-head h1 { font-size: 26px; font-weight: 700; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-tab {
  background: var(--white); color: var(--dark-60); padding: 10px 16px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-soft);
}
.admin-tab.active { color: var(--white); background: var(--primary); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-table-wrap { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); overflow: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.admin-table th {
  text-align: left; font-weight: 600; color: var(--dark-60); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 14px;
  border-bottom: 1.5px solid var(--primary-08); white-space: nowrap;
}
table.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--primary-08); vertical-align: middle; }
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table input[type="number"], table.admin-table input[type="text"] {
  width: 84px; padding: 7px 10px; border: 1.5px solid var(--primary-14); border-radius: 8px;
  font-family: var(--font); font-size: 13px;
}
table.admin-table select {
  padding: 7px 10px; border: 1.5px solid var(--primary-14); border-radius: 8px;
  font-family: var(--font); font-size: 13px; background: var(--white); color: var(--dark);
}
.admin-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.admin-badge.blocked { background: rgba(178,58,58,0.1); color: #8C2F2F; }
.admin-badge.active { background: var(--primary-08); color: var(--primary); }
.admin-badge.admin { background: var(--dark); color: var(--white); }
.btn-mini {
  font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 8px;
  background: var(--primary-08); color: var(--primary);
}
.btn-mini:hover { background: var(--primary); color: var(--white); }
.btn-mini.btn-danger { background: rgba(178, 58, 58, 0.10); color: #8C2F2F; }
.btn-mini.btn-danger:hover { background: #8C2F2F; color: var(--white); }

/* "Give a prize" strip above the participant's prize table */
.admin-give-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--white); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-soft);
  font-size: 13.5px; color: var(--dark-60);
}
.admin-give-row select {
  padding: 7px 10px; border: 1.5px solid var(--primary-14); border-radius: 8px;
  font-family: var(--font); font-size: 13px; background: var(--white); color: var(--dark);
}
.admin-loading, .admin-empty { padding: 40px; text-align: center; color: var(--dark-40); }
a.tab-btn { display: inline-flex; align-items: center; }
a.tab-btn:hover { text-decoration: none; color: var(--primary); }

/* ---------- Language switch (РУС / ҚАЗ) ---------- */
.lang-switch {
  display: inline-flex; background: var(--primary-08);
  border-radius: 999px; padding: 3px; gap: 2px; flex: none;
}
.lang-switch button {
  background: transparent; color: var(--dark-60);
  font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  padding: 6px 12px; border-radius: 999px; transition: background 0.15s, color 0.15s;
}
.lang-switch button:hover { color: var(--primary); }
.lang-switch button.active { background: var(--primary); color: var(--white); }
.auth-lang { float: right; margin: -8px -8px 8px 0; }
table.admin-table input.name-kk { width: 150px; }
