:root {
  --navy: #2c3e50;
  --softgray: #e9ecef;
  --teal: #1abc9c;
  --gold: #f1c40f;
  --slate: #556366;
  --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;
}

/* Header */
.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;
}

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

.page-title {
  margin: 0;
  justify-self: center;
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}

@media (max-width: 767px) {
  .header-grid {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .page-title {
    justify-self: start;
  }
  .header-actions {
    justify-self: start;
    width: 100%;
    margin-top: 8px;
  }
}

/* Experiment area */
.experiment-area {
  background: var(--gray-100);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
}

.cols {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .cols {
    flex-direction: row;
  }
}

/* Simulation area */
.sim-area {
  background: var(--softgray);
  border-radius: 8px;
  padding: 12px;
  position: relative;
  overflow: hidden;
  height: 420px;
}

@media (min-width: 768px) {
  .sim-area {
    flex: 2;
    margin-right: 24px;
  }
}

#simCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
}

/* Overlay badges */
.sim-overlay {
  position: absolute;
  left: 12px;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.overlay-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  box-shadow: var(--shadow-xs);
}

.badge.ready {
  background: rgba(26, 188, 156, 0.12);
  color: var(--teal);
}

.badge.tir {
  background: rgba(231, 76, 60, 0.12);
  color: var(--coral);
}

.badge.soft {
  background: rgba(44, 62, 80, 0.08);
  color: var(--navy);
  font-weight: 600;
}

/* Controls */
.controls {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .controls {
    flex: 1;
  }
}

.control-group {
  margin-bottom: 18px;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--slate);
  font-weight: 600;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range {
  flex: 1;
}

.value {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(26, 188, 156, 0.12);
  color: var(--teal);
  min-width: 74px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
}

.value.coral {
  background: rgba(231, 76, 60, 0.12);
  color: var(--coral);
}

.value.soft {
  background: rgba(44, 62, 80, 0.1);
  color: var(--navy);
  font-weight: 700;
}

.select {
  flex: 1;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--navy);
  font-weight: 600;
}

.sub-controls {
  margin-top: 10px;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.35;
}

/* Buttons */
.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

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

.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);
}

/* Readout + panel */
.readout {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--navy);
  font-size: 13px;
  line-height: 1.45;
}

.panel {
  margin-top: 24px;
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

/* Range styling */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: transparent;
}

input[type='range']:focus {
  outline: none;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(90deg, #d0d0d0, #bdbdbd);
  border-radius: 6px;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--navy);
  margin-top: -6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input[type='range']::-moz-range-track {
  height: 6px;
  background: linear-gradient(90deg, #d0d0d0, #bdbdbd);
  border-radius: 6px;
}

input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--navy);
  border: none;
}

/* Accessibility focus states */
button:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(26, 188, 156, 0.18);
  outline-offset: 2px;
}
/* --- only additions this sim needs on top of your existing styles.css --- */

.sim-area {
  position: relative;
}

#simCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
}

/* status badge overlay */
.sim-overlay {
  position: absolute;
  left: 12px;
  top: 12px;
  pointer-events: none;
}

.status.ready {
  background: rgba(26, 188, 156, 0.12);
  color: var(--teal);
}
.status.running {
  background: rgba(231, 76, 60, 0.12);
  color: var(--coral);
}

/* dropdown styling to match controls card */
.select {
  flex: 1;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--navy);
  font-weight: 600;
}

/* readout area inside controls */
.readout {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  color: var(--navy);
  font-size: 13px;
  line-height: 1.45;
}

/* --- toggle switch (Ray / Wave) --- */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  display: none;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(44, 62, 80, 0.18);
  border: 1px solid rgba(44, 62, 80, 0.22);
  transition: 0.2s;
  border-radius: 999px;
}

.switch .slider::before {
  position: absolute;
  content: '';
  height: 21px;
  width: 21px;
  left: 0px;
  top: -1px;
  background: var(--navy);
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: rgba(26, 188, 156, 0.18);
  border-color: rgba(26, 188, 156, 0.28);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}
