body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.2px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: filter .3s, background .2s, color .2s;
}
body.menu-open { overflow: hidden; }

header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 15px 40px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  z-index: 1001;
  position: relative;
}
.logo img { height: 40px; }

header nav { margin-left: 20px; margin-right: auto; }

/* Group actions on the right */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

nav ul {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color .2s;
}
nav a:hover { color: var(--link); }

.header-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s;
}
.header-btn:hover { background: var(--primary-hover); }

/* Theme toggle button */
.theme-toggle {
  margin-left: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.theme-toggle:hover { background: var(--card-bg); }

/* бургер */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  z-index: 1003;
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}
.burger span {
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: .3s;
  width: 100%;
  transform-origin: center;
  position: absolute;
  left: 0;
}
.burger span:nth-child(1) { top: 0; }
.burger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.burger span:nth-child(3) { bottom: 0; }
.burger.active span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { top: 50%; bottom: auto; transform: translateY(-50%) rotate(-45deg); }

/* мобильное меню */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  padding: 0 20px;
  opacity: 0;
  transition: max-height .4s, opacity .3s, padding .3s;
  position: relative;
  z-index: 1002;
}
.mobile-menu.open {
  max-height: 300px;
  padding: 10px 20px;
  opacity: 1;
}
.mobile-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 10px 0;
  font-weight: 500;
}
.mobile-menu a:hover { color: var(--link); }

/* overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 1000;
}
.overlay.show {
  opacity: 1;
  pointer-events: all;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 15px;
  padding: 20px;
}
/* Left-align numbered lists only on instruction page */
.instructions-page ol {
  text-align: left;
}

/* Instructions page layout */
.instructions-page main {
  display: block;
  text-align: left;
}
.instructions-container {
  max-width: 900px;
  margin: 0 auto;
  display: block;
}
.instructions-container h1 {
  margin: 10px 0 16px;
}

/* Ensure correct caret icon and color for accordion */
.instruction summary::after { content: '▸'; color: var(--muted); }

/* Collapsible instruction blocks */
.instruction {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
}
.instruction summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
}
.instruction summary::-webkit-details-marker { display: none; }
.instruction summary::after {
  content: '▸';
  color: var(--muted);
  transition: transform .2s ease;
  margin-left: 12px;
}
.instruction[open] summary::after { transform: rotate(90deg); }
.instruction h2 { margin: 0; font-size: 1.1rem; }

.instruction ol {
  margin: 0;
  padding: 12px 20px 16px 36px;
  border-top: 1px solid var(--border);
}
.instruction li { margin: 6px 0; line-height: 1.5; }
.instruction a { color: var(--link); }
.instruction a:hover { color: var(--link-hover); }

/* Responsive tweaks for instructions */
@media (max-width: 900px) {
  .instructions-container { max-width: 760px; }
}
@media (max-width: 768px) {
  .instructions-container { padding: 0; }
  .instruction h2 { font-size: 1rem; }
  .instruction ol { padding: 10px 16px 14px 28px; }
}
@media (max-width: 480px) {
  .instruction h2 { font-size: .95rem; }
  .instruction ol { padding-left: 24px; }
}
.notice {
  font-size: 3.5rem;
  font-weight: bold;
  line-height: 1.2;
}
.sub-notice { font-size: 1.5rem; color: var(--muted); }

