/* MyVoteCounts.fan styles. Colors come from /theme.css (built from site.config.json).
   Mobile first: everything stacks at phone width, widens from 700px. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
}
a { color: var(--accent); font-weight: 600; }
img { max-width: 100%; display: block; }
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 16px 56px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.02em; }
h1 { font-size: clamp(28px, 6vw, 46px); font-weight: 900; }
h2 { font-size: 22px; font-weight: 850; }
h3 { font-size: 18px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; word-break: break-all; }
.wrap-anywhere { overflow-wrap: anywhere; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .bar { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 20px; text-decoration: none; color: var(--text); letter-spacing: -0.02em; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 17px; }
.brand .tld { color: var(--accent-2); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav a, .nav button { color: var(--text); text-decoration: none; padding: 7px 11px; border-radius: 999px; font-weight: 700; font-size: 15px; background: none; border: 0; font-family: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav a.cta { background: var(--accent-2); color: var(--accent-2-ink); }

/* hero */
.hero {
  margin: 4px 0 26px; padding: 30px 22px; border-radius: 26px; color: #fff;
  background: radial-gradient(circle at 92% 12%, rgba(255, 122, 47, 0.95) 0 70px, transparent 71px),
              radial-gradient(circle at 86% 92%, rgba(255, 255, 255, 0.14) 0 120px, transparent 121px),
              linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
}
.hero h1 { color: #fff; max-width: 680px; }
.hero p { font-size: 18px; max-width: 620px; color: rgba(255, 255, 255, 0.9); }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero .btn { border-color: transparent; }
.hero .btn.light { background: #fff; color: var(--accent-deep); }
.hero .btn.warm { background: var(--accent-2); color: var(--accent-2-ink); }

/* pills, buttons, tabs */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--surface-2); color: var(--accent-deep); letter-spacing: 0.02em; text-transform: uppercase; }
.pill.open { background: var(--accent-2); color: var(--accent-2-ink); }
.pill.open::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
.pill.closed { background: var(--text); color: var(--bg); }
.pill.draft { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.pill.removed { background: var(--bad); color: #fff; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .pill.open::before { animation: none; } }

.btn, .tab {
  appearance: none; border: 2px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.warm { background: var(--accent-2); color: var(--accent-2-ink); border-color: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .nav button:focus-visible {
  outline: 3px solid var(--accent-2); outline-offset: 2px;
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* contest cards */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; text-decoration: none; color: var(--text);
  display: grid; gap: 8px; align-content: start; box-shadow: 0 1px 0 var(--line), 0 10px 24px -18px rgba(63, 21, 151, 0.45);
  transition: transform .15s, border-color .15s;
}
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .title { font-weight: 900; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.card .meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.card .stat { font-weight: 900; color: var(--accent); }
.empty { padding: 28px 18px; text-align: center; border: 2px dashed var(--line); border-radius: 20px; color: var(--muted); background: var(--surface); }

/* how it works */
.steps3 { display: grid; gap: 12px; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 760px) { .steps3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.steps3 li { list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px 16px 16px 62px; position: relative; }
.steps3 li::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-2); color: var(--accent-2-ink); font-weight: 900; display: grid; place-items: center; }
.steps3 { padding: 0; margin: 0; }

/* contest page */
.contest-head { display: grid; gap: 10px; margin-bottom: 18px; }
.contest-head .facts { display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 22px; color: var(--accent-deep); }
.banner { padding: 14px 16px; border-radius: 16px; background: var(--surface-2); font-weight: 700; }
.banner.good { background: #e3f6ea; color: var(--good); }
.entries { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .entries { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.entry { background: var(--surface); border: 2px solid var(--line); border-radius: 20px; overflow: hidden; display: grid; }
.entry.mine { border-color: var(--accent); }
.entry.leader .count { color: var(--accent-2); }
.entry .photo { aspect-ratio: 16 / 10; width: 100%; object-fit: cover; background: var(--surface-2); }
.entry .photo.none { display: grid; place-items: center; color: var(--accent); font-size: 44px; font-weight: 900; }
.entry .body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.entry .name { font-weight: 900; font-size: 19px; overflow-wrap: anywhere; }
.count { font-weight: 900; font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.meter { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }

.receipt { border: 3px dashed var(--accent-2); background: #fff7f1; border-radius: 20px; padding: 18px; display: grid; gap: 10px; }
.receipt .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: clamp(20px, 6vw, 30px); font-weight: 900; letter-spacing: 0.06em; color: var(--accent-deep); overflow-wrap: anywhere; }

/* panels and forms */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: grid; gap: 12px; }
.layout-2 { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .layout-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
form.stack, .stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-weight: 700; font-size: 14px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 15px; }
label.check input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--text); font: inherit; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .two { grid-template-columns: 1fr 1fr; } }
.form-box { max-width: 480px; margin: 10px auto; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 5px solid var(--accent); }
.notice.error { border-left-color: var(--bad); background: #fdecef; }
.notice.ok { border-left-color: var(--good); background: #e8f7ee; }
.not-working { border: 2px dashed var(--bad); color: var(--bad); padding: 10px 12px; border-radius: 12px; font-weight: 700; background: #fff5f7; }
.problems { color: var(--bad); margin: 6px 0 0; padding-left: 18px; }

/* profile */
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar { width: 72px; height: 72px; border-radius: 24px; background: var(--accent-2); color: var(--accent-2-ink); display: grid; place-items: center; font-weight: 900; font-size: 32px; flex: none; }

/* tables, tiles, admin */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 800; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.tile .label { color: var(--muted); font-size: 13px; font-weight: 700; }
.tile .value { font-size: 28px; font-weight: 900; color: var(--accent); }
.admin-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 860px) { .admin-layout { grid-template-columns: 200px minmax(0, 1fr); } }
.side { display: flex; gap: 6px; flex-wrap: wrap; align-content: start; }
@media (min-width: 860px) { .side { display: grid; } }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.list > li { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; gap: 6px; }
.ok-text { color: var(--good); font-weight: 800; }
.bad-text { color: var(--bad); font-weight: 800; }

/* help bot and footer */
.helpbot { max-width: 1120px; margin: 0 auto 0; padding: 0 16px 18px; }
.helpbot .box { display: flex; gap: 12px; align-items: center; border: 2px dashed var(--accent); border-radius: 18px; padding: 12px 14px; background: var(--surface); }
.helpbot .bot { width: 40px; height: 40px; border-radius: 14px; background: var(--surface-2); color: var(--accent); display: grid; place-items: center; font-weight: 900; flex: none; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; background: var(--surface); }
.site-footer .bar { max-width: 1120px; margin: 0 auto; padding: 16px; display: flex; gap: 10px 18px; flex-wrap: wrap; justify-content: space-between; }
.site-footer .links { display: flex; gap: 14px; flex-wrap: wrap; }
.thumb-sm { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; }
