/* =========================================================
   3JCN Runway Takeoff Simulation
   runway.css
   Compact horizontal control panel so the runway stays visible.
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: #ffffff;
  color: #111;
}

body {
  overflow-x: hidden;
}


/* =========================================================
   SIMULATION AREA
   ========================================================= */

#simulationArea {
  position: relative;
  width: 100%;
  height: 640px;
  min-height: 560px;
  overflow: hidden;
  background: #87ceeb;
}

#viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}


/* =========================================================
   TITLE
   ========================================================= */

#sceneTitle {
  position: absolute;
  top: 12px;
  left: 0;
  width: 100%;
  z-index: 20;
  text-align: center;
  pointer-events: none;
}

#sceneTitle h1 {
  margin: 0;
  padding: 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 2.5vw, 34px);
  line-height: 1.15;
  font-weight: 700;
  color: #b32626;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}


/* =========================================================
   HORIZONTAL CONTROLS OVER THE 3D SCENE
   ========================================================= */

/* The HTML uses #controlsOverlay and .control-panel. */
#controlsOverlay {
  position: absolute;
  top: 54px;                 /* below the title */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 1180px;
  z-index: 20;
  pointer-events: none;
}

.control-panel {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px 16px;
  padding: 5px 8px;

  /* No large panel: controls float directly over the scene. */
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: auto;
}

.control-panel h2 {
  flex: 0 0 100%;
  margin: 0 0 2px;
  padding: 0;
  text-align: center;
  font-size: 16px;
  line-height: 1.15;
  color: #111;
}

.control-panel .control-group {
  flex: 1 1 220px;
  max-width: 290px;
  min-width: 190px;
  margin: 0;
  padding: 3px 6px;
  background: rgba(255,255,255,0.62);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}

.control-panel .control-group label {
  display: block;
  margin-bottom: 2px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Keep the Three.js scene full-size behind the controls. */
#simulationContainer {
  position: absolute;
  inset: 0;
}

/* =========================================================
   SLIDERS
   ========================================================= */

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.slider-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 80px;
  width: 100%;
  margin: 0;
  accent-color: #1683ff;
  cursor: pointer;
}

.slider-row input[type="text"] {
  flex: 0 0 60px;
  width: 60px;
  height: 30px;
  padding: 3px 5px;

  border: 1px solid #666;
  border-radius: 4px;

  background: #fff;
  color: #111;

  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.minmax {
  display: flex;
  justify-content: space-between;
  margin-top: 1px;
  margin-right: 68px;
  font-size: 11px;
  line-height: 1.1;
  font-weight: 400;
  color: #444;
}


/* =========================================================
   LIVE DATA
   ========================================================= */

.data-grid {
  grid-area: data;

  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;

  padding: 4px 7px;

  background: rgba(255, 255, 255, 0.62);
  border: 1px solid #b8b8b8;
  border-radius: 7px;
}

.data-grid > div {
  display: grid;
  grid-template-columns: 1fr 62px;
  align-items: center;
  gap: 7px;

  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.data-grid input[type="text"] {
  width: 62px;
  height: 27px;
  padding: 2px 4px;

  border: 1px solid #777;
  border-radius: 3px;

  background: #fff;
  color: #111;

  font-size: 13px;
  font-weight: 700;
  text-align: center;
}


/* =========================================================
   BUTTONS
   Both existing button-row elements are placed on one line.
   ========================================================= */

.button-row {
  grid-area: buttons;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/*
   The HTML contains two .button-row elements.
   Put the second one on the same grid row.
*/
.control-panel > .button-row {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.control-panel > .button-row + .button-row {
  margin-top: 0;
  padding-right: 0;
  pointer-events: auto;
}

.control-panel .btn {
  min-width: 72px;
  padding: 7px 14px;

  border: 0;
  border-radius: 5px;

  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;

  cursor: pointer;
}

.control-panel .btn-danger {
  background: #df534d;
  color: #fff;
}

.control-panel .btn-success {
  background: #4caf50;
  color: #fff;
}

.control-panel .btn:hover,
.control-panel .btn:focus {
  filter: brightness(0.93);
}

.control-panel .btn:focus-visible,
.slider-row input:focus-visible {
  outline: 3px solid #111;
  outline-offset: 2px;
}


/* =========================================================
   STUDENT EXERCISE
   ========================================================= */

#exerciseSection {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 24px;
  background: #fff;
  color: #111;
}

#exerciseSection h2 {
  margin: 0 0 18px;
  color: #003366;
  font-size: 25px;
}

.exercise-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.exercise-item {
  min-width: 0;
}

.exercise-item label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.exercise-item input[type="text"],
.exercise-item input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 6px 9px;

  border: 1px solid #777;
  border-radius: 5px;

  background: #fff;
  color: #111;

  font-size: 15px;
}

.exercise-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exercise-check .btn {
  min-height: 38px;
}

#check-box {
  width: 22px;
  height: 22px;
}

