:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #e0e0e5;
  --accent: #d92d20;
  --accent-hover: #b42318;
  --accent-text: #ffffff;
  --error-bg: #fef3f2;
  --error-text: #b42318;
  --warn-bg: #fffaeb;
  --warn-text: #93370d;
  --win-bg: #f8f9fc;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113;
    --card: #1c1c1f;
    --text: #f2f2f3;
    --muted: #a1a1a8;
    --border: #2f2f35;
    --accent: #f04438;
    --accent-hover: #f97066;
    --error-bg: #3a1513;
    --error-text: #fda29b;
    --warn-bg: #33270b;
    --warn-text: #fec84b;
    --win-bg: #232328;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-underline-offset: 2px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 40px 16px 24px; }

.top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.lang {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.lang-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.lang-btn { text-decoration: none; display: inline-block; }
.lang-btn[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.head { text-align: center; margin-bottom: 24px; }
.head h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; }
.lead { margin: 6px 0 0; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.field { display: block; margin-bottom: 14px; }
.label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field-small { width: 130px; margin-bottom: 0; }

.btn {
  flex: 1 1 200px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); width: 100%; }
.btn-secondary:hover { background: var(--bg); }

.rules { margin: 16px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.rules li + li { margin-top: 2px; }

.progress-text { margin: 0 0 10px; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.4s ease; }
.bar-fill.indeterminate { width: 35%; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

.card-error { background: var(--error-bg); color: var(--error-text); border-color: transparent; }

.video { margin: 0 0 12px; color: var(--muted); overflow-wrap: anywhere; }
.video a { color: var(--text); font-weight: 600; }

.warnings { list-style: none; margin: 0 0 12px; padding: 0; }
.warnings li { background: var(--warn-bg); color: var(--warn-text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.warnings li + li { margin-top: 8px; }

h2 { font-size: 20px; margin: 4px 0 12px; }

.winners { list-style: none; margin: 0 0 14px; padding: 0; }
.winner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--win-bg);
  border-radius: 12px;
  padding: 14px;
  animation: reveal 0.5s ease both;
}
.winner + .winner { margin-top: 10px; }
.winner img { width: 48px; height: 48px; border-radius: 50%; flex: none; background: var(--border); }
.winner-body { min-width: 0; }
.winner-name { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.winner-text { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.winner-text.empty { color: var(--muted); font-style: italic; }
.winner-link { font-size: 14px; color: var(--muted); }
.place { font-weight: 700; color: var(--accent); margin-right: 4px; }

@keyframes reveal { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.stats { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

.foot { max-width: 640px; margin: 0 auto; padding: 8px 16px 32px; text-align: center; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

.faq h2 { margin-top: 0; }
.faq details + details { border-top: 1px solid var(--border); }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style-position: outside; }
.faq details p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }

.doc h1 { font-size: 26px; margin-top: 0; }
.doc h2 { font-size: 18px; margin-top: 22px; }
.doc p, .doc li { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
