/* Henlabs V2 · Lab view: the experiments hub, the Burn or keep steps, the
   result card and the assumptions sheet. */

/* ------------------------------------------------------------------ Hub -- */

.lab-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin: 44px 0 26px;
}
.lab-hero .lede { margin-top: 14px; }
.lab-hero img { width: 190px; margin-bottom: -8px; }

/* The wallet the experiments run on, or the form to pick one. */
.lab-using {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 18px 10px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  font-size: var(--fs-ui);
  color: var(--muted);
}
.lab-using img,
.lab-using-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; object-fit: cover; }
.lab-using-icon { display: grid; place-items: center; background: var(--soft); color: var(--text); }
.lab-using p { flex: 1 1 260px; }
.lab-using strong { color: var(--text); }

.lab-wallet {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
}
.lab-wallet-copy .muted { margin-top: 4px; }
.lab-wallet-copy .lookup { margin-top: 18px; }
.lab-wallet-copy .meter { margin: 16px 0 0; }

.experiments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  list-style: none;
}
.experiment {
  position: relative;
  display: grid;
  /* The art sits beside the button, so the title and text keep the card's full width. */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'num num' 'title title' 'text text' 'go art';
  grid-template-rows: auto auto 1fr auto;
  align-items: end;
  column-gap: 20px;
  height: 100%;
  padding: 30px 30px 30px 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--warn-bg), var(--surface) 62%);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform .25s var(--ease), border-color .2s ease, box-shadow .25s ease;
}
.experiment:hover { transform: translateY(-3px); border-color: var(--text); box-shadow: var(--shadow); }
.experiment-num {
  grid-area: num;
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fuchsia-ink);
}
.experiment-title {
  grid-area: title;
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1.02;
  letter-spacing: -.035em;
}
.experiment-text { grid-area: text; align-self: start; max-width: 28em; margin-top: 10px; color: var(--muted); font-size: 16.5px; }
.experiment-go {
  grid-area: go;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  height: 46px;
  margin-top: 22px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 700;
}
.experiment-go .i { transition: transform .25s var(--ease); }
.experiment:hover .experiment-go .i { transform: translateX(3px); }
.experiment img {
  grid-area: art;
  align-self: end;
  width: auto;
  height: 132px;
  margin: -24px -8px -12px 0;
  transition: transform .35s var(--ease);
}
.experiment:hover img { transform: rotate(-3deg) scale(1.03); }

.explainer {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 16px;
  border-color: transparent;
  background: var(--info-bg);
}
.explainer img { width: 70px; flex: none; }
.explainer p { max-width: 62em; margin-top: 6px; color: var(--muted); }

