:root {
  --navy: #2c3e50;
  --softgray: #ecf0f1;
  --teal: #1abc9c;
  --gold: #f1c40f;
  --slate: #7f8c8d;
  --coral: #e74c3c;
  --white: #ffffff;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --max-width: 1120px;
  --container-pad: 16px;
  --radius: 10px;
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  color: var(--navy);
  background: linear-gradient(135deg, #ecf0f1 0%, #d6dbdf 100%);
  padding: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Responsive container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

li {
  line-height: 2; 
}

.header-left{
  justify-self: start;
}

.page-header {
    text-align: center;
    color: var(--navy);
    padding: 1rem;
    position: relative;
}

.header-grid{
  display: grid;
  grid-template-columns: 1fr auto 1fr; 
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.page-title{
  margin: 0;
  justify-self: center;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}
.header-actions{
  justify-self: end;
}

/* mobile: stack nicely */
@media (max-width: 767px){
  .header-grid{
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    text-align: left;
  }
  .page-title{ justify-self: start; }
  .header-actions{ justify-self: start; width:100%; margin-top:8px; }
  .quiz-btn{ width:100%; max-width:420px; }
}
.cols {
  display: flex;
  flex-direction: column;
  gap: 24px;
}


.simulation-area {
    background: var(--gray-200);
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    position: relative;
    height: clamp(350px, 50vw, 450px);
    border: 2px solid var(--gray-300);
}

.balance-container {
    position: relative;
    width: 100%;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pivot {
    width: 20px;
    height: 80px;
    background: var(--navy);
    position: absolute;
    bottom: 250px;
    border-radius: 10px;
    z-index: 1;
}

.beam {
    width: 90%;
    height: 60px;
    background: #C4A484;
    position: absolute;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    transform-origin: center;
    transition: transform 0.5s ease;
    border-radius: 4px;
    z-index: 2;
  --counter-rot: 0deg;
}

.scale {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 20px;
}

.scale-mark {
    width: 2px;
    height: 20px;
    background: var(--navy);
    position: absolute;
    top: 0;
   
}

.scale-number {
    position: absolute;
    top: 20px;
    left: 0;
    width: 40px;
    font-size: 16px;
    font-weight: bold;
    color: var(--navy);
    text-align: center;
    pointer-events: none;
   
}

.mass-container {
    position: absolute;
    cursor: grab;
    transition: 0.2s ease;
    z-index: 100;
    transform-origin: top center;
   
  display: flex;
  flex-direction: column;
  align-items: center;  
   
  --scale: 1;
  
  transform: translateX(-50%) rotate(var(--counter-rot)) scale(var(--scale));
  transition: transform 0.12s ease;
}

.mass-container:hover {
    scale: 1.05;  
 
}

.mass-container.dragging {
    cursor: grabbing;
   
    z-index: 100;
}



.hook {
    width: 3px;
    height: 50px;
    background: var(--navy);
    margin: 0 auto;
    border-radius: 2px;
}

.hook-top {
    width: 12px;
    height: 3px;
    background: var(--navy);
    margin: 0 auto;
    border-radius: 2px;
    margin-bottom: 0px;
}

.hook-top, .hook, .mass, .force-arrow {
  margin: 0;
  display: block;
}

.mass { line-height: 1; } 

.mass {
    width: 35px;
    height: 15px;
    background: linear-gradient(145deg, var(--coral), #c0392b);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid #a93226;
    box-shadow: 0 4px 8px rgba(44, 62, 80, 0.2);
    margin-top: 2px;
}

.mass-container:hover .mass {
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.4);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

/* Button styles */
.teal-btn {
  background-color: rgba(26, 188, 156, 0.8);
  color: white;
}

.teal-btn:hover {
    background-color: rgba(26, 188, 156, 0.7);
    transform: translateY(-2px);
}

.gold-btn {
  background-color: rgba(241, 196, 15, 1);
  color: var(--navy); opacity:0.9;
}

.gold-btn:hover {
  background-color: rgba(241, 196, 15, 0.5);
  transform: translateY(-2px);
}

.coral-btn {
  background-color: rgba(231, 76, 60, 0.8);
  color: white;
}

.coral-btn:hover {
  background-color: rgba(231, 76, 60, 0.7);
  transform: translateY(-2px);
}

.navy-btn {
  background-color: rgba(44, 62, 80, 0.8);
  color: white;
}

.navy-btn:hover {
    background-color: rgba(44, 62, 80, 0.7);
    transform: translateY(-2px);
}

.teal-btn:active,
.gold-btn:active,
.coral-btn:active,
.navy-btn:active {
  transform: translateY(1px);
  opacity: 0.95;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    width: auto;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 24px;
}




.btn.small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn.soft {
  background: var(--softgray);
  color: var(--slate);
}

.data-table {
    background: var(--white);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.05);
    border: 2px solid var(--gray-300);
    margin-top: 20px;
}

.table-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--navy);
    margin-bottom: 20px;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 15px;
    text-align: center;
    border: 2px solid var(--gray-300);
}

th {
    background: var(--teal);
    color: white;
    font-weight: 600;
}

td {
    background: var(--gray-100);
}

input {
    width: 80px;
    padding: 8px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

.drop-zone {
    position: absolute;
   background: var(--gray-200);
    width: 10px;
    height: 10px;
    border-radius: 10px;
    bottom: 3px;
    transform: translateX(-50%);
    border: 2px solid var(--gray-300);
    z-index: 3;
}

.drop-zone.active {
   background: var(--gray-100);
    width: 10px;
    height: 10px;
    border: 2px solid var(--gray-300);
   z-index: 4;   
}

.instructions {
    background: rgba(26, 188, 156, 0.1);
    border: 2px solid var(--teal);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--navy);
}

.balance-status {
    text-align: center;
    font-weight: 600;
    margin-top: 15px;
    font-size: 1.2rem;
    height: 30px;
}

.balanced {
    color: var(--teal);
}

.unbalanced {
    color: var(--coral);
}

.nav-placeholder, .footer-placeholder {
    background-color: var(--gray-200);
    padding: 1rem;
    text-align: center;
    color: var(--slate);
    margin-bottom: 20px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .container {
        padding: 1em;
    }
    
    .simulation-area {
        height: 400px;
        padding: 20px;
    }

    .balance-container {
        height: 300px;
    }

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .simulation-area {
        height: 350px;
        padding: 10px;
    }

    .balance-container {
        height: 250px;
    }
    
    .data-table {
        padding: 15px;
    }
    
    th, td {
        padding: 10px;
    }
}


/* Mass Storage Area */
.mass-storage {
    background: var(--gray-100);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid var(--gray-300);
}

.storage-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 15px;
    text-align: center;
}

.mass-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.mass-option {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    cursor: grab;
  
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
    border: 0px solid #14967c;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.mass-option:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Mass styles based on value */
.mass-value-1 {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    border-color: #a93226;
    height: 20px;
    width: 30px;
}

.mass-value-2 {
    background: linear-gradient(145deg, #FFB33A, #FFAC1C);
    border-color: #FFB33A;
    height: 25px;
    width: 35px;
}

.mass-value-3 {
    background: linear-gradient(145deg, #ffd966, #ffd147);
    border-color: #feca2d;
    height: 30px;
    width: 40px;
}
.mass-value-4 {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
    border-color: #229954;
    height: 35px;
    width: 45px;
}

.mass-value-5 {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-color: #2471a3;
    height: 40px;
    width: 50px;
}

.mass-container,
.mass-option,
.mass, .hook, .hook-top {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.simulation-area, .balance-container, #beam {
  overscroll-behavior: contain;
}

/* Global lock while dragging (toggled in JS) */
html.drag-lock, body.drag-lock {
  touch-action: none;
  overscroll-behavior: none;
}
/* Visual feedback for answers */
input.answer-correct {
  border-color: #2ecc71 !important;
  background: #E9F9F0 !important;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15);
}

input.answer-incorrect {
  border-color: #e74c3c !important;
  background: #FDEDEC !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}

.feedback-mark {
  margin-left: 8px;
  font-weight: 700;
  font-size: 16px;
  vertical-align: middle;
}

.feedback-mark.correct { color: var(--teal); }    /* uses your palette */
.feedback-mark.incorrect { color: var(--coral); }

/* Force arrow stack sits right under the mass, no gap */
.force-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;          /* no gap under the mass */
  pointer-events: none;
}

/* Thicker, taller shaft */
.force-shaft {
  width: 6px;             /* was 4px */
  background: var(--navy);
  border-radius: 3px;
  margin: 0;              /* no gap to head */
  display: block;
}

/* ▼ Head pointing DOWN, attached to shaft (no seam) */
.force-head {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;   /* wider head */
  border-right: 10px solid transparent;
  border-top: 14px solid var(--navy);    /* ↓ use border-top to point DOWN */
  margin-top: -1px;                      /* overlap 1px to hide any seam */
  line-height: 0;
  display: block;
}

/* Label just below the head */
.force-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2px;
  line-height: 1;
}

/* Ensure the mass itself doesn’t add a gap above the arrow */
.mass + .force-arrow { margin-top: 0; }

/*/* ===== Advanced Toggle ===== */
.advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
}

.advanced-toggle__input {
  /* hide native checkbox but keep it accessible */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.advanced-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

/* Track acts as the positioning context */
.advanced-toggle__track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--gray-300);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.06);
  position: relative;     /* <-- key */
  overflow: hidden;       /* keeps thumb clipped inside */
}

