:root {
  --bg-top: #f4fbff;
  --bg-bottom: #fff8ef;
  --ink: #203044;
  --muted: #58708c;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(65, 97, 135, 0.14);
  --water: #4fa9ff;
  --water-deep: #2e74db;
  --salt: #ff8b4d;
  --salt-deep: #d45d1f;
  --accent: #ffd166;
  --shadow: 0 24px 60px rgba(36, 73, 122, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(79, 169, 255, 0.22), transparent 30%),
    radial-gradient(circle at bottom right, rgba(255, 209, 102, 0.28), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.hero,
.panel {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--water-deep);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 4vw, 3.7rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
}

.hero-text,
.section-heading p,
.concept-card p,
.result-card span,
.quiz-feedback,
.example-card p {
  color: var(--muted);
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-points span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(46, 116, 219, 0.12);
  font-weight: 700;
}

.hero-visual {
  display: grid;
  gap: 18px;
  align-content: center;
}

.formula-card,
.controls-card,
.visual-card,
.quiz-card,
.example-card,
.concept-card {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(87, 112, 140, 0.12);
}

.formula-card {
  padding: 24px;
}

.formula-label {
  margin-bottom: 8px;
  color: var(--salt-deep);
  font-weight: 800;
}

.formula-main {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  font-weight: 900;
}

.mini-beakers {
  display: flex;
  gap: 16px;
}

.mini-beaker {
  position: relative;
  width: 118px;
  height: 150px;
  overflow: hidden;
  border-radius: 10px 10px 18px 18px;
  clip-path: polygon(12% 4%, 88% 4%, 82% 96%, 18% 96%);
  border: 4px solid rgba(214, 233, 255, 0.9);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.2) 18%, rgba(255, 255, 255, 0.08) 82%, rgba(255, 255, 255, 0.48) 100%),
    linear-gradient(180deg, rgba(228, 241, 255, 0.8), rgba(255, 255, 255, 0.36));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    inset 12px 0 18px rgba(255, 255, 255, 0.3),
    inset -10px 0 18px rgba(86, 120, 168, 0.14),
    0 18px 24px rgba(48, 74, 110, 0.16);
  transform: perspective(420px) rotateX(16deg);
  transform-origin: center bottom;
}

.mini-beaker::before,
.mini-beaker::after,
.beaker::before,
.beaker::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.mini-beaker::before {
  inset: 0;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.7) 0 14%, transparent 18% 68%, rgba(255, 255, 255, 0.35) 78%, transparent 84%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 28%);
  z-index: 4;
}

.mini-beaker::after {
  left: 20px;
  right: 20px;
  top: 6px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(188, 214, 244, 0.85));
  box-shadow: 0 2px 4px rgba(59, 88, 126, 0.12);
  z-index: 5;
}

.mini-water,
.mini-salt,
.water-layer,
.salt-layer {
  position: absolute;
  left: 0;
  width: 100%;
}

.mini-water,
.water-layer {
  background:
    linear-gradient(180deg, rgba(184, 227, 255, 0.96) 0%, rgba(118, 187, 255, 0.96) 32%, rgba(79, 169, 255, 0.98) 100%);
  box-shadow:
    inset 0 6px 10px rgba(255, 255, 255, 0.24),
    inset 0 -12px 18px rgba(26, 88, 168, 0.18);
}

.mini-salt,
.salt-layer {
  bottom: 0;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 139, 77, 0.94),
      rgba(255, 139, 77, 0.94) 8px,
      rgba(255, 176, 135, 0.96) 8px,
      rgba(255, 176, 135, 0.96) 16px
    ),
    linear-gradient(180deg, rgba(255, 191, 155, 0.8), rgba(214, 103, 45, 0.96));
  box-shadow: inset 0 6px 10px rgba(255, 255, 255, 0.16);
}

.content {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}

.panel {
  padding: 28px;
}

.concept-grid,
.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.concept-card,
.example-card {
  padding: 20px;
}

