@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap");

:root {
  /* --- CLEAN BLUE THEME COLORS --- */
  --primary: #0696cf; 
  --primary-hover: #057eb0;
  --bg-color: #fcfcfc; 
  --text-dark: #222222;
  --text-light: #718096;
  --success: #0696cf; /* Matched to primary for a cohesive look */
  --error: #e63946;

  /* Abacus Colors */
  --abacus-frame: #1e293b; 
  --abacus-board: #ffffff; 
  --bead-color: #0696cf; 
  --bead-border: #057eb0; 
  --bead-hover: #38bdf8; 
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-color);
  margin: 0;
  padding: 0;
  padding-top: 100px; /* Extra space for floating header */
  color: var(--text-dark);
}

/* --- HEADER --- */
header {
  position: fixed;
  top: 15px;
  left: 5%;
  width: 90%;
  height: 70px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  border-radius: 50px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
  z-index: 1000;
  box-sizing: border-box;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--primary);
  padding: 6px 16px;
  border-radius: 10px;
  letter-spacing: normal;
  text-transform: none;
}

.nav-links {
  display: flex;
  gap: 20px;
}
.nav-links a {
  text-decoration: none;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-links a:hover {
  color: var(--primary);
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
  }
  .logo {
    font-size: 1.2rem;
  }
}

/* --- MAIN LAYOUT --- */
.app-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 900px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 0 15px;
  }
}

/* --- SIDE PANEL (QUESTIONS & SETTINGS) --- */
.side-panel {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.04); /* Soft shadow */
  border-top: none; /* Removed thick top border */
}

.settings-row {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  padding-bottom: 0;
  border-bottom: none; /* Removed dashed line for cleaner look */
}

.question-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  font-size: 2.2rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif; /* Replaced monospace */
  text-align: right;
  margin-bottom: 20px;
  min-height: 200px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
}

label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  font-size: 0.75rem;
  margin-bottom: 8px;
  display: block;
}

input[type="number"] {
  width: 100%;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid #cbd5e1; /* Thin bottom border only */
  border-radius: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  outline: none;
  background: transparent;
  transition: border-color 0.3s ease;
}

input[type="number"]:focus {
  border-bottom: 2px solid var(--primary);
}

.question-box {
  background: #f8fafc;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 20px;
  font-size: 1.8rem;
  font-weight: bold;
  font-family: monospace;
  text-align: right;
  margin-bottom: 20px;
  min-height: 200px;
}

.seq-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  letter-spacing: 2px;
}

.seq-line {
  border-top: 3px solid var(--text-dark);
  margin-top: 10px;
  padding-top: 10px;
}

.btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 6px; /* Squarer, modern corners */
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: white;
  transition: all 0.3s ease;
  margin-bottom: 10px;
  box-shadow: none; /* Flat look */
}

.btn-check, .btn-next {
  background: var(--primary);
}

.btn-check:hover, .btn-next:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(6, 150, 207, 0.2); /* Subtle glow on hover */
}

.btn-skip {
  background: #f1f5f9;
  color: var(--text-dark);
  border: 1px solid #cbd5e1;
}

.btn-skip:hover {
  background: #e2e8f0;
}

#feedback {
  text-align: center;
  font-weight: bold;
  font-size: 1.2rem;
  margin-top: 10px;
  min-height: 30px;
}

/* =========================================
         ABACUS CSS STYLES (Modern Blue Theme)
         ========================================= */
.abacus-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.abacus-container {
  display: inline-flex;
  background: var(--abacus-board);
  border: 20px solid var(--abacus-frame);
  padding: 15px;
  border-radius: 12px;
  box-shadow:
    inset 0 5px 15px rgba(0, 0, 0, 0.1),
    0 15px 30px rgba(0, 0, 0, 0.15);
  gap: 12px;
}

.abacus-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 65px;
}

.abacus-col::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 6px;
  background: #94a3b8;
  transform: translateX(-50%);
  z-index: 0;
  border-radius: 3px;
}

.beam {
  width: 100%;
  height: 18px;
  background: var(--abacus-frame);
  z-index: 1;
  margin: 8px 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.bead {
  width: 55px;
  height: 30px;
  border-radius: 15px;
  background: var(--bead-color);
  border: 2px solid var(--bead-border);
  z-index: 2;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    inset -3px -3px 6px rgba(0, 0, 0, 0.2),
    0 4px 5px rgba(0, 0, 0, 0.2);
}
.bead:hover {
  background: var(--bead-hover);
}

.upper-deck {
  height: 70px;
  display: flex;
  align-items: flex-start;
  width: 100%;
  justify-content: center;
}
.upper-deck .bead.active {
  transform: translateY(30px);
}

.bead.active {
  background: #60a5fa; /* A brighter, glowing blue */
  border-color: #3b82f6;
  box-shadow:
    inset -3px -3px 6px rgba(0, 0, 0, 0.1),
    0 0 12px 4px rgba(96, 165, 250, 0.6); /* Adds the glow effect */
}
.lower-deck {
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  align-items: center;
  gap: 8px;
}
.lower-deck .bead.active {
  transform: translateY(-38px);
}

.live-value {
  margin-top: 20px;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-light);
  background: white;
  padding: 10px 20px;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.05);
}

/* --- MOBILE ABACUS SCALING --- */
@media (max-width: 600px) {
  .abacus-container {
    border-width: 10px;
    padding: 8px;
    gap: 6px;
  }
  .abacus-col {
    width: 40px;
  }
  .abacus-col::before {
    width: 4px;
  }
  .beam {
    height: 12px;
    margin: 5px 0;
  }
  .bead {
    width: 34px;
    height: 18px;
    border-radius: 9px;
    border-width: 1px;
  }
  .upper-deck {
    height: 45px;
  }
  .upper-deck .bead.active {
    transform: translateY(24px);
  }

  .lower-deck {
    height: 120px;
    gap: 5px;
  }
  .lower-deck .bead.active {
    transform: translateY(-22px);
  }

  .question-box {
    font-size: 1.5rem;
    min-height: 150px;
  }
}
