/* ============================================================
   WheelSpinner — global styles
   Clean, colorful, responsive. No external fonts or frameworks.
   ============================================================ */

:root {
  --bg: #f5f6fb;
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --ink: #1e2433;
  --ink-2: #3c4356;
  --muted: #5a6478;
  --line: #e6e9f2;
  --brand: #5b5ce6;
  --brand-2: #8b5cf6;
  --brand-grad: linear-gradient(135deg, #5b5ce6 0%, #8b5cf6 100%);
  --ok: #22b07d;
  --no: #ef4d5a;
  --gold: #f5b301;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(30, 36, 70, 0.08);
  --shadow-lg: 0 14px 44px rgba(30, 36, 70, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth; -webkit-text-size-adjust: 100%;
  /* hard guarantee: the page itself never scrolls horizontally */
  overflow-x: hidden; overflow-x: clip;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

::selection { background: rgba(91, 92, 230, 0.2); }

:focus-visible {
  outline: 3px solid rgba(91, 92, 230, 0.65);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 0 0 10px 0; z-index: 200;
}
.skip-link:focus { left: 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ================= Header ================= */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex; align-items: center; gap: 18px;
  height: 64px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.22rem; color: var(--ink);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo svg { width: 30px; height: 30px; }
.logo b { color: var(--brand); }

.main-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.main-nav > a,
.main-nav .nav-more > summary {
  display: block; padding: 8px 13px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 0.95rem;
  list-style: none; cursor: pointer; white-space: nowrap;
}
.main-nav > a:hover,
.main-nav .nav-more > summary:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.main-nav > a.active { color: var(--brand); background: rgba(91, 92, 230, 0.09); }

.nav-more { position: relative; }
.nav-more::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " ▾"; font-size: 0.7em; opacity: 0.7; }
.lang-menu > summary::after { content: ""; }
.lang-menu > summary { white-space: nowrap; }

.nav-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 10px; min-width: 480px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  z-index: 120;
}
.lang-dropdown {
  min-width: 170px; max-height: 340px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.lang-dropdown a { font-size: 0.9rem; }
.lang-dropdown a.active { color: var(--brand); background: rgba(91, 92, 230, 0.09); }

.lang-chips {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.lang-chip {
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: 0.82rem; font-weight: 700;
  color: var(--ink-2); background: var(--card);
}
.lang-chip.active { background: var(--brand-grad); color: #fff; border-color: transparent; }
.nav-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  font-weight: 600; font-size: 0.92rem;
}
.nav-dropdown a:hover { background: var(--bg-soft); text-decoration: none; }
.nav-dropdown svg { width: 22px; height: 22px; flex-shrink: 0; }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--line); border-radius: 10px;
  width: 44px; height: 44px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px; border-radius: 2px;
  background: var(--ink); transition: transform 0.25s, opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none; border-top: 1px solid var(--line);
  background: var(--card); padding: 14px 20px 22px;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block; padding: 11px 10px; border-radius: 10px;
  color: var(--ink); font-weight: 600; font-size: 1rem;
  border-bottom: 1px solid var(--bg-soft);
}
.mobile-menu a:last-child { border-bottom: 0; }
.mobile-menu a.active { color: var(--brand); }

/* ================= Hero ================= */

.tool-hero { padding: 30px 0 6px; text-align: center; }

.crumbs {
  font-size: 0.84rem; color: var(--muted); margin-bottom: 10px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

.tool-hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: -0.03em; line-height: 1.15;
  font-weight: 800;
}
.tool-hero h1 .accent { color: var(--brand); }

.tool-hero .lead {
  max-width: 720px; margin: 12px auto 0; color: var(--muted);
  font-size: clamp(0.98rem, 2vw, 1.1rem);
}

.badge-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 0.8rem; font-weight: 700;
  padding: 5px 13px; border-radius: 999px;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* Home hero */
.home-hero { text-align: center; padding: 46px 0 10px; }
.home-hero h1 {
  font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800;
  letter-spacing: -0.035em; line-height: 1.1; margin: 14px 0;
}
.home-hero h1 .grad {
  background: var(--brand-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.home-hero p { color: var(--muted); max-width: 680px; margin: 0 auto; font-size: 1.06rem; }
.hero-cta { margin-top: 22px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ================= Buttons ================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; font-weight: 700; border-radius: 12px;
  padding: 11px 22px; font-size: 0.98rem; min-height: 44px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 8px 20px rgba(99, 91, 255, 0.35); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(99, 91, 255, 0.45); transform: translateY(-1px); }
.btn-primary:disabled { background: #c6c9dd; box-shadow: none; cursor: not-allowed; transform: none; }

.btn-ghost { background: var(--card); color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: rgba(91, 92, 230, 0.5); color: var(--brand); }

.btn-danger-ghost { background: transparent; color: var(--no); border: 1px solid rgba(239, 77, 90, 0.35); }
.btn-danger-ghost:hover { background: rgba(239, 77, 90, 0.08); }

.btn-spin {
  font-size: 1.1rem; padding: 15px 46px; border-radius: 999px;
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 10px 30px rgba(99, 91, 255, 0.4);
}
.btn-spin:hover { transform: translateY(-2px) scale(1.02); }

.btn-sm { padding: 7px 14px; min-height: 36px; font-size: 0.87rem; border-radius: 10px; }

/* ================= Tool layout ================= */

.tool-wrap {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 24px; align-items: start; margin: 26px 0 10px;
}

.wheel-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* grid/flex items must never force the page wider than the viewport */
.wheel-col, .panel-col { min-width: 0; max-width: 100%; }

.wheel-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 22px 26px; position: relative;
}

.wheel-card:fullscreen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 0; padding: 20px;
}
.wheel-card:fullscreen .wheel-stage { max-width: min(90vmin, 720px); }

.wheel-title-input {
  border: 1px dashed transparent; background: transparent;
  font-weight: 800; font-size: 1.15rem; color: var(--ink);
  text-align: center; padding: 4px 10px; border-radius: 10px;
  width: 100%; max-width: 420px; margin: 0 auto 6px; display: block;
}
.wheel-title-input:hover { border-color: var(--line); }
.wheel-title-input:focus { border-color: rgba(91, 92, 230, 0.5); outline: none; background: #fff; }

.wheel-stage {
  position: relative; width: 100%; max-width: 540px;
  aspect-ratio: 1 / 1; margin: 4px auto 0;
}

.wheel-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.wheel-pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 40px; z-index: 5;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
}

.spin-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: clamp(78px, 22%, 108px); height: clamp(78px, 22%, 108px);
  border-radius: 50%; border: 0; cursor: pointer; z-index: 4;
  background: #fff; color: var(--ink);
  font-weight: 800; font-size: clamp(0.95rem, 2vw, 1.15rem); letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(30, 36, 70, 0.25), 0 0 0 7px rgba(255, 255, 255, 0.9);
  transition: transform 0.15s;
}
.spin-hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.spin-hub:disabled { cursor: wait; color: var(--muted); }

.wheel-actions {
  display: flex; gap: 10px; justify-content: center; align-items: center;
  flex-wrap: wrap; margin-top: 18px;
}

.result-line {
  text-align: center; font-weight: 700; min-height: 28px;
  color: var(--ink-2); font-size: 1rem;
}
.result-line .val { color: var(--brand); }

.history-wrap { text-align: center; }
.history-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.history-chip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 13px; font-size: 0.84rem;
  color: var(--ink-2); font-weight: 600; display: inline-flex; gap: 7px; align-items: center;
}
.history-chip i { font-style: normal; color: var(--brand); font-weight: 800; font-size: 0.75rem; }
.history-clear {
  background: none; border: 0; color: var(--muted); font-size: 0.8rem;
  cursor: pointer; text-decoration: underline; margin-left: 6px;
}

/* Toolbar chips (presets / variants) */
.toolbar-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  background: var(--card); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: 999px; padding: 8px 16px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.chip:hover { border-color: rgba(91, 92, 230, 0.55); color: var(--brand); }
.chip.active { background: var(--brand-grad); color: #fff; border-color: transparent; }

.toolbar-form {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center;
}
.toolbar-form label { font-size: 0.86rem; color: var(--muted); font-weight: 600; }
.mini-input {
  width: 76px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 0.95rem; font-family: inherit; background: var(--card); color: var(--ink);
}
.mini-input:focus { border-color: rgba(91, 92, 230, 0.55); outline: none; }

/* ================= Editor panel ================= */

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 1.02rem; font-weight: 800; display: flex; gap: 9px; align-items: center; }
.panel-head h2 svg { width: 20px; height: 20px; }
.panel-body { padding: 16px 20px 20px; }

.entry-list { list-style: none; max-height: 322px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.entry-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.color-dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0;
}
.entry-row input[type="text"] {
  flex: 1; flex-basis: 0; min-width: 0; width: 100%; max-width: 100%;
  border: 1px solid transparent; background: var(--bg-soft);
  border-radius: 10px; padding: 9px 12px; font-size: 0.95rem; font-family: inherit; color: var(--ink);
}
.entry-row input[type="text"]:focus { border-color: rgba(91, 92, 230, 0.55); outline: none; background: #fff; }

.entry-weight { width: 62px; flex-shrink: 0; }
.entry-weight input {
  width: 100%; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: 7px 4px; font-size: 0.85rem; text-align: center; color: var(--ink);
}
.entry-chance { font-size: 0.74rem; color: var(--muted); font-weight: 700; width: 44px; text-align: right; flex-shrink: 0; }

.row-remove {
  width: 30px; height: 30px; border-radius: 8px; border: 0; flex-shrink: 0;
  background: transparent; color: #b6bccd; font-size: 1.05rem; cursor: pointer; line-height: 1;
}
.row-remove:hover { background: rgba(239, 77, 90, 0.1); color: var(--no); }

.add-entry {
  width: 100%; margin-top: 10px; padding: 11px; border-radius: 10px;
  border: 1.5px dashed #c9cede; background: transparent; color: var(--muted);
  font-weight: 700; cursor: pointer; font-size: 0.92rem;
}
.add-entry:hover { border-color: var(--brand); color: var(--brand); }

.panel-actions {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px;
}
.panel-actions .btn { padding: 9px 6px; font-size: 0.85rem; min-height: 40px; }

.bulk-toggle {
  background: none; border: 0; color: var(--brand); font-weight: 700;
  cursor: pointer; font-size: 0.88rem; padding: 4px 0; margin-top: 12px;
}
.bulk-area { display: none; margin-top: 10px; }
.bulk-area.open { display: block; }
.bulk-area textarea {
  width: 100%; height: 110px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 0.92rem; color: var(--ink); background: var(--bg-soft);
}
.bulk-area textarea:focus { border-color: rgba(91, 92, 230, 0.55); outline: none; background: #fff; }
.bulk-btns { display: flex; gap: 8px; margin-top: 8px; }

/* Settings */
.settings-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.settings-block h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 10px; font-weight: 800;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0;
}
.setting-row .lbl { font-size: 0.93rem; font-weight: 600; color: var(--ink-2); }
.setting-row .lbl small { display: block; font-weight: 500; color: var(--muted); font-size: 0.78rem; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: #cfd4e4; border-radius: 999px;
  transition: background 0.2s; cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(91, 92, 230, 0.6); outline-offset: 2px; }

.duration-row { display: flex; align-items: center; gap: 12px; }
.duration-row input[type="range"] { flex: 1; accent-color: var(--brand); height: 26px; }
.duration-val { font-weight: 800; color: var(--brand); font-size: 0.9rem; width: 38px; text-align: right; }

/* ================= Teams view ================= */

.teams-view { display: none; }
.teams-view.open { display: block; }
.teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.team-card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; min-width: 0;
}
.team-card h4 { font-size: 0.95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.team-card .swatch { width: 14px; height: 14px; border-radius: 5px; display: inline-block; }
.team-card ol { margin-left: 20px; font-size: 0.92rem; color: var(--ink-2); }
.team-card li { padding: 2px 0; }

/* ================= Modal ================= */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(22, 25, 45, 0.6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--card); border-radius: 22px; padding: 34px 30px 28px;
  max-width: 460px; width: 100%; text-align: center; position: relative;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9); transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 86vh; overflow-y: auto;
}
.modal-overlay.open .modal-card { transform: scale(1); }

