:root {
  --ink: #17343a;
  --muted: #5f7479;
  --page: #eaf4f5;
  --card: #ffffff;
  --border: #cfe0e3;

  --primary: #147f8c;
  --primary-dark: #0b626d;
  --primary-light: #e8f5f6;

  --secondary: #e4eff1;

  --good: #2f8f58;
  --warning: #d28d18;
  --danger: #c74747;

  --platform-header-height: 76px;

  --shadow:
    0 12px 30px rgba(26, 75, 83, 0.12);

  --small-shadow:
    0 6px 18px rgba(26, 75, 83, 0.08);
}

/* =====================================================
   GLOBAL RESET
===================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;

  font-family:
    Inter,
    Arial,
    Helvetica,
    sans-serif;

  background:
    radial-gradient(
      circle at top right,
      rgba(117, 203, 211, 0.2),
      transparent 28rem
    ),
    var(--page);

  color: var(--ink);
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(20, 127, 140, 0.34);
  outline-offset: 3px;
}

/* =====================================================
   VARIABLEVISTA PLATFORM HEADER
===================================================== */

.platform-header {
  min-height: var(--platform-header-height);

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 2rem;

  padding:
    0.9rem
    clamp(1rem, 4vw, 4rem);

  background: rgba(255, 255, 255, 0.96);

  border-bottom:
    1px solid var(--border);

  box-shadow:
    0 4px 18px rgba(17, 64, 72, 0.08);

  position: relative;
  z-index: 20;
}

.platform-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;

  min-width: max-content;

  color: var(--ink);
  text-decoration: none;
}

.platform-logo {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  flex: 0 0 auto;

  border-radius: 0.85rem;

  background:
    linear-gradient(
      145deg,
      var(--primary),
      var(--primary-dark)
    );

  color: white;

  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.05em;

  box-shadow:
    0 7px 16px rgba(11, 98, 109, 0.2);
}

.platform-brand-text {
  display: grid;
  gap: 0.12rem;
}

.platform-brand-text strong {
  font-size: 1.08rem;
  line-height: 1;
}

.platform-brand-text span {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.2;
}

.platform-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  flex-wrap: wrap;
  gap: 0.35rem;
}

.platform-navigation a {
  padding: 0.62rem 0.78rem;

  border-radius: 0.65rem;

  color: var(--muted);
  text-decoration: none;

  font-size: 0.88rem;
  font-weight: 750;

  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

.platform-navigation a:hover {
  color: var(--primary-dark);
  background: var(--primary-light);
}

.platform-navigation .model-library-link {
  margin-left: 0.35rem;

  padding-inline: 0.95rem;

  background: var(--primary);
  color: white;
}

.platform-navigation .model-library-link:hover {
  background: var(--primary-dark);
  color: white;

  transform: translateY(-1px);
}

/* =====================================================
   MODEL HEADER
===================================================== */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 2rem;

  padding:
    2rem
    clamp(1rem, 4vw, 4rem);

  color: white;

  background:
    linear-gradient(
      120deg,
      rgba(6, 71, 81, 0.97),
      rgba(22, 135, 149, 0.93)
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 255, 255, 0.18),
      transparent 20rem
    );
}

.model-introduction {
  max-width: 900px;
}

.site-header h1 {
  margin: 0.15rem 0 0.4rem;

  font-size:
    clamp(1.85rem, 4vw, 3.1rem);

  line-height: 1.08;
}

.subtitle {
  max-width: 830px;

  margin: 0;

  line-height: 1.55;

  color:
    rgba(255, 255, 255, 0.9);
}

.model-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;

  margin-top: 1rem;
}

.model-details span {
  padding: 0.38rem 0.7rem;

  border:
    1px solid rgba(255, 255, 255, 0.28);

  border-radius: 999px;

  background:
    rgba(255, 255, 255, 0.12);

  color: white;

  font-size: 0.75rem;
  font-weight: 750;

  backdrop-filter: blur(5px);
}