.big-btn {
  padding: 20px 40px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 1.7rem;
  font-weight: 900;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  z-index: 1;
  transition: all .3s;
  animation: gradientShift 12s ease infinite;
}
.big-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  filter: blur(10px);
  z-index: -1;
  transition: all .6s;
}
.big-btn:hover {
  background: linear-gradient(270deg, var(--primary), #00f0ff, var(--primary));
  background-size: 600% 600%;
  animation: gradientShift 6s ease infinite, pulse 3s ease-in-out infinite;
  box-shadow: 0 0 100px rgba(0,240,255,.6), 1px 1px 15px var(--primary), 0 0 1000px rgba(0,240,255,.4);
  transform: scale(1.1);
}
.big-btn:hover::before {
  filter: blur(102px);
  opacity: .8;
}

@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

footer {
  background: var(--header-bg);
  color: var(--muted);
  text-align: center;
  padding: 15px;
  font-size: .9rem;
  border-top: 1px solid var(--border);
}

/* 📱 адаптив */
@media (max-width: 768px) {
  nav, .header-btn { display: none; }
  .burger {
    display: flex;
    position: absolute;
    top: 50%;
    right: 40px; /* same horizontal padding as logo side */
    transform: translateY(-50%);
    width: 30px; /* bigger hit area on mobile */
    height: 22px;
  }
  .theme-toggle { display: none !important; }
  .notice { font-size: 2.2rem; }
  .sub-notice { font-size: 1.1rem; }
  .big-btn {
    font-size: 1.2rem;
    padding: 14px 25px;
    max-width: 90%;
    white-space: nowrap;
  }
}
@media (max-width: 480px) {
  .notice { font-size: 1.6rem; }
  .sub-notice { font-size: 1rem; }
  .big-btn {
    font-size: 1rem;
    padding: 12px 20px;
    max-width: 95%;
  }
  .logo img { height: 32px; }
}
/* Focus visibility */
:where(a, button, .header-btn, .big-btn, .theme-toggle, .burger):focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 8px;
}
/* Final override for accordion caret icon (ASCII for safe encoding) */
.instruction summary::after { content: '>'; color: var(--muted); }
/* Final override for accordion caret icon */
.instruction summary::after { content: '▸'; color: var(--muted); }

/* Mobile: simulate hover state for CTA buttons */
@media (hover: none) and (max-width: 768px) {
  .big-btn {
    background: linear-gradient(270deg, var(--primary), #00f0ff, var(--primary));
    background-size: 600% 600%;
    animation: gradientShift 6s ease infinite, pulse 3s ease-in-out infinite;
    box-shadow: 0 0 100px rgba(0,240,255,.6), 1px 1px 15px var(--primary), 0 0 1000px rgba(0,240,255,.4);
    transform: scale(1.05);
  }
  .header-btn { background: var(--primary-hover); }
}

/* Mobile-only link under CTA */
.howto-link { display: none; }
@media (max-width: 768px) {
  .howto-link {
    display: inline-block;
    /* pull closer to the CTA button despite flex gap */
    margin-top: -8px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500; /* like nav items */
    transition: color .2s;
  }
  .howto-link:hover { color: var(--link); }
}
/* Theme variables */
:root {
  --bg: #ffffff;
  --text: #0d0d0d;
  --muted: #555555;
  --header-bg: #f7f7f7;
  --border: #e6e6e6;
  --link: #0048ff;
  --link-hover: #0033cc;
  --primary: #0048ff;
  --primary-hover: #0033cc;
  --card-bg: #ffffff;
  --overlay: rgba(0,0,0,.45);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0d;
    --text: #ffffff;
    --muted: #bbbbbb;
    --header-bg: #111111;
    --border: #222222;
    --link: #4da3ff;
    --link-hover: #7bbaff;
    --primary: #0048ff;
    --primary-hover: #0033cc;
    --card-bg: #0f0f0f;
    --overlay: rgba(0,0,0,.6);
  }
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --text: #0d0d0d;
  --muted: #555555;
  --header-bg: #f7f7f7;
  --border: #e6e6e6;
  --link: #0048ff;
  --link-hover: #0033cc;
  --primary: #0048ff;
  --primary-hover: #0033cc;
  --card-bg: #ffffff;
  --overlay: rgba(0,0,0,.45);
}
:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --text: #ffffff;
  --muted: #bbbbbb;
  --header-bg: #111111;
  --border: #222222;
  --link: #4da3ff;
  --link-hover: #7bbaff;
  --primary: #0048ff;
  --primary-hover: #0033cc;
  --card-bg: #0f0f0f;
  --overlay: rgba(0,0,0,.6);
}