.modal-close {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px;
  border-radius: 50%; border: 0; background: var(--bg-soft); color: var(--muted);
  font-size: 1.05rem; cursor: pointer;
}
.modal-close:hover { background: var(--line); color: var(--ink); }

.modal-label { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.modal-result {
  font-size: clamp(1.7rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em;
  margin: 8px 0 4px; word-break: break-word;
}
.modal-result.giant { font-size: clamp(3.4rem, 12vw, 5rem); }
.modal-result.win { color: var(--ok); }
.modal-result.lose { color: var(--no); }
.modal-sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 8px; }

.modal-swatch {
  width: 92px; height: 92px; border-radius: 50%; margin: 12px auto;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22), inset 0 0 0 5px rgba(255, 255, 255, 0.55);
}
.modal-badge {
  display: inline-block; padding: 6px 20px; border-radius: 999px; color: #fff;
  font-weight: 800; letter-spacing: 0.08em; font-size: 0.85rem; margin: 6px 0;
}
.modal-question { font-size: 1.18rem; font-weight: 700; line-height: 1.5; margin: 12px 0 6px; }

.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.confetti-canvas {
  /* inset-only sizing: 100vw would count the vertical scrollbar and
     itself create a horizontal overflow */
  position: fixed; inset: 0; pointer-events: none; z-index: 400;
  width: 100%; height: 100%;
}

