:root {
  --color-bg:           #090d16;
  --color-surface:      #1e293b;
  --color-border:       #1f2937;
  --color-nav-bg:       #111827;
  --color-accent:       #6366f1;
  --color-accent-light: #a5b4fc;
  --color-muted:        #94a3b8;
  --color-muted-dark:   #64748b;
  --color-text:         #ffffff;

  --red:    #ef4444;
  --green:  #10b981;
  --blue:   #3b82f6;
  --yellow: #f59e0b;

  --red-dim:    #7f1d1d;
  --green-dim:  #064e3b;
  --blue-dim:   #1e3a5f;
  --yellow-dim: #78350f;

  --red-glow:    rgba(239,68,68,0.55);
  --green-glow:  rgba(16,185,129,0.55);
  --blue-glow:   rgba(59,130,246,0.55);
  --yellow-glow: rgba(245,158,11,0.55);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  text-align: center;
  margin-top: 56px;
  padding: 6px;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
}

.top-bar {
  position: fixed; top: 0; left: 0; width: 100%;
  background-color: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 15px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 1000;
}

.title-link {
  text-decoration: none; color: var(--color-accent-light);
  font-size: 15px; font-weight: bold; letter-spacing: 0.5px;
}

.container {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

h1 {
  margin: 6px 0 2px 0;
  font-size: 2em;
  letter-spacing: 3px;
  font-weight: 900;
}

.tagline {
  font-size: 0.78em;
  color: var(--color-accent-light);
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Score / level box */
#info-box {
  background: linear-gradient(135deg, #1e1b4b, #2e1065);
  border: 2px solid var(--color-accent);
  border-radius: 12px;
  padding: 8px 20px;
  margin-bottom: 16px;
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
}

.info-cell { display: flex; flex-direction: column; align-items: center; }

.info-val {
  font-size: 2em;
  font-weight: 900;
  color: var(--color-accent-light);
  line-height: 1;
}

.info-label {
  font-size: 0.68em;
  color: var(--color-muted);
  font-weight: bold;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* The 2×2 button grid */
#pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin-bottom: 14px;
}

.color-btn {
  border: none;
  border-radius: 14px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: filter 0.08s, transform 0.08s;
  touch-action: manipulation;
  outline: none;
}

.color-btn[data-color="red"]    { background: var(--red-dim); }
.color-btn[data-color="green"]  { background: var(--green-dim); }
.color-btn[data-color="blue"]   { background: var(--blue-dim); }
.color-btn[data-color="yellow"] { background: var(--yellow-dim); }

.color-btn.lit[data-color="red"]    { background: var(--red);    box-shadow: 0 0 28px var(--red-glow); }
.color-btn.lit[data-color="green"]  { background: var(--green);  box-shadow: 0 0 28px var(--green-glow); }
.color-btn.lit[data-color="blue"]   { background: var(--blue);   box-shadow: 0 0 28px var(--blue-glow); }
.color-btn.lit[data-color="yellow"] { background: var(--yellow); box-shadow: 0 0 28px var(--yellow-glow); }

.color-btn:active, .color-btn.pressed {
  transform: scale(0.93);
}

.color-btn:disabled { cursor: default; }

/* Center divider decoration */
#pad-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
}

/* Message */
#message {
  min-height: 24px;
  font-weight: bold;
  font-size: 0.9em;
  color: #f43f5e;
  margin-bottom: 10px;
  padding: 0 8px;
}

/* Bottom buttons */
#controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 380px;
  padding-bottom: 12px;
}

.ctrl-btn {
  color: white;
  border: 0;
  padding: 13px 0;
  font-size: 1em;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  letter-spacing: 0.5px;
}

.ctrl-btn.start  { background: var(--color-accent); grid-column: span 2; }
.ctrl-btn.strict { background: #334155; border: 1px solid #475569; color: var(--color-muted); }
.ctrl-btn.strict.on { color: #fbbf24; border-color: #fbbf24; }

/* Strict badge */
.strict-badge {
  font-size: 0.65em;
  color: var(--color-muted);
  margin-bottom: 6px;
  letter-spacing: 1px;
}

/* Sequence progress dots */
#progress {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 14px;
  margin-bottom: 8px;
  max-width: 380px;
  width: 100%;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
  flex-shrink: 0;
}

.dot.filled { background: var(--color-accent); }
.dot.current { background: var(--color-accent-light); box-shadow: 0 0 6px var(--color-accent-light); }
.dot.correct { background: var(--green); }
.dot.wrong   { background: var(--red); }

/* Cookie */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background-color: var(--color-nav-bg);
  border-top: 1px solid var(--color-border);
  padding: 12px 15px; display: none; flex-direction: column;
  align-items: center; gap: 8px; z-index: 2000;
}
.cookie-text { font-size: 0.8em; color: var(--color-muted); margin: 0; line-height: 1.4; max-width: 420px; }
.cookie-text a { color: var(--color-muted); }
.cookie-btn {
  background: #10b981; color: #fff; border: none; padding: 7px 18px;
  font-size: 0.8em; font-weight: bold; border-radius: 6px; cursor: pointer;
  width: 100%; max-width: 110px;
}
@media (min-width: 480px) {
  .cookie-banner { flex-direction: row; justify-content: center; gap: 20px; }
  .cookie-btn { width: auto; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}
.shake { animation: shake 0.35s ease-in-out; }