:root {
  --bg: #161717;
  --panel: #1b1d1d;
  --panel-2: #212424;
  --line: #2e3131;
  --text: #ffffff;
  --muted: #8d9292;
  --green: #86ea8f;
  --red: #ff5d6c;
  --radius: 18px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  /* type scale - use ONLY these */
  --fs-xs: 12px;   /* labels, hints, errors, footer */
  --fs-sm: 14px;   /* body, inputs, buttons-small */
  --fs-md: 16px;   /* headings in text, buttons */
  --fs-lg: 24px;   /* titles, call-to-action */
  --fs-xl: 48px;   /* hero (welcome) */
  --font-display: 'Bebas Neue', 'Oswald', 'Arial Narrow', Impact, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-sm);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Watermark background (text comes from data-bg on <body>) ── */
.bg-text {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; user-select: none;
}
.bg-text-inner {
  position: absolute; left: -20%; top: -30%; width: 140%; height: 160%;
  transform: rotate(-10deg);
  display: flex; flex-direction: column; gap: 0;
  font-size: 58px; font-weight: 800; font-style: italic; line-height: 1.28;
  text-transform: uppercase; white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.055);
}
.bg-text-inner span:nth-child(even) { margin-left: -4em; }

/* ── Page shell ── */
.page {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 16px;
}
.page-main { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 0; }

/* ── Footer chips ── */
.site-footer { padding: 0 0 22px; text-align: center; font-size: var(--fs-xs); letter-spacing: .02em; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 6px; max-width: 320px; margin: 0 auto 8px; }
.site-footer a {
  text-decoration: none; text-transform: uppercase; font-size: var(--fs-xs);
  padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: rgba(0,0,0,.25);
  transition: border-color .15s, color .15s;
}
.site-footer a:hover { border-color: var(--green); color: var(--green); }
.site-footer p { margin: 0; text-transform: uppercase; }

/* ── Buttons / links ── */
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-lg); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 6px 4px;
  transition: color .15s, gap .15s;
}
.cta:hover { color: var(--green); gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 208px; height: 43px; padding: 0 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  font-size: var(--fs-md); text-decoration: none; letter-spacing: .01em;
  transition: border-color .15s, color .15s, background .15s;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn-green { background: var(--green); color: #111; border-color: var(--green); font-weight: 600; }
.btn-green:hover { background: #a2f2a9; color: #111; }
.green { color: var(--green); }

/* ── Popup card (legal pages, contact, ...) ── */
.card {
  width: min(930px, 100%);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 56px 64px 48px;
  display: flex; flex-direction: column; align-items: center;
  max-height: calc(100dvh - 130px);
}
.card-head { width: 100%; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.card-head h1 { margin: 0 0 2px; font-size: var(--fs-lg); font-weight: 700; }
.card-head p { margin: 0; max-width: 560px; font-size: var(--fs-sm); color: var(--muted); }
.card-head .logo { width: 76px; height: 52px; color: #fff; flex: none; }
.card-rule { width: min(570px, 100%); align-self: flex-start; height: 1px; background: var(--line); margin: 14px 0 12px; }
.card-scroll {
  width: 100%; flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding-right: 22px; margin-bottom: 28px;
  font-size: var(--fs-sm); line-height: 1.5; scrollbar-width: thin; scrollbar-color: var(--green) var(--line);
}
.card-scroll::-webkit-scrollbar { width: 3px; }
.card-scroll::-webkit-scrollbar-track { background: var(--line); }
.card-scroll::-webkit-scrollbar-thumb { background: var(--green); }
.card-scroll h2 { font-size: var(--fs-md); margin: 28px 0 8px; }
.card-scroll h3 { font-size: var(--fs-sm); margin: 16px 0 4px; }
.card-scroll h2:first-child { margin-top: 0; }
.card-scroll p { margin: 0 0 12px; }
.card-scroll a { color: var(--green); }
.card-scroll ul { margin: 0 0 12px; padding-left: 20px; }
.card-scroll li { margin-bottom: 4px; }
.todo { background: rgba(255, 93, 108, .15); border-radius: 3px; padding: 0 3px; }

/* ── Forms inside cards ── */
.field { display: block; margin: 0 0 18px; }
.field span { display: block; font-size: var(--fs-xs); color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); }
.field textarea { min-height: 130px; resize: vertical; }
.form-msg { min-height: 20px; text-align: center; margin: 0 0 12px; font-size: var(--fs-xs); }
.form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

@media (max-width: 720px) {
  :root { --fs-xl: 32px; }
  .card { padding: 32px 22px 28px; }
  .card-head .logo { width: 52px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

.form-actions { display: flex; justify-content: center; margin-top: 8px; }
.card-note { margin-top: 16px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.muted { color: var(--muted); }

/* pages that must fit the screen without scrolling (e.g. the maintenance home) */
body.no-scroll { overflow: hidden; height: 100vh; height: 100dvh; }
body.no-scroll .page { height: 100vh; height: 100dvh; min-height: 0; }

/* ── Popups ── */
.modal-back { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-back[hidden] { display: none; }
.modal {
  width: min(460px, 100%); max-height: min(640px, 90dvh); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  animation: pop-in .2s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: var(--fs-md); }
.modal-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--green) var(--line); }
.modal-empty { text-align: center; color: var(--muted); padding: 24px 0; }
.modal .field { margin-bottom: 8px; }
.modal-hint { font-size: var(--fs-xs); color: var(--muted); margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: center; gap: 10px; }
.modal-actions .btn { min-width: 120px; }


@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.notice-text { margin: 0 0 12px; font-size: var(--fs-sm); line-height: 1.5; color: #d6d9d9; }
.notice-text b { color: #fff; }

.card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.field select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.field select:focus { outline: none; border-color: var(--green); }
.field select:invalid { color: var(--muted); }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--red); }

/* Tooltips (smooth, instead of the browser's title box): add data-tip="text" to any element */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translate(-50%, 4px) scale(.96); transform-origin: 50% 100%;
  background: #242828; border: 1px solid var(--line); color: #fff; border-radius: 8px; padding: 5px 10px;
  font-size: var(--fs-xs); font-weight: 500; line-height: 1.3; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .18s ease, transform .18s ease; z-index: 60; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0) scale(1); transition-delay: .12s; }

/* buttons inside flex cards must keep their size (the card scroll area shrinks instead) */
.card > .btn, .card > .card-actions { flex: none; }

/* crop dialog */
.crop-canvas { display: block; width: min(320px, 100%); aspect-ratio: 1; margin: 0 auto 14px; border-radius: 12px; background: repeating-conic-gradient(#2a2d2d 0 25%, #1c1e1e 0 50%) 0 0 / 20px 20px; /* checkerboard shows transparency */ cursor: grab; touch-action: none; }
.crop-canvas.drag { cursor: grabbing; }
.crop-zoom { display: block; width: min(264px, 100%); margin: 0 auto 12px; accent-color: var(--green); }
.gate-form { width: 100%; } .gate-form .card-actions { margin-top: 8px; } .card:has(.gate-form) { max-width: 480px; }
