: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;
}

/* 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;
  border: 1px solid var(--gray-300);
}

.aim-statement {
  background: rgba(26, 188, 156, 0.08);
  border-left: 4px solid var(--teal);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.45;
}

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

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

/* Simulation area */
.sim-area {
  background: #ffffff;
  border-radius: 8px;
  padding: 12px;
  position: relative;
  overflow: hidden;
  height: 480px;
  border: 1px solid var(--gray-300);
}

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

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

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

/* LCD Stopwatch */
.stopwatch-display {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 14px 20px;
  text-align: center;
  border: 2px solid #2d2d44;
  margin-bottom: 18px;
}

.stopwatch-time {
  font-family: 'Courier New', 'Lucida Console', monospace;
  font-size: 2.2rem;
  color: #39ff7f;
  letter-spacing: 3px;
  text-shadow: 0 0 8px rgba(57, 255, 127, 0.4);
  line-height: 1;
}

.stopwatch-label {
  font-size: 11px;
  color: rgba(57, 255, 127, 0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

.sw-btn {
  width: 100%;
  margin-bottom: 18px;
}

/* Temperature selector */
.temp-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.temp-btn {
  flex: 1;
  padding: 8px 4px;
  border-radius: 6px;
  border: 2px solid var(--gray-300);
  background: white;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.temp-btn:hover {
  border-color: var(--teal);
}

.temp-btn.active {
  border-color: var(--teal);
  background: rgba(26, 188, 156, 0.12);
  color: var(--navy);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.teal-btn {
  background-color: rgba(26, 188, 156, 0.8);
  color: white;
}
.teal-btn:hover:not(:disabled) {
  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:not(:disabled) {
  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:not(:disabled) {
  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:not(:disabled) {
  background-color: rgba(44, 62, 80, 0.7);
  transform: translateY(-2px);
}

/* Button stack (vertical) */
.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Table input */
.table-input {
  width: 100%;
  max-width: 200px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  background: white;
  font: inherit;
  font-size: 14px;
  color: var(--navy);
  text-align: center;
}

.table-input:focus {
  outline: 3px solid rgba(26, 188, 156, 0.18);
  outline-offset: 2px;
}

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

/* Results table */
.table-wrap {
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--softgray);
}

.results-table th,
.results-table td {
  border: 1px solid var(--softgray);
  padding: 8px;
  text-align: center;
}

.results-table thead tr {
  background: var(--softgray);
}

.results-table th {
  font-weight: 700;
  font-size: 13px;
}

.results-table td {
  font-size: 14px;
  font-weight: 500;
}

/* Analysis section */
.analysis-question {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--gray-100);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.analysis-question p {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 10px 0;
}

.analysis-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  background: white;
  font: inherit;
  font-size: 14px;
  color: var(--navy);
  resize: vertical;
  min-height: 60px;
}

.analysis-input:focus {
  outline: 3px solid rgba(26, 188, 156, 0.18);
  outline-offset: 2px;
}

/* Expandable note */
.expandable-note {
  margin-top: 14px;
}

.note-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  padding: 6px 0;
}

.note-toggle:hover {
  color: var(--navy);
}

.note-arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 12px;
}

.note-arrow.open {
  transform: rotate(90deg);
}

.note-content {
  display: none;
  padding: 12px 16px;
  background: rgba(26, 188, 156, 0.06);
  border-left: 3px solid var(--teal);
  border-radius: 0 6px 6px 0;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--navy);
}

.note-content.visible {
  display: block;
}

/* Accessibility focus states */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(26, 188, 156, 0.18);
  outline-offset: 2px;
}