#resultMessage {
  min-height: 30px;
  margin-top: 16px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
}

#resultMessage:empty {
  padding: 0;
}
#resultMessage {
  display: none;
  margin-top: 12px;
}
.correct-message {
  background: #e7f6e7;
  border: 1px solid #4d9b4d;
  color: #155b15;
}

.wrong-message {
  background: #fdeaea;
  border: 1px solid #c94b4b;
  color: #8b1616;
}


/* =========================================================
   CONTENT BELOW SIMULATION
   ========================================================= */

#seoContent {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 24px 34px;
  background: #fff;
  color: #111;
}

#seoContent h2 {
  margin-top: 28px;
  margin-bottom: 10px;
  color: #003366;
  font-size: 25px;
}

#seoContent h3 {
  margin-top: 18px;
  margin-bottom: 6px;
  color: #333;
  font-size: 19px;
}

#seoContent p,
#seoContent li {
  font-size: 17px;
  line-height: 1.6;
}

.formula-box {
  margin: 18px 0;
  padding: 13px 16px;

  border-left: 6px solid #1d70b8;
  background: #eef5ff;

  text-align: center;
  font-size: 22px;
  font-weight: 700;
}

.related-links a {
  font-weight: 700;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  background: #1d3557;
  color: #fff;
  text-align: center;
}

footer a {
  color: #ffd166;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1000px) {

  #simulationArea {
    height: 690px;
  }

  #controlsOverlay {
    top: 60px;
    width: calc(100% - 24px);
  }

  .control-panel {
    gap: 6px 10px;
  }

  .control-panel .control-group {
    flex: 1 1 190px;
    max-width: none;
  }

  .data-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .data-grid > div {
    grid-template-columns: auto 62px;
  }

  .control-panel > .button-row + .button-row {
    margin-top: -42px;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

  #simulationArea {
    height: 760px;
    min-height: 700px;
  }

  #sceneTitle {
    top: 8px;
  }

  #sceneTitle h1 {
    font-size: 25px;
  }

  #controlsOverlay {
    top: 50px;
    width: calc(100% - 16px);
  }

  .control-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 7px 8px;
  }

  .control-panel .control-group {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
  }

  .control-panel h2 {
    font-size: 17px;
  }

  .control-panel .control-group {
    font-size: 12px;
  }

  .data-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .data-grid > div {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    white-space: normal;
    text-align: center;
    font-size: 11px;
  }

  .data-grid input[type="text"] {
    width: 100%;
  }

  .control-panel > .button-row {
    flex-wrap: wrap;
  }

  .control-panel > .button-row + .button-row {
    margin-top: 0;
    justify-content: center;
    padding-right: 0;
  }

  .control-panel .btn {
    min-width: 70px;
    padding: 7px 10px;
  }

  .exercise-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .exercise-check {
    align-items: center;
  }

  #exerciseSection,
  #seoContent {
    padding-left: 16px;
    padding-right: 16px;
  }
}
.safe-question {
  flex: 0 0 120px;
}

.safe-question select {
  width: 100%;
  height: 38px;
  padding: 6px 10px;
  border: 1px solid #999;
  border-radius: 5px;
  font-size: 16px;
  background: white;
}

.answer-feedback {
  margin-top: 15px;
  padding: 11px;
  border-radius: 6px;
  font-weight: bold;
  display: none;
}

.answer-feedback.correct {
  display: block;
  color: #006400;
  background: #e7f5e7;
  border: 1px solid #59ad59;
}

.answer-feedback.incorrect {
  display: block;
  color: #a00000;
  background: #fdeaea;
  border: 1px solid #d66;
}

.answer-feedback.warning {
  display: block;
  color: #8a5a00;
  background: #fff4d6;
  border: 1px solid #d7ad42;
}

/* =========================================================
   VERY SMALL SCREENS
   ========================================================= */

@media (max-width: 430px) {

  #simulationArea {
    height: 810px;
  }

  .minmax {
    margin-right: 66px;
  }

  .data-grid {
    grid-template-columns: 1fr;
  }

  .data-grid > div {
    display: grid;
    grid-template-columns: 1fr 68px;
    text-align: left;
  }

  .data-grid input[type="text"] {
    width: 68px;
  }
}