.eyebrow {
  margin: 0;

  color: var(--primary);

  font-size: 0.75rem;
  font-weight: 800;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-header .eyebrow {
  color: #b7eef2;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;

  flex: 0 0 auto;

  gap: 0.75rem;
}

/* =====================================================
   BUTTONS
===================================================== */

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;

  padding: 0.78rem 1rem;

  border-radius: 0.7rem;

  font-weight: 800;

  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    box-shadow 0.15s ease;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active {
  transform: translateY(0);
}

.primary-button {
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  box-shadow:
    0 6px 14px rgba(20, 127, 140, 0.2);
}

.secondary-button {
  background: var(--secondary);
  color: var(--ink);
}

.site-header .secondary-button {
  background:
    rgba(255, 255, 255, 0.16);

  color: white;

  border:
    1px solid rgba(255, 255, 255, 0.35);
}

.danger-button {
  background: #f7dcdc;
  color: #852e2e;
}

/* =====================================================
   MAIN PAGE LAYOUT
===================================================== */

.app-shell {
  width: min(1500px, 96%);

  margin:
    1.5rem
    auto
    3rem;
}

.dashboard-grid {
  display: grid;

  grid-template-columns:
    minmax(290px, 355px)
    minmax(0, 1fr);

  gap: 1.25rem;

  align-items: start;
}

.card {
  background: var(--card);

  border:
    1px solid var(--border);

  border-radius: 1.1rem;

  box-shadow: var(--shadow);
}

/* =====================================================
   CONTROL PANEL
===================================================== */

.control-panel {
  padding: 1.25rem;

  position: sticky;
  top: 1rem;
}

.panel-heading,
.tank-toolbar,
.meter-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 1rem;
}

.panel-heading h2,
.tank-toolbar h2,
.explanation-card h2 {
  margin: 0.2rem 0 0;
}

.control-group {
  margin-top: 1.4rem;
}

.control-row {
  display: flex;
  justify-content: space-between;

  gap: 1rem;

  font-weight: 750;
}

.control-row output {
  min-width: 5.2rem;

  padding: 0.28rem 0.5rem;

  border-radius: 0.45rem;

  background: #e8f5f6;
  color: var(--primary-dark);

  text-align: center;
}

input[type="range"] {
  width: 100%;

  margin:
    0.85rem
    0
    0.3rem;

  accent-color: var(--primary);
}

.range-labels {
  display: flex;
  justify-content: space-between;

  gap: 0.5rem;

  color: var(--muted);

  font-size: 0.7rem;
}

.simulation-controls {
  display: grid;
  gap: 0.8rem;

  margin-top: 1.6rem;
}

.speed-control {
  display: grid;
  gap: 0.35rem;

  font-weight: 700;
}

select {
  width: 100%;
  min-height: 44px;

  padding: 0.72rem;

  border:
    1px solid var(--border);

  border-radius: 0.65rem;

  background: white;
  color: var(--ink);
}

.model-note {
  margin-top: 1.2rem;

  padding: 0.95rem;

  border-left:
    4px solid var(--primary);

  border-radius: 0.5rem;

  background: #f0f8f9;

  line-height: 1.5;
  font-size: 0.88rem;
}

/* =====================================================
   MODEL STAGE
===================================================== */

.main-stage {
  min-width: 0;
}

.status-grid {
  display: grid;

  grid-template-columns:
    repeat(5, minmax(120px, 1fr));

  gap: 0.8rem;

  margin-bottom: 1rem;
}

.metric-card {
  padding: 1rem;

  border:
    1px solid var(--border);

  border-radius: 0.9rem;

  background: white;

  box-shadow: var(--small-shadow);
}

.metric-label,
.meter-label {
  display: block;

  margin-bottom: 0.28rem;

  color: var(--muted);

  font-size: 0.77rem;
  font-weight: 750;

  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-card strong {
  color: var(--primary-dark);

  font-size: 1.45rem;
}

/* =====================================================
   HATCHERY TANK
===================================================== */

.tank-card {
  overflow: hidden;
}

.tank-toolbar {
  padding: 1rem 1.2rem;

  border-bottom:
    1px solid var(--border);
}

.legend {
  display: flex;
  flex-wrap: wrap;

  gap: 0.8rem;

  color: var(--muted);

  font-size: 0.78rem;
}

.legend span {
  display: flex;
  align-items: center;

  gap: 0.35rem;
}

.legend-dot {
  width: 0.72rem;
  height: 0.72rem;

  display: inline-block;

  border-radius: 50%;
}

.legend-dot.healthy {
  background: var(--good);
}

.legend-dot.stressed {
  background: var(--warning);
}

.legend-dot.critical {
  background: var(--danger);
}

.tank-wrap {
  position: relative;

  min-height: 520px;

  background: #b9e8ed;
}

#tankCanvas {
  display: block;

  width: 100%;
  height: 520px;
}

