/**
 * HECSI
 * BranchOut / Aris Kuckovic
 */

:root {
  --blue: #005f8f;
  --blue-bright: #007dbb;
  --navy: #27455c;
  --tint: #e5f5fc;

  --ink: #333;
  --muted: #636c6f;
  --line: #ddd;
  --bg: #f2f1f1;
  --surface: #fff;

  --r-fingertips: #f2d15f;
  --r-fingers: #c3b8ec;
  --r-palm_of_hand: #a9dca6;
  --r-back_of_hand: #b4b4b4;
  --r-wrist: #f2bcc5;

  --band-clear: #2b8c5e;
  --band-mild: #6d9b33;
  --band-moderate: #c98c00;
  --band-severe: #d4561f;
  --band-very-severe: #b3202f;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--blue);

  --radius: 8px;
  --radius-sm: 4px;
}


/* Base */

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

html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--blue); }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 700; color: var(--blue); }
h1 { font-weight: 300; color: var(--ink); letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; border-radius: 0; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--surface); border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
.nowrap { white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 2px solid var(--blue-bright); border-radius: var(--radius-sm); background: var(--blue-bright); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--blue); border-color: var(--blue); }
.btn--ghost { background: transparent; border-color: var(--blue); color: var(--blue); }
.btn--ghost:hover { background: var(--blue); border-color: var(--blue); color: #fff; }

.chip {
  display: inline-block; padding: 3px 10px;
  border-left: 4px solid var(--band); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--band) 14%, #fff);
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.chip--small { padding: 1px 6px; font-size: 11px; border-left-width: 3px; }

[data-band="clear"]        { --band: var(--band-clear); }
[data-band="mild"]         { --band: var(--band-mild); }
[data-band="moderate"]     { --band: var(--band-moderate); }
[data-band="severe"]       { --band: var(--band-severe); }
[data-band="very-severe"]  { --band: var(--band-very-severe); }


/* Header / footer */

.site-header { position: relative; background: var(--surface); border-bottom: 1px solid var(--line); }

.site-header__inner {
  display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
  max-width: 1200px; min-height: 60px; margin: 0 auto; padding: 0 16px;
}

.site-header__brand {
  display: flex; align-items: center;
  color: var(--blue); text-decoration: none;
  font-size: 22px; font-weight: 700; letter-spacing: .12em;
}

.site-header__toggle {
  display: none; align-self: center;
  width: 48px; height: 48px; padding: 12px;
  border: 0; border-radius: var(--radius-sm); background: var(--blue-bright); cursor: pointer;
}
.site-header__toggle svg { width: 24px; height: 24px; stroke: #fff; stroke-width: 2; fill: none; }

.site-nav { display: flex; }
.site-nav__list { display: flex; margin: 0; padding: 0; list-style: none; }
.site-nav__list li { display: flex; }
.site-nav__list a {
  display: flex; align-items: center; padding: 0 16px;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.site-nav__list a:hover { color: var(--blue); background: var(--tint); }
.site-nav__list .current-menu-item > a { color: var(--blue); border-bottom-color: var(--blue-bright); }

@media (max-width: 719px) {
  .site-header__toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    background: var(--navy);
  }
  .site-nav.is-open { display: block; }
  .site-nav__list { flex-direction: column; }
  .site-nav__list a { width: 100%; padding: 14px 16px; border: 0; border-left: 4px solid transparent; border-top: 1px solid rgb(255 255 255 / .12); color: #fff; }
  .site-nav__list a:hover { color: #fff; background: var(--blue); }
  .site-nav__list .current-menu-item > a { color: #fff; border-left-color: var(--blue-bright); }
}

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer__inner { max-width: 1200px; margin: 0 auto; padding: 20px 16px 32px; }
.site-footer p { margin: 0 0 4px; }


/* Calculator layout */

.calc { max-width: 1200px; margin: 0 auto; padding: 24px 16px 32px; }

.calc__layout { display: grid; gap: 16px; }
.calc__aside { display: grid; gap: 16px; align-content: start; }
.calc__main { min-width: 0; }

@media (min-width: 960px) {
  .calc { padding-top: 24px; }
  .calc__layout { grid-template-columns: 330px minmax(0, 1fr); gap: 24px; align-items: start; }
  .calc__aside { position: sticky; top: 16px; }
}

.notice { padding: 12px 16px; background: #fff4e0; border-left: 4px solid var(--band-moderate); border-radius: var(--radius-sm); }


/* Hand */

.hand-card { padding: 16px; }

.hand-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hand-card__title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.segmented { display: inline-flex; overflow: hidden; border: 2px solid var(--blue); border-radius: var(--radius-sm); }
.segmented__btn {
  min-height: 32px; padding: 0 14px;
  border: 0; background: var(--surface);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
}
.segmented__btn + .segmented__btn { border-left: 2px solid var(--blue); }
.segmented__btn[aria-pressed="true"] { background: var(--blue); color: #fff; }

.hand-card__figure { display: flex; justify-content: center; padding: 12px 0 4px; }

.hand { width: 100%; max-width: 270px; height: auto; overflow: visible; }

/* Desktop: shrink the hand on short screens so the sticky column (hand + score) fits */
@media (min-width: 960px) {
  .calc .hand { max-width: clamp(100px, calc((100vh - 540px) * .74), 210px); }
  .calc .hand-card__figure { padding-top: 8px; }
  .calc .score-card__value { font-size: 44px; }
  .calc .bands { margin-top: 12px; }
  .calc .bands__item { padding: 4px 8px; }
}
.hand.is-flipping { animation: hand-flip .3s steps(6); transform-origin: center; }

@keyframes hand-flip {
  0% { transform: scaleX(1); }
  50% { transform: scaleX(0.05); }
  100% { transform: scaleX(1); }
}

.hand-card__figure[data-view="palm"] .hand__view[data-view="back"],
.hand-card__figure[data-view="back"] .hand__view[data-view="palm"] { display: none; }

/* Masked to the region's own pixels: deepens its colour, ink stays on top */
.hand__region { fill: var(--c); fill-opacity: 0; mix-blend-mode: multiply; cursor: pointer; }
.hand__region:hover { fill-opacity: .5; }

[data-region="fingertips"]   { --c: var(--r-fingertips); }
[data-region="fingers"]      { --c: var(--r-fingers); }
[data-region="palm_of_hand"] { --c: var(--r-palm_of_hand); }
[data-region="back_of_hand"] { --c: var(--r-back_of_hand); }
[data-region="wrist"]        { --c: var(--r-wrist); }

.hand[data-active="fingertips"]   .hand__region[data-region="fingertips"],
.hand[data-active="fingers"]      .hand__region[data-region="fingers"],
.hand[data-active="palm_of_hand"] .hand__region[data-region="palm_of_hand"],
.hand[data-active="back_of_hand"] .hand__region[data-region="back_of_hand"],
.hand[data-active="wrist"]        .hand__region[data-region="wrist"] {
  fill-opacity: 1;
}

.hand__badges { pointer-events: none; }
.hand__badge rect { fill: var(--blue); }
.hand__badge text { fill: #fff; font: 800 15px var(--font); text-anchor: middle; }
.hand__badge[data-empty] { display: none; }

.legend {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px;
  margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line);
  list-style: none; font-size: 13px;
}
.legend__item { display: flex; align-items: center; gap: 8px; }
.legend__swatch, .tabs__swatch { flex: none; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }


/* Total */

.score-card { padding: 16px 18px; border-top: 6px solid var(--band); }
.score-card__label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.score-card__value { margin: 4px 0 10px; font-size: 56px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-card__max { font-size: 18px; font-weight: 700; letter-spacing: 0; color: var(--muted); }
.score-card__band { margin: 0; }
.score-card__link { display: none; }

.bands { margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); list-style: none; font-size: 14px; }
.bands__item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--muted); }
.bands__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--band); }
.bands__label { flex: 1; }
.bands__range { font-variant-numeric: tabular-nums; }
.bands__item.is-current { border-radius: var(--radius-sm); background: color-mix(in srgb, var(--band) 14%, #fff); color: var(--ink); font-weight: 800; box-shadow: inset 4px 0 0 var(--band); }

.bands__item[data-band-item="clear"]        { --band: var(--band-clear); }
.bands__item[data-band-item="mild"]         { --band: var(--band-mild); }
.bands__item[data-band-item="moderate"]     { --band: var(--band-moderate); }
.bands__item[data-band-item="severe"]       { --band: var(--band-severe); }
.bands__item[data-band-item="very-severe"]  { --band: var(--band-very-severe); }

/* Mobile */
@media (max-width: 959px) {
  body.home { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  .calc .hand-card {
    display: grid; align-items: center; gap: 8px 16px;
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas: "figure head" "figure legend";
    padding: 10px 16px;
  }
  .calc .hand-card__head { grid-area: head; flex-wrap: wrap; align-self: end; min-width: 0; }
  .calc .segmented__btn { padding: 0 10px; }
  .calc .hand-card__figure { grid-area: figure; padding: 0; }
  .calc .hand { max-width: 96px; }
  .calc .legend { grid-area: legend; align-self: start; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin: 0; padding: 0; border: 0; font-size: 12px; }

  @media (min-width: 600px) {
    .calc .hand-card { grid-template-columns: 130px minmax(0, 1fr); }
    .calc .hand { max-width: 130px; }
  }

  .score-card {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) 16px;
    border: 0; border-top: 4px solid var(--band); border-radius: 0;
    box-shadow: 0 -1px 0 var(--line);
  }
  .score-card__main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .score-card__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .score-card__value { margin: 0; font-size: 28px; }
  .score-card__max { font-size: 13px; }
  .bands { display: none; }
  .score-card__link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px;
    border-radius: var(--radius-sm); background: var(--blue-bright); color: #fff; text-decoration: none;
    font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  }
  .score-card__link::after { content: "↓"; font-size: 14px; }
}


/* Tabs */

.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 16px; }

@media (max-width: 959px) {
  .tabs { position: sticky; top: 0; z-index: 10; margin: 0 -16px 16px; padding: 8px 16px; background: var(--bg); }
}

.tabs__tab {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; min-height: 60px; padding: 8px 8px 8px 12px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 700; line-height: 1.2; text-align: left; cursor: pointer;
}
.tabs__tab + .tabs__tab { margin-left: -1px; }
.tabs__tab:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.tabs__tab:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.tabs__label { flex: 1; min-width: 0; }
.tabs__short { display: none; }

@media (max-width: 599px) {
  .tabs__tab { flex-direction: column; justify-content: center; gap: 4px; min-height: 64px; padding: 6px 2px; text-align: center; font-size: 12px; }
  .tabs__label { display: none; }
  .tabs__short { display: block; }
}
.tabs__tab:hover { position: relative; z-index: 1; border-color: var(--blue); }
.tabs__tab[aria-selected="true"] { position: relative; z-index: 2; background: var(--blue); border-color: var(--blue); color: #fff; }

.tabs__score {
  min-width: 28px; padding: 1px 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted);
}
.tabs__score.has-score { background: var(--blue-bright); border-color: var(--blue-bright); color: #fff; }
.tabs__tab[aria-selected="true"] .tabs__score { border-color: rgb(255 255 255 / .4); color: #fff; }



/* Region panel */

.panel { padding: 20px 16px; }
@media (min-width: 600px) { .panel { padding: 24px; } }

.panel__title { font-size: 24px; margin-bottom: 20px; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.area { padding: 16px; background: var(--tint); border-left: 4px solid var(--blue-bright); border-radius: var(--radius-sm); }
.area__legend { float: left; width: 100%; margin-bottom: 12px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.area__options { clear: both; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }

.area__warning {
  margin: 12px 0 0; padding: 10px 12px;
  background: #fff3d6; border-left: 4px solid var(--band-moderate); border-radius: var(--radius-sm);
  color: #5c3d00; font-size: 14px;
}

.pill input, .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }

.pill { display: block; cursor: pointer; }
.pill + .pill { margin-left: -1px; }
.pill:first-child .pill__body { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pill:last-child .pill__body { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pill__body {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; padding: 6px 2px;
  background: var(--surface); border: 1px solid var(--line);
  text-align: center;
}
.pill__score { font-size: 18px; font-weight: 900; line-height: 1.1; }
.pill__label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill:hover .pill__body { z-index: 1; border-color: var(--blue); }
.pill input:checked + .pill__body { z-index: 2; background: var(--blue); border-color: var(--blue); color: #fff; }
.pill input:checked + .pill__body .pill__label { color: rgb(255 255 255 / .8); }
.pill input[value="0"]:checked + .pill__body { background: var(--surface); border: 2px solid var(--blue); color: var(--blue); }
.pill input[value="0"]:checked + .pill__body .pill__label { color: var(--blue); }
.pill input:focus-visible + .pill__body { z-index: 3; box-shadow: var(--focus); }

.area.has-warning .pill input:checked + .pill__body { background: var(--surface); color: var(--ink); border: 2px solid var(--band-moderate); }

/* Sign accordion */
.signs { display: grid; gap: 8px; margin-top: 24px; }

.sign { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); scroll-margin-top: 16px; }
.sign[open] { border-color: var(--blue); }

.sign__summary {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 12px 8px 16px;
  border-radius: var(--radius);
  cursor: pointer; list-style: none;
}
.sign__summary::-webkit-details-marker { display: none; }
.sign__summary:hover { background: var(--tint); }
.sign[open] .sign__summary { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; background: var(--tint); }

.sign__title { flex: 1; min-width: 0; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }

.sign__value {
  flex: none; padding: 3px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.sign__score { font-weight: 900; }
.sign.is-graded .sign__value { background: var(--blue); border-color: var(--blue); color: #fff; }

.sign__chevron { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.sign[open] .sign__chevron { transform: rotate(180deg); }

.sign__fieldset { padding: 12px; border-top: 1px solid var(--line); }
@media (min-width: 600px) { .sign__fieldset { padding: 16px; } }

.sign__options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .sign__options { gap: 12px; } }

.opt { position: relative; }
.opt__label { display: block; cursor: pointer; }
.opt__body { display: block; overflow: hidden; background: var(--surface); outline: 1px solid var(--line); border-radius: var(--radius-sm); }
.opt__media { display: block; aspect-ratio: 1; background: #e6e2df; }
.opt__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.opt__text {
  display: block; padding: 6px 8px; border-top: 1px solid var(--line);
  font-size: 13px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.opt__score { font-weight: 900; }

.opt__label:hover .opt__body { outline: 2px solid var(--blue); }
.opt input:checked + .opt__body { outline: 3px solid var(--blue); outline-offset: -1px; }
.opt input:checked + .opt__body .opt__text { background: var(--blue); border-color: var(--blue); color: #fff; }
.opt input[value="0"]:checked + .opt__body { outline: 2px solid var(--blue); outline-offset: -1px; }
.opt input[value="0"]:checked + .opt__body .opt__text { background: var(--tint); border-color: var(--tint); color: var(--blue); }
.opt input:focus-visible + .opt__body { outline: 3px solid var(--blue); box-shadow: 0 0 0 6px var(--tint); }

.opt__zoom {
  position: absolute; top: 0; right: 0;
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 0 var(--radius-sm) 0 var(--radius-sm); background: var(--surface); cursor: zoom-in;
}
.opt__zoom svg { width: 18px; height: 18px; fill: var(--blue); }
.opt__zoom:hover { background: var(--blue); }
.opt__zoom:hover svg { fill: #fff; }

@media (max-width: 420px) {
  .opt__text { font-size: 11.5px; padding: 5px 3px; }
  .opt__zoom { width: 26px; height: 26px; }
  .opt__zoom svg { width: 15px; height: 15px; }
  .pill__label { font-size: 11px; }
}

.panel__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 28px; padding-top: 16px; border-top: 2px solid var(--blue);
}

.formula { display: flex; align-items: flex-end; gap: 12px; margin: 0; font-variant-numeric: tabular-nums; }
.formula__term { display: flex; flex-direction: column; align-items: flex-start; font-size: 26px; font-weight: 900; line-height: 1; }
.formula__cap { margin-bottom: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.formula__op { font-size: 22px; font-weight: 400; color: var(--muted); }
.formula__term--result { padding: 5px 8px 3px; border-radius: var(--radius-sm); background: var(--blue-bright); color: #fff; }
.formula__term--result .formula__cap { color: rgb(255 255 255 / .8); }

.panel__nav { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 599px) {
  .panel__nav { width: 100%; }
  .panel__nav .btn { flex: 1; padding: 0 10px; font-size: 12px; }
}


/* Summary */

.summary { margin-top: 24px; padding: 20px 16px; border-top: 6px solid var(--blue-bright); }
@media (min-width: 600px) { .summary { padding: 24px; } }

.summary__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.summary__head h2 { font-size: 24px; }
.summary__actions { display: flex; gap: 8px; }
@media (max-width: 599px) {
  .summary__head { flex-direction: column; align-items: stretch; }
  .summary__actions .btn { flex: 1; min-width: 0; padding: 0 8px; }
}
.summary__print-title { display: none; }
.summary__key { display: none; margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: right; }
@media screen and (max-width: 959px) { .summary__key { display: block; } }

.summary__meta { margin: 20px 0; }
.summary__meta .field { max-width: 220px; }

.field { display: grid; gap: 4px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.field { min-width: 0; }
.field input {
  width: 100%; min-width: 0; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-bottom: 2px solid var(--blue); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 16px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); background: var(--tint); }


.summary__table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.summary__table th, .summary__table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.summary__table th:first-child, .summary__table td:first-child { text-align: left; }
.summary__table thead th { border-bottom: 2px solid var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.summary__table tbody th { font-weight: 700; white-space: nowrap; }
.summary__table tbody th .tabs__swatch { display: inline-block; margin-right: 8px; vertical-align: -1px; }
.summary__table td.is-zero { color: #a9b0b1; }
.summary__table .col-score { white-space: nowrap; text-align: right; }
.summary__table .col-score strong { font-size: 16px; font-weight: 900; color: var(--blue); }
.summary__table thead th:last-child { text-align: right; }
.summary__table tfoot th, .summary__table tfoot td { padding-top: 14px; border-top: 2px solid var(--blue); border-bottom: 0; }
.summary__table tfoot th, .summary__table tfoot th:first-child { text-align: right; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.summary__table tfoot td { white-space: nowrap; text-align: right; }
.summary__total strong { font-size: 20px; font-weight: 900; color: var(--blue); }

@media screen and (max-width: 959px) {
  .summary__table, .summary__table tbody, .summary__table tfoot { display: block; }
  .summary__table thead { display: none; }

  .summary__table tbody tr {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px 8px;
    padding: 14px 0; border-bottom: 1px solid var(--line);
  }
  .summary__table tbody tr:first-child { border-top: 2px solid var(--blue); }
  .summary__table tbody th, .summary__table tbody td { padding: 0; border: 0; text-align: left; }
  .summary__table tbody th { grid-column: span 5; grid-row: 1; align-self: center; white-space: normal; }
  .summary__table tbody td { grid-column: span 4; }
  .summary__table tbody td::before {
    content: attr(data-label); display: block;
    font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  }
  .summary__table tbody .col-area { grid-column: 6 / span 2; grid-row: 1; }
  .summary__table tbody .col-score { grid-column: 8 / span 5; grid-row: 1; align-self: center; text-align: right; }

  .summary__table tfoot tr { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 2px solid var(--blue); }
  .summary__table tfoot th, .summary__table tfoot td { padding: 0; border: 0; }
  .summary__table tfoot th, .summary__table tfoot th:first-child { text-align: left; }
}


/* Zoom dialog / toast */

.zoom {
  width: min(92vw, 720px); max-height: 92vh; padding: 0;
  border: 0; border-radius: var(--radius); background: var(--surface);
}
.zoom::backdrop { background: rgb(10 14 15 / .85); }
.zoom__inner { margin: 0; }
.zoom__img { display: block; width: 100%; max-height: 74vh; object-fit: contain; background: #111; }
.zoom__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 4px solid var(--blue-bright); }
.zoom__caption { margin: 0; font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px;
  max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px;
  background: var(--navy); color: #fff; border-left: 4px solid var(--blue-bright); border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
}
.toast[hidden] { display: none; }
.toast__action {
  padding: 6px 12px; border: 1px solid rgb(255 255 255 / .5); border-radius: var(--radius-sm); background: transparent; color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
}
.toast__action:hover { background: #fff; color: var(--blue); }
@media (max-width: 959px) { .toast { bottom: calc(88px + env(safe-area-inset-bottom)); } }


/* Content pages */

.prose-wrap { max-width: 800px; margin: 0 auto; padding: 32px 16px 48px; }
.prose { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--blue-bright); border-radius: var(--radius); }
@media (min-width: 600px) { .prose { padding: 40px; } }
.prose h1 { font-size: clamp(28px, 5vw, 38px); margin-bottom: 20px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; }
.prose h3 { font-size: 18px; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose figure { margin: 24px 0; }
.prose iframe { max-width: 100%; }

/* [hecsi_hand] */
.prose .hand-explorer { max-width: 380px; margin: 24px auto; }
.hand-explorer .hand-card__title { margin: 0; }
.hand-explorer .legend__item { display: block; }
.legend__btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 6px;
  border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer;
}
.legend__btn:hover { background: var(--tint); }
.legend__btn[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 45%, #fff); font-weight: 700; }


/* Phones */

@media screen and (max-width: 599px) {
  .calc { padding-top: 0; }

  /* Full-width panels, more room for the photos */
  .calc .hand-card, .panel, .summary { margin-left: -16px; margin-right: -16px; border-left: 0; border-right: 0; border-radius: 0; }
  .calc .hand-card { border-top: 0; }
  .tabs { margin-bottom: 0; padding-bottom: 0; }
  .tabs__tab { min-height: 58px; }

  .panel { padding: 20px 16px 24px; }
  .panel__title { margin-bottom: 14px; font-size: 20px; }
  .area { padding: 12px; }
  .area__legend { margin-bottom: 10px; }
  .signs { margin-top: 20px; }
  .sign__summary { padding-left: 12px; }
  .sign__fieldset { padding: 10px; }
  .sign__options { gap: 6px; }

  .opt__zoom { width: 24px; height: 24px; background: rgb(255 255 255 / .85); }
  .opt__zoom svg { width: 14px; height: 14px; }
  .opt__text { padding: 5px 2px; font-size: 11.5px; }

  .formula__term { font-size: 22px; }
  .panel__nav .btn { min-height: 48px; }

  .summary__head h2 { font-size: 20px; }
}

@media screen and (max-width: 959px) {
  /* Summary rows only list the signs that were graded */
  .summary__table tbody td.is-zero:not(.col-score) { display: none; }
  .summary__table tbody .col-area { display: none; }
  .summary__table tbody tr { gap: 8px; padding: 12px 0; }
  .summary__table tbody th { grid-column: span 7; }
  .summary__table tbody .col-score { grid-column: 8 / span 5; }
  .summary__table tbody td:not(.col-score) {
    grid-column: span 4; padding: 6px 8px; background: var(--bg);
  }
  .summary__table tbody td:not(.col-score)::before { margin-bottom: 1px; }
  .summary__table tbody td.col-score.is-zero { color: #a9b0b1; }
}


/* Print: summary only, landscape */

@page { size: A4 landscape; margin: 12mm 15mm; }

@media print {
  html, body { overflow: visible; }
  body { background: #fff; padding: 0 !important; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .calc__layout, .summary__actions, .toast, .zoom, .skip-link { display: none !important; }

  .calc { padding: 0; max-width: none; }
  .summary { margin: 0; padding: 0; border: 0; }
  .summary__head h2 { font-size: 18pt; font-weight: 400; color: #000; }
  .summary__screen-title { display: none; }
  .summary__print-title { display: inline; }

  .summary__meta { margin: 20px 0 24px; }
  .summary__meta .field { max-width: none; }
  .field { display: flex; align-items: flex-end; gap: 8px; font-size: 11pt; font-weight: 400; letter-spacing: 0; text-transform: none; color: #000; }
  .field span { flex: none; }
  .field input { flex: none; width: 40mm; min-height: 0; padding: 0 0 2px; border: 0; border-bottom: 1px dashed #999; border-radius: 0; background: none; font-size: 11pt; }

  .summary__table { font-size: 11pt; }
  .summary__table tr { break-inside: avoid; }
  .summary__table th, .summary__table td { padding: 8px 10px; border: 1px solid #ccc; color: #000; }
  .summary__table thead th { border-bottom: 1px solid #ccc; color: #000; font-size: 9pt; }
  .summary__table td.is-zero { color: #000; }
  .summary__table tbody th .tabs__swatch { display: none; }
  .summary__table .col-score strong, .summary__total strong { color: #000; }
  .summary__table tfoot th, .summary__table tfoot td { border: 1px solid #ccc; }
  .field input::-webkit-calendar-picker-indicator { display: none; }
  .summary__table tfoot th, .summary__table tfoot th:first-child { font-size: 11pt; font-weight: 400; letter-spacing: 0; text-transform: none; }
  .summary__total strong { font-size: 13pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