/* The notebook: saved runs, each with its forecast, what really happened and a verdict. */
.notebook { margin-top: 56px; }
.notebook .section-head .muted { max-width: 46em; margin-top: 4px; }
.notebook-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; list-style: none; }
.run { display: flex; flex-direction: column; gap: 16px; padding: 22px 24px 20px; }
.run-head { display: flex; align-items: flex-start; gap: 10px; }
.run-name { flex: 1; min-width: 0; }
.run-title { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1.15; letter-spacing: -.025em; }
.run-meta { margin-top: 4px; color: var(--muted); font-size: var(--fs-small); }
.run-badge { margin-top: 2px; background: var(--soft); color: var(--muted); }
.run-badge.is-good { background: var(--good-bg); color: var(--good-text); }
.run-badge.is-warn { background: var(--warn-bg); color: var(--warn-text); }
.run-delete { flex: none; width: 34px; height: 34px; margin: -4px -8px 0 -2px; }
.run-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.run-figures dt { font-size: var(--fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.run-figures dd { margin-top: 4px; font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.run-figures small { font-family: var(--body); font-size: .62em; color: var(--muted); letter-spacing: 0; }
.run-figures .to { display: block; margin-top: 2px; font-size: .72em; color: var(--muted); }
/* The forecast range as a band on a bar from zero, with what really happened marked on it. */
.run-bar { position: relative; height: 14px; border-radius: 999px; background: var(--soft); }
.run-band { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--sky) 45%, transparent); }
.run-mark { position: absolute; top: -4px; width: 4px; height: 22px; margin-left: -2px; border-radius: 2px; background: var(--fuchsia); box-shadow: 0 0 0 2px var(--surface); }
.run-mark.is-good { background: var(--good-text); }
.run-foot { color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }
.run-retry { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.notebook-empty { display: flex; align-items: center; gap: 22px; padding: 24px 28px; }
.notebook-empty > div { flex: 1; }
.notebook-empty .muted { max-width: 40em; margin-top: 4px; }
.notebook-empty img { flex: none; width: 82px; }

/* Under a Burn or keep result: save the run to grade later, or share it as an image. */
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.result-actions > * { display: flex; flex: 1 1 200px; }
.result-actions .btn { flex: 1; }
.result-actions-note { margin-top: 10px; color: var(--muted); font-size: var(--fs-small); }
.run-saved .i { width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--lime); color: #0e0e12; stroke-width: 3; }

/* --------------------------------------------------------- Burn or keep -- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
  color: var(--muted);
  font-size: var(--fs-ui);
  font-weight: 700;
  text-decoration: none;
  transition: color .15s ease;
}
.back-link:hover { color: var(--text); }
.back-link .i { transition: transform .2s var(--ease); }
.back-link:hover .i { transform: translateX(-3px); }

.lab-head { margin-top: 14px; }
.lab-head .lede { max-width: 36em; margin-top: 10px; font-size: 17.5px; }

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  align-items: start;
  gap: 20px;
}
.lab-steps { padding: 32px; }

/* Step 1: Hens as picture cards when there are few enough to scan. */
.hen-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 8px;
}
.pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.pick:hover { border-color: var(--line-strong); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { border-color: var(--text); background: var(--soft); box-shadow: inset 0 0 0 1px var(--text); }
.pick:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.pick img { width: 40px; height: 40px; flex: none; border-radius: 10px; object-fit: cover; }
.pick > span { display: grid; min-width: 0; font-size: var(--fs-ui); font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.pick small { overflow: hidden; color: var(--muted); font-size: var(--fs-label); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.pick.is-full { opacity: .55; }

/* Step 2: one big number, a slider and quick amounts. */
.amount {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 20px;
  border: 2px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.amount:focus-within { border-color: var(--text); box-shadow: var(--ring); }
.amount input {
  width: 100%;
  min-width: 0;
  height: 66px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
/* An example, not a value: smaller and lighter than anything typed. */
.amount input::placeholder { color: var(--faint); font-family: var(--body); font-size: .5em; font-weight: 400; letter-spacing: 0; }
.amount-unit { font-weight: 700; color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Step 4: what the chosen scenario assumes, read like a receipt. */
.assume-card {
  margin-top: 14px;
  padding: 18px 20px 20px;
  border-radius: var(--r-lg);
  background: var(--soft);
}
.assume-card .label { margin-bottom: 12px; }
.assume-card .field-help { margin-top: 12px; }
.assume-card .btn { margin-top: 16px; }
.receipt-flag { color: var(--warn-text); }

/* Steps 4 and 5, and the sheet: labelled inputs side by side. */
.assume-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.assume-field { display: grid; align-content: start; gap: 6px; }
.assume-label { font-size: var(--fs-small); font-weight: 700; color: var(--muted); }
.assume-field .input { min-height: 50px; padding: 0 14px; }
.assume-field .input input { height: 46px; }
.assume-field .field-error { margin-top: 0; }
.field-error:empty { display: none; }

/* --------------------------------------------------------------- Result -- */

.lab-result { padding: 30px; scroll-margin-top: 84px; }
.lab-result .mega { margin-top: 10px; }
.mega-gld { font-size: clamp(42px, 5vw, 64px); }
/* A range reads as two lines: the low end large, "to" the high end beneath it. */
.mega .mega-to { display: block; margin-top: 6px; font-size: .46em; color: var(--muted); letter-spacing: -.02em; }
.mega-to .unit { color: var(--lime); }
.lab-result > .sub strong { color: var(--text); }

/* Figures as rows of one panel, label left and value right, so a range never splits mid-number. */
.result-stats { margin: 22px 0 14px; border-radius: 18px; background: var(--soft); }
.result-stats div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 14px 18px; }
.result-stats div + div { border-top: 1px solid var(--line); }
.result-stats dt { font-size: var(--fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.result-stats dd { margin-left: auto; font-family: var(--display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; text-align: right; font-variant-numeric: tabular-nums; }
.result-stats .to { display: block; margin-top: 2px; font-size: .78em; color: var(--muted); }
.result-stats small { font-family: var(--body); font-size: .68em; color: var(--muted); letter-spacing: 0; }

.value-check {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
  font-size: var(--fs-ui);
}
.value-check.is-good { border-color: var(--lime); }
.value-check .sub { margin-top: 4px; font-size: var(--fs-small); }

/* A short list of what a result leaves out of its headline. */
.differs {
  padding: 16px 18px 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.differs ul { margin: 10px 0 0; padding: 0; list-style: none; }
.differs li {
  position: relative;
  padding: 0 0 12px 18px;
  font-size: var(--fs-ui);
  line-height: 1.5;
  color: var(--muted);
}
.differs li::before {
  content: '';
  position: absolute;
  top: .62em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
}
.differs strong { color: var(--text); }
.differs li.is-warn { color: var(--text); }
.differs li.is-warn::before { background: var(--warn-text); }

/* Dated events on a lab chart, such as halvings. */
.chart .mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 5; opacity: .7; }
.chart .mark-label { fill: var(--muted); font-family: var(--body); font-size: 11px; font-weight: 700; }

/* Hen lookup: a number box and its button on one line. */
.hen-find { display: flex; flex-wrap: wrap; gap: 10px; }
.hen-find .input { flex: 1 1 140px; min-height: 52px; padding: 0 14px; }
.hen-find .input input { height: 48px; font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.hen-find .btn { min-height: 52px; }

.result-errors { display: grid; justify-items: center; padding: 18px 4px; text-align: center; }
.result-errors img { width: 84px; margin-bottom: 10px; }
.result-errors ul { margin-top: 10px; padding: 0; list-style: none; color: var(--warn-text); }
.result-errors li + li { margin-top: 6px; }

.lab-chart { margin-top: 20px; }
.professor {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--soft);
  color: var(--muted);
  font-size: var(--fs-ui);
}
.professor img { width: 48px; flex: none; }

/* Growth planner: the day-by-day schedule under its chart. */
.plan-schedule { margin-top: 22px; }
.plan-days { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); font-variant-numeric: tabular-nums; }
.plan-days th, .plan-days td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.plan-days thead th { padding-top: 0; font-size: var(--fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.plan-days tbody th { font-weight: 700; white-space: nowrap; }
.plan-days td:last-child, .plan-days th:last-child { padding-right: 0; text-align: right; white-space: nowrap; }
.plan-days .burn { display: inline-block; margin: 0 12px 2px 0; color: var(--muted); }
.plan-days .burn strong { color: var(--text); }
.plan-more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.plan-more summary::-webkit-details-marker { display: none; }
.plan-more summary .i { width: 18px; height: 18px; transition: transform .2s var(--ease); }
.plan-more[open] summary .i { transform: rotate(180deg); }
.plan-more .plan-days { margin-top: 8px; }
.plan-more .plan-days thead { display: none; }
.plan-schedule > .fineprint { margin-top: 14px; }

/* ---------------------------------------------------- Assumptions sheet -- */

.assume-groups { display: grid; gap: 22px; margin-top: 22px; }
.assume-group { min-width: 0; margin: 0; padding: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); }
.assume-group:last-child { padding-bottom: 0; border-bottom: 0; }
.assume-group legend { padding: 0; font-size: 16.5px; font-weight: 700; }
.assume-group > .field-help { margin: 2px 0 12px; }
/* The live estimate and the way out stay pinned to the bottom of the sheet while it scrolls. */
.assume-dock {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin: 24px -28px -28px;
  padding: 16px 28px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.assume-live { color: var(--muted); font-size: var(--fs-ui); }
.assume-live strong { color: var(--text); white-space: nowrap; }
.assume-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 16px; margin-top: 14px; }
.assume-actions .text-button { margin-right: auto; }
.assume-actions .btn { min-width: 120px; }

/* ------------------------------------------------------------- Peek bar -- */

/* The result's headline for one-column layouts; lab.js shows it while the result is below. */
.lab-peek { display: none; }

@media (min-width: 761px) {
  #lab-dialog { max-width: min(580px, calc(100vw - 32px)); }
}

/* The result stays in view beside the steps when the screen is tall enough to hold it. */
@media (min-width: 1081px) and (min-height: 760px) {
  .lab-result { position: sticky; top: 92px; }
}

@media (max-width: 1080px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); }

  .lab-peek {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 35;
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(460px, calc(100% - 24px));
    padding: 10px 10px 10px 18px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 20px;
    background: #0e0e12;
    color: #fff;
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55);
    text-align: left;
    transform: translate(-50%, calc(100% + 120px));
    visibility: hidden;
    transition: transform .28s var(--ease), visibility 0s linear .28s;
  }
  .lab-peek.is-on { transform: translate(-50%, 0); visibility: visible; transition: transform .28s var(--ease); }
  .lab-peek-text { display: grid; flex: 1; min-width: 0; }
  .lab-peek-text small { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .64); }
  .lab-peek-text strong { overflow: hidden; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; text-overflow: ellipsis; }
  .lab-peek-text strong span { font-size: .72em; color: var(--lime); }
  .lab-peek .i { flex: none; width: 36px; height: 36px; padding: 9px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
  body:has(.lab-peek.is-on) .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
  .experiments, .notebook-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .lab-hero { margin: 28px 0 20px; }
  .lab-hero img { width: 112px; }
  .lab-wallet { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .lab-wallet > img { width: 92px; }
  /* The art moves beside the button, so the title keeps the card's full width. */
  .experiment { padding: 24px 22px 22px; }
  .experiment img { height: 92px; margin: -12px -10px -8px 0; }
  .explainer { align-items: flex-start; }
  .explainer img { width: 52px; }
  .notebook { margin-top: 44px; }
  .run { padding: 18px 18px 16px; }
  .run-head { flex-wrap: wrap; }
  .run-name { flex-basis: calc(100% - 40px); }
  .run-badge { order: 3; }
  .notebook-empty { flex-wrap: wrap; padding: 20px; }
  .notebook-empty img { width: 64px; }
  .notebook-empty > div { flex-basis: calc(100% - 86px); }

  .back-link { margin-top: 22px; }
  .lab-head .lede { font-size: 16.5px; }
  .lab-steps { padding: 22px 20px; }
  .lab-result { padding: 22px 20px; border-radius: 24px; }
  .lab-peek { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body:has(.lab-peek.is-on) .toast { bottom: calc(160px + env(safe-area-inset-bottom)); }
  .assume-dock {
    margin: 22px -20px calc(-24px - env(safe-area-inset-bottom));
    padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 560px) {
  .lab-hero { grid-template-columns: minmax(0, 1fr) 88px; }
  .lab-hero img { width: 88px; }
  .amount input { font-size: 32px; height: 60px; }
  .result-stats div { padding: 12px 16px; }
  .result-stats dd { font-size: 17px; }
}

@media (max-width: 420px) {
  .pick { gap: 8px; padding: 6px; }
  .pick img { width: 34px; height: 34px; border-radius: 8px; }
  .pick-unit { display: none; }
}

@media (max-width: 380px) {
  .assume-pair { grid-template-columns: minmax(0, 1fr); }
  .assume-card { padding: 16px 14px; }
  .assume-card .btn { width: 100%; padding: 0 10px; }
  .assume-card .btn .i { display: none; }
}