.tank-overlay {
  position: absolute;
  top: 1rem;

  padding: 0.65rem 0.8rem;

  border-radius: 0.7rem;

  background:
    rgba(5, 54, 62, 0.75);

  color: white;

  backdrop-filter: blur(5px);

  pointer-events: none;
}

.tank-overlay span {
  display: block;

  font-size: 0.7rem;

  opacity: 0.8;
}

.tank-overlay strong {
  font-size: 0.88rem;
}

.top-left {
  left: 1rem;
}

.top-right {
  right: 1rem;

  text-align: right;
}

/* =====================================================
   SYSTEM METERS
===================================================== */

.meter-grid {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 0.9rem;

  margin-top: 1rem;
}

.meter-card {
  padding: 1rem;
}

.meter-heading strong {
  color: var(--primary-dark);

  font-size: 1.35rem;
}

.badge {
  padding: 0.32rem 0.55rem;

  border-radius: 999px;

  font-size: 0.72rem;
  font-weight: 800;
}

.badge.good {
  background: #def3e7;
  color: #21673d;
}

.badge.warning {
  background: #fff1cc;
  color: #7f5b0a;
}

.badge.danger {
  background: #f8dddd;
  color: #852d2d;
}

.meter-track {
  height: 0.7rem;

  margin: 0.8rem 0;

  overflow: hidden;

  border-radius: 999px;

  background: #e4edef;
}

.meter-fill {
  width: 0;
  height: 100%;

  border-radius: inherit;

  transition: width 0.35s ease;
}

.oxygen-fill {
  background:
    linear-gradient(
      90deg,
      #2f8fbd,
      #57c8df
    );
}

.waste-fill {
  background:
    linear-gradient(
      90deg,
      #c8a748,
      #89661b
    );
}

.stress-fill {
  background:
    linear-gradient(
      90deg,
      #d18a31,
      #cc4646
    );
}

.meter-card p {
  margin: 0;

  color: var(--muted);

  font-size: 0.82rem;
  line-height: 1.45;
}

/* =====================================================
   GRAPH AND EXPLANATION
===================================================== */

.lower-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 1.3fr)
    minmax(310px, 0.7fr);

  gap: 1.25rem;

  margin-top: 1.25rem;
}

.graph-card,
.explanation-card {
  padding: 1.2rem;
}

#graphCanvas {
  display: block;

  width: 100%;
  height: 390px;

  margin-top: 1rem;

  border:
    1px solid var(--border);

  border-radius: 0.8rem;

  background: white;
}

.system-explanation {
  margin-top: 1rem;

  padding: 1rem;

  border-radius: 0.75rem;

  background: #eef8f9;

  line-height: 1.55;
}

.flow-model {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;

  gap: 0.45rem;

  margin-top: 1rem;
}

.flow-node {
  flex: 1;

  min-width: 90px;

  padding: 0.68rem;

  border:
    1px solid var(--border);

  border-radius: 0.55rem;

  background: #f9fcfc;

  text-align: center;

  font-size: 0.78rem;
  font-weight: 750;
}

.warning-node {
  background: #fff6dd;

  border-color: #eed48a;
}

.danger-node {
  background: #fbe7e7;

  border-color: #edb2b2;
}

.flow-arrow {
  display: flex;
  align-items: center;

  color: var(--muted);

  font-weight: 900;
}

.daily-log {
  margin-top: 1.2rem;

  padding-top: 1rem;

  border-top:
    1px solid var(--border);
}

.daily-log h3 {
  margin-top: 0;
}

.daily-log ul {
  margin-bottom: 0;

  padding-left: 1.2rem;

  color: var(--muted);

  line-height: 1.5;
}

/* =====================================================
   MODEL LIMITATION
===================================================== */