.concept-water {
  background: linear-gradient(180deg, rgba(79, 169, 255, 0.13), rgba(255, 255, 255, 0.9));
}

.concept-salt {
  background: linear-gradient(180deg, rgba(255, 139, 77, 0.16), rgba(255, 255, 255, 0.92));
}

.concept-solution {
  background: linear-gradient(180deg, rgba(255, 209, 102, 0.16), rgba(255, 255, 255, 0.92));
}

.simulator-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.controls-card,
.visual-card,
.quiz-card {
  padding: 22px;
}

.controls-heading {
  margin-bottom: 18px;
}

.controls-heading h3 {
  margin-bottom: 0;
}

.controls-kicker {
  margin-bottom: 6px;
  color: var(--water-deep);
  font-weight: 800;
}

.range-group {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.range-group strong {
  font-size: 1.4rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--water-deep);
}

.preset-group p {
  margin-bottom: 10px;
  font-weight: 700;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, var(--water-deep), #5c8dff);
  box-shadow: 0 10px 20px rgba(46, 116, 219, 0.2);
}

button.secondary-button {
  background: rgba(87, 112, 140, 0.12);
  color: var(--ink);
  box-shadow: none;
}

.visual-card {
  display: grid;
  gap: 18px;
}

.live-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.live-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.95);
  border: 1px solid rgba(87, 112, 140, 0.12);
}

.live-card span {
  color: var(--muted);
}

.live-card strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.live-card-accent {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(255, 139, 77, 0.16));
}

.visual-grid {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.beaker-area {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px 12px;
  border-radius: 22px;
  background: rgba(247, 250, 255, 0.7);
  border: 1px solid rgba(87, 112, 140, 0.1);
  position: relative;
  overflow: visible;
}

.beaker-stage {
  position: relative;
  width: min(320px, 100%);
  padding-top: 14px;
  padding-bottom: 28px;
  perspective: 1000px;
}

.beaker-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 74%;
  height: 30px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(47, 71, 107, 0.24) 0%, rgba(47, 71, 107, 0.06) 58%, transparent 78%);
  filter: blur(6px);
  z-index: 0;
}

.beaker-top,
.beaker-base {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  pointer-events: none;
}

.beaker-top {
  top: 6px;
  width: 82%;
  height: 22px;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.98) 0 42%, rgba(211, 228, 246, 0.95) 54%, rgba(153, 184, 219, 0.72) 72%, transparent 74%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(184, 209, 237, 0.82));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    0 3px 8px rgba(62, 94, 134, 0.12);
  z-index: 5;
}

.beaker-base {
  bottom: 14px;
  width: 64%;
  height: 18px;
  background: linear-gradient(180deg, rgba(214, 228, 244, 0.82), rgba(174, 194, 219, 0.58));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 6px rgba(57, 83, 116, 0.12);
  z-index: 1;
}

.beaker {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border-radius: 16px 16px 28px 28px;
  clip-path: polygon(8% 7%, 92% 7%, 84% 96%, 16% 96%);
  border: 6px solid rgba(219, 236, 255, 0.94);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.32) 16%, rgba(255, 255, 255, 0.08) 78%, rgba(255, 255, 255, 0.54) 100%),
    linear-gradient(180deg, rgba(241, 247, 255, 0.92), rgba(255, 255, 255, 0.34));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.95),
    inset 18px 0 24px rgba(255, 255, 255, 0.28),
    inset -16px 0 26px rgba(69, 109, 164, 0.14),
    0 26px 36px rgba(46, 76, 119, 0.18);
  transform: rotateX(13deg);
  transform-origin: center bottom;
  z-index: 1;
}

.beaker::before {
  inset: 0;
  background:
    linear-gradient(102deg, rgba(255, 255, 255, 0.82) 0 10%, transparent 14% 62%, rgba(255, 255, 255, 0.44) 72%, transparent 82%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent 22%);
  z-index: 4;
}

