:root {

  --bg-950: #e9f4fb;
  --bg-900: #fff4dd;
  --bg-800: #ffffff;
  --text-100: #123140;
  --text-300: #4b6570;
  --gold-500: #0f7e9b;
  --gold-400: #0b5f77;
  --surface: rgba(255, 255, 255, 0.96);
  --border: #c8dbe3;
  --shadow-lg: 0 12px 24px rgba(12, 54, 68, 0.12);

  --bg: #eef4f7;
  --panel: #ffffff;
  --text: #0f2f39;
  --muted: #3f606c;
  --accent: #0f8b8d;
  --line: #d3e1e7;
  --danger: #b03a48;
  --shadow: 0 10px 28px rgba(17, 45, 53, 0.08);

}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: "Inter", "IBM Plex Sans", sans-serif;
  color: var(--text-100);
  background: #e9f4fb;
  line-height: 1.45;
}

.shell {
  width: min(1200px, calc(100% - 2rem));
  margin-inline: auto;
}

.hero {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  background: linear-gradient(160deg, #ffffff, #f7fbfd);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 12px;
  border-radius: 14px 0 0 14px;
  background: var(--gold-500);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.hero-top > :first-child {
  min-width: 0;
  padding-left: 0.4rem;
}

.kicker {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-400);
  font-weight: 700;
}

.hero h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.85rem, 2.8vw, 3rem);
  line-height: 1.05;
  color: var(--text-100);
}

.subtitle {
  margin: 0.38rem 0 0;
  color: var(--muted);
  max-width: 76ch;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(12, 54, 68, 0.08);
}

.apparatus {
  grid-row: span 2;
}

.data,
.assessment {
  grid-column: span 2;
}

.panel h2 {
  margin: 0 0 0.4rem;
}

.control-group {
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  margin-top: 0.85rem;
}

.control-group:first-of-type {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

label {
  display: block;
  margin: 0.45rem 0 0.28rem;
  color: var(--muted);
  font-size: 0.92rem;
}

select,
input[type="range"],
input[type="number"],
button {
  border-radius: 10px;
  background: linear-gradient(160deg, #0d839f, #0b5f77);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid #0a5d74;
  padding: 0.58rem 0.82rem;
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--accent);
}

input[type="number"],
select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: #fbfdfe;
}

button {
  border-radius: 10px;
  background: linear-gradient(160deg, #0d839f, #0b5f77);
  color: #ffffff;
  font-weight: 700;
  border: 1px solid #0a5d74;
  padding: 0.58rem 0.82rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button.ghost {
  background: #e4edf1;
  color: var(--text);
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.readout {
  margin: 0.5rem 0 0;
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.toggle-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.toggle-line input {
  width: auto;
}

.meter-wrap {
  width: 100%;
  height: 16px;
  margin-top: 0.65rem;
  border-radius: 999px;
  background: #e2eaee;
  border: 1px solid #d0dce1;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8acb4c 0%, #ffc145 58%, #ef476f 100%);
  transition: width 100ms linear;
}

.apparatus-shell {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fcfd 0%, #f4f8fa 100%);
  padding: 0.5rem;
}

#apparatusSvg {
  width: 100%;
  max-height: 420px;
  display: block;
}

.tube-outline {
  fill: none;
  stroke: #4a6872;
  stroke-width: 3;
}

.tube-air {
  fill: #f6fdff;
}

.tube-water {
  fill: #5aa9c5;
  transition:
    y 120ms linear,
    height 120ms linear;
}

.cylinder-plate {
  fill: #6f8b95;
  transition: y 120ms linear;
}

.label {
  font-size: 12px;
  fill: #4c6974;
}

.guide-line {
  stroke: #89a7b2;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.fork-rack {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.fork-btn {
  background: #eaf2f6;
  color: #0f2f39;
  border: 1px solid #c8dae2;
  position: relative;
  padding-left: 1.9rem;
}

.fork-btn::before {
  content: "U";
  position: absolute;
  left: 0.65rem;
  top: 0.53rem;
  font-weight: 700;
  color: #2d7075;
}

.fork-btn.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f8b8d 0%, #186c96 100%);
}

.fork-btn.is-active::before {
  color: #fff;
}

.stats-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.68rem;
  background: #fbfdfe;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.28rem;
}

#fitCanvas {
  margin-top: 0.75rem;
  width: 100%;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fcfefe;
}

.table-wrap {
  margin-top: 0.7rem;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.45rem;
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  background: #f7fbfc;
  z-index: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.quality-excellent,
.quality-good {
  color: #247141;
  font-weight: 700;
}

.quality-fair {
  color: #8c6b15;
  font-weight: 700;
}

.quality-poor {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .apparatus,
  .data,
  .assessment {
    grid-column: span 1;
    grid-row: auto;
  }

  .btn-row {
    grid-template-columns: 1fr;
  }

  .fork-rack {
    grid-template-columns: 1fr;
  }

  #fitCanvas {
    height: 260px;
  }
}
