:root {
  --bg1: #0f172a;
  --bg2: #0b1223;
  --accent: #ffd166;
}

* { box-sizing: border-box }
html, body { height: 100% }

/* ---------- BODY STYLING ---------- */
body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial;
  background: linear-gradient(135deg, var(--bg1), #0a2540);
  color: white;
}

/* main.html specific */
body.main-page {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.messages-page {
  display: flex;
  flex-direction: column;
  padding-bottom: 4rem; /* Add padding to prevent overlap with ticker */
}

/* ----- main.html container ----- */
body.main-page .container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ----- main.html messages ----- */
.message {
  font-size: clamp(2.5rem, 6vw, 6rem);
  font-weight: 800;
  line-height: 1;
  margin: 0 0 .5rem;
  transform: translateY(0);
  transition: transform .6s cubic-bezier(.2, .9, .3, 1);
}

.sub {
  font-family: 'Fira Code', 'Courier New', monospace; /* monospace for code */
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  opacity: .95;
  margin-bottom: 1.5rem;
  color: #ffd166; /* code-like colour for text */
  background: rgba(255,255,255,0.05); /* subtle highlight */
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  display: inline-block;
  line-height: 1.4;
  min-height: 2.5em; /* Prevent layout shift during typing */
  position: relative;
}

.sub::after {
  content: '|';
  animation: blink 1s infinite;
  color: #ffd166;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.cake { font-size: 0.8em; margin-left: .5rem }

.button {
  background: linear-gradient(90deg, #ffd166, #ff8a66);
  border: none;
  padding: .9rem 1.6rem;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}

.extra-button {
  margin-top: 1rem;
  background: linear-gradient(90deg, #66ffd1, #66aaff);
  border: none;
  padding: .7rem 1.4rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}

.info { margin-top: 1rem; opacity: .9 }

.controls {
  position: fixed;
  left: 1rem;
  top: 1rem;
}

.small-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,.12);
  color: white;
  padding: .35rem .6rem;
  border-radius: 8px;
  font-size: .9rem;
}


.hidden { display: none }

canvas {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  left: 0;
  top: 0;
}

/* ----- messages.html specific ----- */
header {
  padding: 1.2rem;
  text-align: center;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
}

header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--accent);
}

/* renamed from .container to avoid conflict */
.grid-container {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: rgba(255,255,255,0.07);
  padding: 1.2rem;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .25s;
}

.card:hover { transform: translateY(-6px) scale(1.02) }

.card p {
  margin: 0 0 1rem;
  line-height: 1.4;
  font-size: 1rem;
}

.student {
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
  text-align: right;
}

.back-btn {
  margin: 1.5rem auto 3rem auto; /* Increased bottom margin from 2rem to 3rem */
  display: inline-block;
  background: linear-gradient(90deg, #66ffd1, #66aaff);
  border: none;
  padding: .8rem 1.4rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  text-decoration: none;
  color: #000;
}


/* ----- footer (shared) ----- */
.footer {
  position: fixed;
  bottom: 3rem; /* Above the ticker */
  right: 1rem;
  font-size: 1.25rem;
  color: rgba(255,255,255,0.6);
  font-weight: 300;
  z-index: 1000;
}

/* ----- hover hint ----- */
.hover-hint {
  position: fixed;
  bottom: 3rem; /* Same level as footer */
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  color: rgba(255,255,255,0.9);
  font-weight: 500;
  z-index: 1000;
  animation: subtlePulse 2s ease-in-out infinite;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes subtlePulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* ----- ticker (shared) ----- */
.ticker {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: rgba(255,209,102,0.1);
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
}

.ticker-content {
  display: inline-block;
  padding: 0.5rem 0;
  animation: tickerScroll 30s linear infinite; /* Slowed down from 20s to 30s */
}

.ticker-content span {
  margin: 0 2rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent);
  transition: color 0.3s ease;
}

.ticker-content span.active-hover {
  color: #fff;
}

/* Student photo popup */
.student-photo-popup {
  position: fixed;
  bottom: 4rem; /* Just above the ticker */
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 2000;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.student-photo-popup.visible {
  opacity: 1;
  visibility: visible;
}

@keyframes tickerScroll {
  0% { transform: translateX(100%) }
  100% { transform: translateX(-100%) }
}