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

body {
  overflow: hidden;
  background: black;
  font-family: 'Space Mono', monospace;
}

canvas { display: block; }

/* info overlay */
#info-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}

#info-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#info-title {
  position: relative;
  z-index: 2;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 36px;
  transform: translateY(-24px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.22,1,0.36,1) 0.1s,
              opacity   0.5s ease 0.1s;
}

#info-overlay.visible #info-title {
  transform: translateY(0);
  opacity: 1;
}

#info-title span {
  display: block;
  width: 48px;
  height: 3px;
  background: #4da3ff;
  margin: 10px auto 0;
  border-radius: 2px;
}

#cards-row {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 20px;
  align-items: stretch;
  transform: translateY(40px);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1) 0.2s,
              opacity   0.55s ease 0.2s;
}

#info-overlay.visible #cards-row {
  transform: translateY(0);
  opacity: 1;
}

.info-card {
  width: 260px;
  background: rgba(12, 18, 30, 0.85);
  border: 1px solid rgba(77, 163, 255, 0.25);
  border-radius: 16px;
  padding: 28px 24px;
  position: relative;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.info-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(77,163,255,0.6), transparent);
}

.info-card:hover {
  border-color: rgba(77, 163, 255, 0.65);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(77,163,255,0.12);
}

.card-eyebrow {
  font-family: 'Syne', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #4da3ff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: #4da3ff;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 18px;
  line-height: 1.2;
}

.card-body {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  line-height: 1.85;
  color: rgba(200, 215, 240, 0.75);
}

.card-body li {
  list-style: none;
  padding-left: 16px;
  position: relative;
  margin-bottom: 2px;
}

.card-body li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: #4da3ff;
}

.info-card.highlight {
  border-color: rgba(255, 200, 80, 0.35);
  background: rgba(20, 16, 10, 0.90);
}

.info-card.highlight::before {
  background: linear-gradient(90deg, transparent, rgba(255,200,80,0.5), transparent);
}

.info-card.highlight .card-eyebrow { color: #ffc850; }
.info-card.highlight .card-eyebrow::before { background: #ffc850; }

.info-card.highlight:hover {
  border-color: rgba(255,200,80,0.7);
  box-shadow: 0 16px 40px rgba(255,200,80,0.10);
}

#about-card {
  cursor: pointer;
}

#article-view {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#article-view.visible {
  opacity: 1;
  pointer-events: auto;
}

#cards-row,
#info-title,
#dismiss-hint {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#info-overlay.article-open #cards-row,
#info-overlay.article-open #info-title,
#info-overlay.article-open #dismiss-hint {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
}

#article-inner {
  width: min(680px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(12, 14, 22, 0.95);
  border: 1px solid rgba(255,200,80,0.25);
  border-radius: 20px;
  padding: 48px 52px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,200,80,0.3) transparent;
}

#article-inner::-webkit-scrollbar { width: 4px; }
#article-inner::-webkit-scrollbar-thumb { background: rgba(255,200,80,0.3); border-radius: 2px; }

#article-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: rgba(255,200,80,0.6);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 32px;
  padding: 0;
  transition: color 0.2s;
}

#article-back:hover { color: #ffc850; }

#article-back::before {
  content: '←';
  font-size: 14px;
}

#article-heading {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 6px;
}

#article-heading-bar {
  width: 36px;
  height: 2px;
  background: #ffc850;
  border-radius: 2px;
  margin-bottom: 28px;
}

#article-body p {
  font-size: 13px;
  line-height: 2;
  color: rgba(200,215,240,0.75);
  margin-bottom: 18px;
}

.fun-fact {
  margin-top: 28px;
  padding: 16px 20px;
  border-left: 2px solid #ffc850;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fun-fact-label {
  font-family: 'Syne', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffc850;
}

#fun-fact-text {
  font-size: 12px;
  line-height: 1.8;
  color: rgba(200,215,240,0.65);
  font-style: italic;
}

#dismiss-hint {
  position: relative;
  z-index: 2;
  margin-top: 32px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease 0.35s, transform 0.5s ease 0.35s;
}

#info-overlay.visible #dismiss-hint {
  opacity: 1;
  transform: translateY(0);
}

#info-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(10,18,32,0.85);
  border: 1px solid rgba(77,163,255,0.45);
  color: #4da3ff;
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(4px);
}

#info-btn:hover {
  background: rgba(77,163,255,0.15);
  border-color: #4da3ff;
  transform: scale(1.08);
}

#github-logo {
  position: fixed;
  top: 18px;
  right: 66px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(77,163,255,0.45);
  background: rgba(10,18,32,0.85);
  display: block;
  transition: transform 0.2s ease,
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

#github-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  transition: transform 0.25s ease;
}

#github-logo:hover {
  transform: translateY(-2px) scale(1.08);
  border-color: #4da3ff;
  box-shadow: 0 10px 25px rgba(77,163,255,0.18);
}

#github-logo:hover img {
  transform: scale(1.08);
}

#reset-btn {
  position: fixed;
  top: 18px;
  right: 114px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(10,18,32,0.85);
  border: 1px solid rgba(77,163,255,0.45);
  color: #4da3ff;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(4px);
}

#reset-btn:hover {
  background: rgba(77,163,255,0.15);
  border-color: #4da3ff;
  transform: scale(1.08);
}

#noise-btn {
  position: fixed;
  top: 18px;
  right: 162px;
  z-index: 20;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(10,18,32,0.85);
  border: 1px solid rgba(77,163,255,0.45);
  color: #4da3ff;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
  backdrop-filter: blur(4px);
}

#noise-btn:hover {
  background: rgba(77,163,255,0.15);
  border-color: #4da3ff;
  transform: scale(1.08);
}

#noise-btn.active {
  background: rgba(255,200,80,0.15);
  border-color: #ffc850;
  color: #ffc850;
}

/* fade behind the overlay when cards are open */
#github-logo,
#reset-btn,
#noise-btn,
#preset-select {
  transition: opacity 0.3s ease, transform 0.2s ease,
              box-shadow 0.2s ease, border-color 0.2s ease;
}

.hidden-by-overlay {
  opacity: 0;
  pointer-events: none;
}

/* preset dropdown */
#preset-select {
  position: fixed;
  top: 160px;
  left: 20px;
  z-index: 20;
  width: 165px;
  background: rgba(10, 18, 32, 0.88);
  border: 1px solid rgba(77, 163, 255, 0.45);
  border-radius: 8px;
  color: #4da3ff;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234da3ff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

#preset-select:hover  { border-color: #4da3ff; background-color: rgba(77,163,255,0.1); }
#preset-select:focus  { outline: none; border-color: #4da3ff; }
#preset-select option { background: #0a1220; color: #c8d7f0; }

/* toast notification */
#preset-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  z-index: 30;
  background: rgba(10, 16, 28, 0.92);
  border: 1px solid rgba(77, 163, 255, 0.35);
  border-radius: 12px;
  padding: 14px 22px;
  min-width: 280px;
  max-width: 420px;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22,1,0.36,1),
              opacity   0.4s ease;
}

#preset-toast::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(90deg, transparent, #4da3ff, transparent);
}

#preset-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

#toast-name {
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

#toast-desc {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(200, 215, 240, 0.65);
}