/* ===============================
   Global Layout
================================*/
body {
  background: #0e0e0e;
  color: #f4f4f4;
  font-family: "Inter", Arial, sans-serif;
  margin: 0;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}


/* ===============================
   Header with logos + language toggle
================================*/
header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;              
  margin-top: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  position: relative;
}

/* Keep logos vertically centered with the flag */
header a img {
  vertical-align: middle;
}

/* Make flag look like part of the header bar */
#langToggle {
  margin-left: 24px;
  background: #1c1c1c;
  border-radius: 6px;
  padding: 4px 6px;
  border: 1px solid #333;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}
#langToggle:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
}
#langToggle img {
  width: 42px;    /* slightly larger for better balance */
  height: auto;
  border-radius: 4px;
  opacity: 0.95;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
#langToggle img:hover {
  opacity: 1;
  transform: scale(1.06);
}

/* ===============================
   Startup Overlay
================================*/
#startupOverlay {
  position: absolute;             /* <— absolute inside viewer area */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;                  /* higher than panes, lower than guide */
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  border-radius: 8px;             /* match viewer shape nicely */
  pointer-events: none;           /* don’t block clicks if still fading */
}

#startupText {
  pointer-events: none;
}

/* ===============================
   Viewer Grid
================================*/
#viewer4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  width: 72vmin; /* smaller panes for better balance */
  aspect-ratio: 1 / 1;
  margin-top: 20px;
  gap: 3px;
  border-radius: 8px;
  overflow: hidden;
}

.pane {
  position: relative;
  background: black;
  overflow: hidden;
  border: 1px solid #222;
  border-radius: 4px;
}
.pane .title {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 12px;
  color: #ccc;
  text-shadow: 0 0 2px #000;
}

/* ===============================
   Class Toggles
================================*/
#toggleSection {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 6px;
}

#toggleExplanation {
  font-size: 14px;
  color: #aaa;
  text-align: center;
  margin-bottom: 6px;
}

#classToggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  max-width: 70vmin;
}

/* ===============================
   Education Section
================================*/
#eduSection {
  text-align: center;
  margin-top: 24px;
  max-width: 72vmin;
  font-size: 16px;
  line-height: 1.5em;
  color: #ddd;
}

/* ===============================
   Toolbar
================================*/
#toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 10px;
}

#toolbar button {
  border: none;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

/* Main action buttons (Next / Run AI / Done) */
#nextStep,
#runAI {
  background: #0078ff;
  color: white;
  font-weight: 500;
  box-shadow: 0 0 10px rgba(0, 120, 255, 0.3);
}
#nextStep:hover,
#runAI:hover {
  background: #3399ff;
  transform: translateY(-1px);
}

/* Step-specific visibility */
body.step1 #runAI { display: none; }   /* hide Run AI on /1 only */
body.step2 #nextStep { display: none; }/* hide Next on /2 */

/* Reset button styling */
#resetAnnot {
  background: #444;
  color: white;
}
#resetAnnot:hover {
  background: #666;
  transform: translateY(-1px);
}

/* ===============================
   Wait Overlay
================================*/
/* 3D loading text overlay (only text, no backdrop) */
#waitOverlay {
  display: none;               /* hidden by default */
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  pointer-events: none;        /* don’t block interaction */
}

#waitText {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.header-group {
  display: flex;
  align-items: center;
  gap: 40px;
}

canvas {
  touch-action: none !important;
}

/* ===============================
   Guide Popup
================================*/
#guidePopup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1c1c1c;
  color: #eee;
  padding: 20px 24px;
  border-radius: 8px;
  border: 1px solid #444;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
  max-width: 420px;
  width: 80%;
  z-index: 10000;
  text-align: left;
  line-height: 1.5em;
}

/* Optional backdrop (soft dark overlay) */
#guideBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
}

/* Guide popup buttons */
#guidePopup button {
  margin-top: 15px;
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: #0078ff;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

#guidePopup button:hover {
  background: #3399ff;
}