/* Thumb sits INSIDE the track, so it’s visible */
.advanced-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 6px rgba(44,62,80,0.25);
  transition: transform 160ms ease;
}

.advanced-toggle__text {
  font-size: 0.95rem;
  color: var(--navy);
  font-weight: 600;
}

/* ON state */
.advanced-toggle__input:checked + .advanced-toggle__label .advanced-toggle__track {
  background: var(--teal);
}
.advanced-toggle__input:checked + .advanced-toggle__label .advanced-toggle__thumb {
  transform: translateX(20px);
}

/* Focus ring (keyboard) */
.advanced-toggle__input:focus-visible + .advanced-toggle__label .advanced-toggle__track,
.advanced-toggle__label:focus-visible .advanced-toggle__track {
  outline: 3px solid rgba(26,188,156,0.35);
  outline-offset: 2px;
}

/* Optional: wider gap row variant you asked for */
.controls--wide-gap { gap: 64px; }
@media (max-width: 768px) { .controls--wide-gap { gap: 16px; } }



/* Toast/snackbar used for temporary notices */
.sim-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(44,62,80,0.95);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(44,62,80,0.18);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2,.9,.3,1);
  z-index: 9999;
}

/* visible state */
.sim-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* optional theming class if you want an orange warning style */
.sim-toast.warn {
  background: linear-gradient(180deg, #E67E22, #D35400);
}
