/* Відра без поділок: та сама нічна панель, що й у терезів, тільки замість чаш — відра.
   Панель .sim і питання .ask беруться з scales.css, тут лише те, що належить відрам. */

.block.jugs-block {
  background: linear-gradient(150deg, #241d3d, #12102a);
  border: 1px solid var(--gold-dim);
  color: var(--cream);
}

.block.jugs-block .block-head { border-bottom-color: rgba(217,164,65,.28); }
.block.jugs-block .tag { background: rgba(217,164,65,.2); color: var(--gold-hi); }

/* ---------- відра ---------- */

.jugs-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  margin: 12px 0 8px;
}

.jug-col {
  flex: 0 1 118px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Цифри без засічок: у Georgia нуль старовинний і читається як «о». */
.jug-amt {
  font: 600 20px/1.2 var(--sans);
  color: var(--cream);
  min-height: 24px;
}

.jug-amt.unknown { color: var(--gold-hi); }

/* Відро відкрите згори й без жодної риски: рівень видно, а скільки літрів — ні. */
.jug {
  position: relative;
  width: 66px;
  height: var(--h, 100px);
  border: 3px solid #aeb8c4;
  border-top: 0;
  border-radius: 3px 3px 16px 16px;
  background: rgba(255,255,255,.04);
  overflow: hidden;
  box-shadow: inset 0 0 14px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.45);
}

.jug-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(180deg, #8fd0f5, #2f76b3);
  transition: height .55s ease, opacity .3s ease;
}

.jug-liquid::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: rgba(255,255,255,.55);
}