/* ================= Toast ================= */

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 0.92rem; z-index: 500; opacity: 0;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
  box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= Content sections ================= */

.content-section { padding: 44px 0 6px; }
.content-section:first-of-type { padding-top: 34px; }

.section-head { max-width: 780px; margin: 0 auto 26px; text-align: center; }
.section-head h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.9rem); font-weight: 800; letter-spacing: -0.025em;
}
.section-head .bar {
  width: 46px; height: 5px; border-radius: 3px; background: var(--brand-grad);
  margin: 12px auto 14px;
}
.section-head p { color: var(--muted); }

.prose { max-width: 780px; margin: 0 auto; }
.prose p { margin: 0 0 16px; color: var(--ink-2); }
.prose strong { color: var(--ink); }
.prose h3 { margin: 26px 0 10px; font-size: 1.15rem; }
.prose ul, .prose ol { margin: 0 0 16px 22px; color: var(--ink-2); }
.prose li { margin: 5px 0; }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow); position: relative;
}
.step-card .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 13px; background: var(--brand-grad);
  color: #fff; font-weight: 800; font-size: 1.1rem; margin-bottom: 12px;
  box-shadow: 0 6px 14px rgba(99, 91, 255, 0.35);
}
.step-card h3 { font-size: 1.02rem; margin-bottom: 6px; }
.step-card p { font-size: 0.92rem; color: var(--muted); }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.feature-card .ico {
  width: 46px; height: 46px; border-radius: 14px; display: flex;
  align-items: center; justify-content: center; font-size: 1.35rem;
  background: var(--bg-soft); margin-bottom: 12px;
}
.feature-card h3 { font-size: 1rem; margin-bottom: 5px; }
.feature-card p { font-size: 0.9rem; color: var(--muted); }