.limitation-card {
  margin-top: 1.25rem;

  padding: 1rem 1.2rem;

  background: #fff8df;

  border-color: #ead48c;

  color: #665116;

  line-height: 1.55;
}

/* =====================================================
   VARIABLEVISTA PLATFORM FOOTER
===================================================== */

.platform-footer {
  margin-top: 3rem;

  padding:
    2.2rem
    clamp(1rem, 4vw, 4rem)
    1.25rem;

  background: #102f35;

  color:
    rgba(255, 255, 255, 0.82);
}

.footer-content {
  width: min(1400px, 100%);

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 2rem;

  margin: 0 auto;

  padding-bottom: 1.75rem;
}

.footer-brand {
  max-width: 340px;
}

.footer-brand > a {
  color: white;

  font-size: 1.2rem;
  font-weight: 900;

  text-decoration: none;
}

.footer-brand p {
  margin:
    0.45rem
    0
    0;

  color:
    rgba(255, 255, 255, 0.64);

  line-height: 1.5;
}

.footer-navigation {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;

  gap: 0.35rem;
}

.footer-navigation a {
  padding: 0.55rem 0.68rem;

  border-radius: 0.55rem;

  color:
    rgba(255, 255, 255, 0.76);

  text-decoration: none;

  font-size: 0.84rem;
  font-weight: 700;

  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.footer-navigation a:hover {
  background:
    rgba(255, 255, 255, 0.09);

  color: white;
}

.footer-bottom {
  width: min(1400px, 100%);

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 1rem;

  margin: 0 auto;

  padding-top: 1.1rem;

  border-top:
    1px solid rgba(255, 255, 255, 0.13);

  color:
    rgba(255, 255, 255, 0.5);

  font-size: 0.76rem;
}

/* =====================================================
   TABLET AND SMALL LAPTOP
===================================================== */

@media (max-width: 1120px) {
  .dashboard-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .status-grid {
    grid-template-columns:
      repeat(3, 1fr);
  }
}

/* =====================================================
   TABLET
===================================================== */

@media (max-width: 860px) {
  .platform-header {
    align-items: flex-start;
    flex-direction: column;

    gap: 0.85rem;
  }

  .platform-navigation {
    width: 100%;

    justify-content: flex-start;
  }

  .platform-navigation .model-library-link {
    margin-left: auto;
  }

  .footer-content {
    flex-direction: column;
  }

  .footer-navigation {
    justify-content: flex-start;
  }
}

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 760px) {
  .platform-header {
    padding:
      0.85rem
      1rem;
  }

  .platform-brand-text span {
    display: none;
  }

  .platform-navigation {
    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 0.4rem;
  }

  .platform-navigation a {
    text-align: center;
  }

  .platform-navigation .model-library-link {
    grid-column: 1 / -1;

    margin-left: 0;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

  .status-grid,
  .meter-grid {
    grid-template-columns:
      1fr 1fr;
  }

  .tank-wrap,
  #tankCanvas {
    min-height: 430px;
    height: 430px;
  }

  .legend {
    display: none;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 520px) {
  .site-header {
    padding:
      1.5rem
      1rem;
  }

  .site-header h1 {
    font-size: 2rem;
  }

  .model-details {
    gap: 0.4rem;
  }

  .model-details span {
    font-size: 0.68rem;
  }

  .app-shell {
    width: min(100% - 1rem, 1500px);

    margin-top: 0.75rem;
  }

  .status-grid,
  .meter-grid {
    grid-template-columns: 1fr;
  }

  .tank-toolbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .tank-overlay {
    top: 0.6rem;

    padding: 0.48rem 0.58rem;
  }

  .top-left {
    left: 0.6rem;
  }

  .top-right {
    right: 0.6rem;
  }

  .flow-model {
    display: grid;

    grid-template-columns: 1fr;
  }

  .flow-arrow {
    justify-content: center;

    transform: rotate(90deg);
  }

  .platform-footer {
    padding:
      1.75rem
      1rem
      1rem;
  }

  .footer-navigation {
    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    width: 100%;
  }
}

/* =====================================================
   REDUCED MOTION ACCESSIBILITY
===================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;

    transition-duration: 0.01ms !important;
  }
}