.beaker::after {
  left: 14%;
  right: 14%;
  top: 16px;
  height: 180px;
  background:
    linear-gradient(90deg, transparent 0 9%, rgba(255, 255, 255, 0.42) 12% 16%, transparent 22% 68%, rgba(255, 255, 255, 0.24) 74% 78%, transparent 84%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 28%);
  z-index: 5;
}

.salt-layer {
  z-index: 2;
}

.water-layer {
  z-index: 1;
}

.water-layer::before,
.mini-water::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.08));
}

.water-layer::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: -8px;
  height: 18px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at center, rgba(236, 248, 255, 0.88) 0 36%, rgba(139, 205, 255, 0.8) 60%, rgba(81, 160, 236, 0.2) 82%, transparent 84%);
  box-shadow: 0 2px 4px rgba(35, 103, 176, 0.18);
}

.salt-layer::before,
.mini-salt::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: linear-gradient(180deg, rgba(255, 240, 230, 0.7), rgba(255, 240, 230, 0));
}

.surface-label {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 18px;
  font-weight: 700;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 999px;
}

.water-dot {
  background: var(--water);
}

.salt-dot {
  background: var(--salt);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.side-summary {
  display: grid;
  gap: 14px;
}

.result-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.95);
  border: 1px solid rgba(87, 112, 140, 0.12);
}

.result-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.compact-card strong {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.5;
}

.mix-bar {
  display: flex;
  overflow: hidden;
  min-height: 54px;
  margin-top: 12px;
  border-radius: 16px;
  background: rgba(222, 232, 245, 0.8);
}

.mix-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 10px 8px;
  color: white;
  font-weight: 800;
  transition: width 160ms ease;
}

.mix-segment span {
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.water-segment {
  background: linear-gradient(135deg, var(--water), var(--water-deep));
}

.salt-segment {
  background: linear-gradient(135deg, var(--salt), var(--salt-deep));
}

.mix-caption {
  margin: 12px 0 0;
  color: var(--muted);
}

.explanation-card {
  grid-column: 1 / -1;
}

.example-grid {
  margin-top: 18px;
}

.example-card h3 {
  margin-bottom: 10px;
}

.example-choices {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.choice-button {
  width: 100%;
  text-align: left;
}

.choice-button.secondary-button {
  border: 1px solid rgba(87, 112, 140, 0.14);
}

.choice-button.choice-correct {
  background: linear-gradient(135deg, #2fb36f, #49c887);
  color: white;
}

.choice-button.choice-wrong {
  background: linear-gradient(135deg, #e96b6b, #f09090);
  color: white;
}

.example-feedback,
.quiz-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  margin: 14px 0 0;
  font-weight: 800;
}

.example-feedback.is-correct,
.quiz-feedback.is-correct {
  color: #1a8f59;
}

.example-feedback.is-wrong,
.quiz-feedback.is-wrong {
  color: #c74b4b;
}

.quiz-card {
  max-width: 760px;
}

.quiz-question {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
}

.quiz-meta,
.quiz-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.quiz-hint {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 248, 233, 0.9);
  border: 1px solid rgba(255, 209, 102, 0.3);
}

.quiz-input-group {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.quiz-input-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.quiz-input-row input {
  width: min(100%, 420px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(87, 112, 140, 0.2);
  background: rgba(255, 255, 255, 0.9);
}

.quiz-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(247, 250, 255, 0.95);
  border: 1px solid rgba(87, 112, 140, 0.12);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.quiz-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 920px) {
  .hero,
  .simulator-layout,
  .visual-grid,
  .concept-grid,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .live-strip {
    grid-template-columns: 1fr;
  }

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

  .page-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 18px;
  }
}

@media (max-width: 560px) {
  .hero,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .beaker {
    height: 240px;
  }

  .quiz-actions,
  .preset-buttons {
    flex-direction: column;
  }

  .range-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .quiz-input-row input {
    width: 100%;
  }
}