/* FAQ */
.faq-list { max-width: 780px; margin: 0 auto; display: grid; gap: 10px; }
.faq-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden;
}
.faq-item summary {
  list-style: none; cursor: pointer; padding: 17px 20px;
  font-weight: 700; font-size: 0.99rem; display: flex;
  justify-content: space-between; align-items: center; gap: 14px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 1.35rem; color: var(--brand); font-weight: 600;
  transition: transform 0.2s; flex-shrink: 0; line-height: 1;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 20px 18px; color: var(--muted); font-size: 0.94rem; }

/* Tools grid */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: flex-start;
  transition: transform 0.18s, box-shadow 0.18s;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.tool-card svg { width: 44px; height: 44px; flex-shrink: 0; }
.tool-card h3 { font-size: 0.99rem; color: var(--ink); margin-bottom: 3px; }
.tool-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.tool-card:hover h3 { color: var(--brand); }

/* Related inline links */
.related-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.related-links a {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 18px; font-weight: 700; font-size: 0.9rem; color: var(--ink-2);
}
.related-links a:hover { border-color: rgba(91, 92, 230, 0.55); color: var(--brand); text-decoration: none; }

/* ================= Footer ================= */

.site-footer {
  margin-top: 64px; background: #191e2e; color: #b9c0d4;
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px;
  padding: 46px 0 34px;
}
.footer-brand .logo { color: #fff; margin-bottom: 10px; }
.footer-brand p { font-size: 0.88rem; line-height: 1.6; }
.site-footer h4 {
  color: #fff; font-size: 0.86rem; text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 14px; font-weight: 800;
}
.site-footer ul { list-style: none; }
.site-footer li { margin: 7px 0; }
.site-footer a { color: #b9c0d4; font-size: 0.9rem; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: 18px 0; display: flex; justify-content: space-between; gap: 12px;
  font-size: 0.82rem; flex-wrap: wrap;
}

/* ================= Contact page ================= */

.contact-wrap {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: 24px; align-items: start; margin: 26px 0 10px;
}

.contact-form { padding: 26px 24px 24px; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.field { display: block; margin-bottom: 16px; min-width: 0; }
.field > span {
  display: block; font-size: 0.86rem; font-weight: 700;
  color: var(--ink-2); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; max-width: 100%;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-soft); color: var(--ink);
  padding: 11px 13px; font-size: 0.96rem; font-family: inherit;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: rgba(91, 92, 230, 0.6); background: #fff;
}
.field input.invalid, .field textarea.invalid { border-color: rgba(239, 77, 90, 0.7); }

.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-err {
  display: none; background: rgba(239, 77, 90, 0.08);
  border: 1px solid rgba(239, 77, 90, 0.35); color: #c22734;
  border-radius: 10px; padding: 10px 14px; font-size: 0.9rem;
  font-weight: 600; margin-bottom: 14px;
}
.form-ok {
  background: rgba(34, 176, 125, 0.08); border: 1px solid rgba(34, 176, 125, 0.35);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; color: #146c4d;
}
.form-ok strong { font-size: 0.98rem; }
.form-ok p { font-size: 0.88rem; margin-top: 4px; }

.contact-send { width: 100%; padding: 14px; font-size: 1.02rem; }

.form-note { font-size: 0.8rem; color: var(--muted); margin-top: 12px; text-align: center; }

.contact-side { display: grid; gap: 14px; }
.contact-side .info-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
}
.contact-side .ico {
  width: 42px; height: 42px; border-radius: 12px; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 10px;
}
.contact-side h3 { font-size: 0.98rem; margin-bottom: 4px; }
.contact-side p { font-size: 0.9rem; color: var(--muted); word-break: break-word; }