.liquid-petrol .jug-liquid { background: linear-gradient(180deg, #f7dc8a, #c8951f); }
.liquid-milk .jug-liquid { background: linear-gradient(180deg, #ffffff, #ddd3c0); }
.liquid-butterbeer .jug-liquid { background: linear-gradient(180deg, #fff1c9 0 6px, #e0a24a 6px, #9b5d1c); }
.liquid-pumpkin .jug-liquid { background: linear-gradient(180deg, #ffc27a, #d9731f); }

/* Кришка: поки дитина не порахувала, рівень сховано — на око тут не міряють. */
.jug.lidded .jug-liquid { opacity: 0; }

.jug.lidded::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 30px var(--serif);
  color: var(--gold-hi);
  background: repeating-linear-gradient(135deg, rgba(217,164,65,.12) 0 8px, rgba(0,0,0,0) 8px 16px);
}

.jug.goal {
  border-color: #7fe39a;
  box-shadow: inset 0 0 14px rgba(0,0,0,.55), 0 0 18px rgba(127,227,154,.65);
}

.jug-cap { font: 600 14px var(--sans); color: var(--gold); }

.jug-btns { display: flex; flex-direction: column; gap: 5px; width: 100%; }

.jug-btn {
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  padding: 7px 6px;
  border-radius: 9px;
  border: 1px solid var(--gold-dim);
  background: rgba(217,164,65,.1);
  color: var(--gold-hi);
  white-space: nowrap;
}

.jug-btn:hover:not(:disabled) { background: rgba(217,164,65,.24); border-color: var(--gold-hi); }
.jug-btn:disabled { opacity: .32; cursor: default; }

/* Відповідь після переливання — числа, як на клавіатурі телефона: тиснеш, а не друкуєш. */
.ask-opt.num { min-width: 42px; padding: 8px 10px; text-align: center; }

/* ---------- пісочниця: які числа вже бачила ---------- */

.jug-collect {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  font-size: 14px;
  color: var(--gold);
}

.collect-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px dashed var(--gold-dim);
  color: rgba(239,228,207,.45);
  font: 600 14px var(--sans);
}

.collect-chip.on {
  background: var(--gold);
  border-style: solid;
  color: #2b2118;
  box-shadow: 0 0 10px rgba(244,207,128,.6);
}

/* ---------- таблиця кроків: у симуляторі й у розвʼязаннях ---------- */

.pour-wrap { overflow-x: auto; margin: 8px 0; }

.pour-table { font-size: 14px; }
.pour-table th, .pour-table td { padding: 5px 7px; text-align: center; white-space: nowrap; }
.pour-table th { font-family: var(--sans); font-weight: 600; font-size: 13px; }
.pour-table th:last-child, .pour-table td:last-child { text-align: left; white-space: normal; }
.pour-table td:first-child { color: var(--ink-soft); }
.pour-table td.hit { background: rgba(217,164,65,.38); font-weight: 700; }

.sim .pour-table th { color: var(--gold); }
.sim .pour-table th, .sim .pour-table td { border-bottom-color: rgba(217,164,65,.18); }
.sim .pour-table td:first-child { color: var(--gold); }
.sim .pour-table td.hit { color: var(--gold-hi); }

/* Стан, який уже був: рядок червоніє — ці кроки нічого не дали. */
.sim .pour-table tr.repeat td { color: #f3a39a; }

.trainer-row { margin: 8px 0 0; }
.jug-random-trainer .trainer-controls { align-items: flex-end; }
.trainer-choice { display: grid; gap: 7px; }
.trainer-choice > span { font-size: 13px; color: var(--gold); }
.trainer-new { margin-left: auto; }

@media (max-width: 600px) {
  .trainer-choice, .trainer-new { width: 100%; }
  .trainer-new { margin-left: 0; }
}

/* ---------- більярд ---------- */

/* На телефоні більярд іде під питанням, щоб питання було поруч із відрами.
   На широкому екрані — праворуч від відер. */
.jugs-main { display: grid; grid-template-columns: minmax(0, 1fr); }
.jugs-main > * { grid-column: 1; }

@media (min-width: 700px) {
  .jugs-main { grid-template-columns: minmax(0, 1fr) auto; column-gap: 18px; }
  .jugs-main > .bil-box { grid-column: 2; grid-row: 1 / span 5; align-self: start; }
}

.bil-box { margin: 8px auto 4px; text-align: center; max-width: 100%; }
.bil-caption { font-size: 12.5px; color: rgba(239,228,207,.6); max-width: 290px; margin: 2px auto 0; }

.billiard, .state-map { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* Сукно зелене, бортики золоті — на темній панелі й на пергаменті однаково. */
.bil-cloth { fill: #1f5132; }
.bil-grid { stroke: rgba(255,255,255,.1); stroke-width: 1; fill: none; }
.bil-rail { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linejoin: round; }
.bil-hole { fill: rgba(255,255,255,.45); }
.bil-goal { stroke: #f4cf80; stroke-width: 2.5; stroke-dasharray: 5 4; fill: none; }
.bil-goal-label { fill: #f4cf80; font: 700 12px var(--sans); }
.bil-star { fill: #f4cf80; font: 700 18px var(--sans); }
.bil-forbidden { stroke: #f3a39a; stroke-width: 2.5; }
.bil-path { fill: none; stroke: #8fd0f5; stroke-width: 2.5; stroke-linejoin: round; }
.bil-step { fill: #8fd0f5; }
.bil-num { fill: #eaf6ff; font: 600 9.5px var(--sans); paint-order: stroke; stroke: #1f5132; stroke-width: 3px; }
.bil-ghost { stroke: #8fd0f5; stroke-width: 2.5; stroke-dasharray: 3 3; }
.bil-ghost-label { fill: #f4cf80; font: 700 13px var(--sans); }
.bil-ball { fill: #fff; stroke: #2b2118; stroke-width: 1.5; filter: drop-shadow(0 0 4px rgba(255,255,255,.8)); }
.bil-axis { fill: var(--ink-soft); font: 11px var(--sans); }
.bil-name { fill: var(--ink-soft); font: 600 12px var(--sans); }
.sim .bil-axis, .sim .bil-name { fill: var(--gold); }

.bil-figure { margin: 12px 0; text-align: center; }
.bil-figure figcaption { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-top: 4px; }

/* ---------- карта ходів ---------- */

.map-edge { stroke: rgba(43,33,24,.3); stroke-width: 1.2; }
.map-edge.on { stroke: var(--gold-dim); stroke-width: 3; }
.map-node rect { fill: rgba(255,255,255,.7); stroke: var(--ink-soft); stroke-width: 1; }
.map-node text { fill: var(--ink); font: 600 12px var(--sans); }
.map-node.on rect { fill: #f6e3b4; stroke: var(--gold-dim); stroke-width: 2; }
.map-node.goal rect { fill: var(--gold); stroke: var(--red); stroke-width: 2; }
.map-row { fill: var(--ink-soft); font: italic 12px var(--serif); }

@media (max-width: 520px) {
  .jugs-row { gap: 8px; }
  .jug { width: 54px; }
  .jug-btn { font-size: 12.5px; padding: 6px 4px; }
  .pour-table th, .pour-table td { padding: 5px 4px; }
}

/* ---------- граф станів ---------- */

/* Ліва доріжка — вода, права — бурштин: дві доріжки одразу видно як два різні кола. */
.walk { --lane0: #8fd0f5; --lane1: #f0b35a; }

.walk-roads { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.walk-road.lane0 { border-color: var(--lane0); color: var(--lane0); }
.walk-road.lane1 { border-color: var(--lane1); color: var(--lane1); }
.walk-road.lane0.on { background: var(--lane0); color: #0c2233; }
.walk-road.lane1.on { background: var(--lane1); color: #2b1a05; }

.walk-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.walk-top .jugs-row { flex: 0 0 auto; margin: 0; }
.walk-side { flex: 1 1 220px; min-width: 0; }
.walk-story { min-height: 4.8em; font-size: 15px; line-height: 1.5; color: var(--cream); margin-top: 4px; }
.walk-story b { color: var(--gold-hi); }

.walk-board { margin-top: 6px; }
.walk-graph { display: block; width: 100%; max-width: 580px; height: auto; margin: 0 auto; }

.walk-row { fill: rgba(239,228,207,.45); font: italic 12px var(--serif); }

.walk-edge { fill: none; stroke-width: 2; opacity: .45; }
.walk-edge.lane0 { stroke: var(--lane0); }
.walk-edge.lane1 { stroke: var(--lane1); }
.walk-edge.shared { stroke: rgba(239,228,207,.35); stroke-dasharray: 4 4; }
.walk-edge.on { opacity: 1; stroke-width: 4; filter: drop-shadow(0 0 4px currentColor); }
.walk-edge.lane0.on { color: var(--lane0); }
.walk-edge.lane1.on { color: var(--lane1); }

.walk-move { font: 600 10.5px var(--sans); opacity: .6; paint-order: stroke; stroke: #15122a; stroke-width: 3px; }
.walk-move.lane0 { fill: var(--lane0); }
.walk-move.lane1 { fill: var(--lane1); }
.walk-move.on { opacity: 1; }

.walk-box { fill: #1a1633; stroke: rgba(239,228,207,.3); stroke-width: 1.5; }
.walk-node.lane0 .walk-box { stroke: var(--lane0); }
.walk-node.lane1 .walk-box { stroke: var(--lane1); }
.walk-node.shared .walk-box { stroke-dasharray: 4 3; }
.walk-node.walked .walk-box { fill: #2a2450; }
.walk-node.goal .walk-box { stroke: #f4cf80; stroke-width: 2.5; }
.walk-node.here .walk-box { stroke: #fff; stroke-width: 3; filter: drop-shadow(0 0 8px rgba(255,255,255,.75)); }

.walk-jug { fill: none; stroke: #aeb8c4; stroke-width: 1.6; }
.walk-water { fill: #4a9ad6; }
.walk-label { fill: var(--cream); font: 600 11.5px var(--sans); }
.walk-star { fill: #f4cf80; font: 700 14px var(--sans); }

/* ---------- навчаємо обирати хід, потім прибираємо допомогу ---------- */
.jug-coach { border: 1px solid var(--gold-dim); border-radius: 12px; padding: 12px 16px; margin: 12px 0; background: rgba(217,164,65,.06); }
.jug-coach > b { display: block; color: var(--gold-hi); margin-bottom: 6px; }
.jug-coach ol { margin: 10px 0; padding-left: 24px; }
.jug-coach li { padding: 5px 6px; border-radius: 6px; }
.jug-coach li.active { background: rgba(143,208,245,.18); color: #c1e7ff; font-weight: 700; }
.coach-note { font-size: 14px; color: var(--gold-hi); }
.coach-count { font: 600 13px var(--sans); color: var(--gold); margin-bottom: 6px; }
.jug-btn.coach-next { border-color: #8fd0f5; box-shadow: 0 0 0 2px rgba(143,208,245,.3); background: rgba(143,208,245,.18); }
.jug-map-help { margin-top: 16px; border-top: 1px solid var(--gold-dim); padding-top: 12px; }
.jug-map-help > summary { color: var(--gold-hi); cursor: pointer; }
.map-lab { margin-top: 12px; }
.map-workbench { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.map-workbench > * { min-width: 0; }
.map-current { font: 600 16px/1.5 var(--sans); color: var(--gold-hi); margin: 8px 0; }
.map-preview { margin: 12px 0; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.map-actions .jug-btn { min-height: 40px; white-space: normal; }
.map-question .kind-btn, .map-conclusion .kind-btn { margin: 4px 6px 4px 0; white-space: normal; }
.map-next { margin: 12px 0; white-space: normal; max-width: 100%; }
.map-route { font: 600 14px/1.8 var(--sans); overflow-wrap: anywhere; margin: 12px 0; }
.map-reset { margin-top: 12px; }
.block.problem .map-reset { color: var(--gold-hi); border-color: var(--gold-dim); }
.map-lab-board { background: #eee0bf; border-radius: 12px; padding: 12px 6px; align-self: start; }
.map-lab-board .state-map { width: 100%; max-width: 440px; }
.map-node.here rect { stroke: #1e608e; stroke-width: 3; }
@media (min-width: 800px) {
  .map-workbench { grid-template-columns: minmax(0, 1fr) minmax(250px, .9fr); }
}