@media (max-width: 900px) {
  .contact-wrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .contact-form { padding: 18px 16px 16px; }
}

/* ================= Misc pages ================= */

.page-prose { max-width: 800px; margin: 40px auto 20px; }
.page-prose h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -0.03em; margin-bottom: 18px; }
.page-prose h2 { font-size: 1.25rem; margin: 30px 0 10px; }
.page-prose p, .page-prose li { color: var(--ink-2); }
.page-prose ul, .page-prose ol { margin: 0 0 16px 22px; }
.page-prose .updated { color: var(--muted); font-size: 0.88rem; }

.err-page { text-align: center; padding: 90px 20px 60px; }
.err-page .code {
  font-size: clamp(4.5rem, 16vw, 7.5rem); font-weight: 800; letter-spacing: -0.04em;
  background: var(--brand-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; line-height: 1;
}
.err-page h1 { margin: 8px 0 10px; }
.err-page p { color: var(--muted); margin-bottom: 24px; }

/* ================= Responsive ================= */

@media (max-width: 1020px) {
  .tool-wrap { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  /* full nav does not fit between 761–1020px once translated
     (long labels + 8 links) — switch to the hamburger menu earlier */
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .nav-dropdown { min-width: 420px; }
}

@media (max-width: 760px) {
  .home-hero { padding-top: 30px; }
  .tool-hero { padding-top: 22px; }
  .wheel-card { padding: 16px 14px 20px; }
  .panel-body { padding: 14px 14px 18px; }
  .panel-head { padding: 13px 14px; }
  .panel-actions { grid-template-columns: repeat(2, 1fr); }
  .steps-grid, .features-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; padding: 34px 0 24px; }
  .content-section { padding: 32px 0 4px; }
  .entry-list { max-height: 260px; }
  .tool-card { padding: 16px; }
  .modal-card { padding: 28px 20px 22px; }
}

@media (max-width: 420px) {
  .container { padding: 0 14px; }
  .btn-spin { padding: 14px 38px; }
  .tools-grid { grid-template-columns: 1fr; }
}

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