/* Free tools pages (/tools, /tools/*; views/tools/). The page shell, FAQ,
   "more tools" list and CTA live in landing.css, loaded first. */

.tools-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin: 0.8rem 0;
}
.tools-fields .block {
  align-content: start;
}
.tools-fields .block label {
  display: block;
}

.bt-presets,
.bt-table-actions,
.cc-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.bt-del {
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  box-shadow: none;
  font-size: 1.1rem;
  line-height: 1;
  flex: none;
}
.bt-del:hover {
  color: var(--red);
  border-color: var(--red);
  filter: none;
}

/* ---------- blinds timer ---------- */
.bt-stage {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--inset);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.bt-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--muted-2);
}
.bt-level {
  color: var(--gold);
  font-weight: 700;
  font-size: 0.95rem;
}
.bt-clock {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(4.2rem, 21vw, 10rem);
  line-height: 1;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.bt-last-minute .bt-clock {
  color: var(--gold);
}
.bt-on-break .bt-clock {
  color: var(--green);
}
.bt-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bt-bar {
  height: 100%;
  background: var(--gold-grad);
  transform-origin: left center;
  transform: scaleX(0);
}
.bt-blinds {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}
.bt-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-2);
}
.bt-blinds-value {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 10vw, 4rem);
  color: var(--cream);
  line-height: 1.1;
}
.bt-ante {
  font-weight: 700;
  color: var(--gold);
}
.bt-next {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.bt-controls {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.bt-controls .btn-ghost {
  flex: 1 1 0;
  max-width: 10rem;
}
.bt-play {
  flex: 1.4 1 0;
  max-width: 12rem;
  width: auto;
  margin: 0;
  font-size: 1.1rem;
}
.bt-running .bt-play {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.bt-controls-small .btn-ghost {
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
}
.bt-keys {
  font-size: 0.75rem;
  color: var(--muted-2);
}
@media (hover: none) {
  .bt-keys {
    display: none;
  }
}
.bt-setup .bt-presets {
  margin-bottom: 0.2rem;
}
#bt-build {
  width: auto;
  margin-top: 0.2rem;
  padding: 0.7rem 1.4rem;
}
#bt-summary {
  margin-top: 0.6rem;
}
.bt-table-wrap {
  overflow-x: auto;
  margin-top: 0.6rem;
}
.bt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.bt-table th,
.bt-table td {
  padding: 0.25rem 0.25rem;
  text-align: left;
}
.bt-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  padding-bottom: 0.4rem;
}
.bt-table tbody th {
  font-family: var(--mono);
  color: var(--muted);
  width: 3.4rem;
}
.bt-table tr.is-current th,
.bt-table tr.is-current td {
  background: var(--gold-soft);
}
.bt-table tr.is-current th {
  color: var(--gold);
  border-radius: 8px 0 0 8px;
}
.bt-table tr.is-current td:last-child {
  border-radius: 0 8px 8px 0;
}
.bt-table tr[data-type="break"] th,
.bt-break-cell {
  color: var(--green);
  font-weight: 700;
}
.bt-num {
  padding: 0.45rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  min-width: 4.2rem;
}

/* Full screen / TV mode: only the clock, sized to the screen. */
body.bt-big {
  padding: 0;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}
body.bt-big > :not(main),
body.bt-big .tools-main > :not(#bt-stage) {
  display: none !important;
}
body.bt-big .tools-main {
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
body.bt-big .bt-stage {
  flex: 1;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  justify-content: center;
  gap: 2vmin;
  padding: 3vmin 4vmin;
}
body.bt-big .bt-top {
  font-size: 2.6vmin;
}
body.bt-big .bt-level {
  font-size: 4vmin;
}
body.bt-big .bt-clock {
  font-size: min(34vmin, 22vw);
}
body.bt-big .bt-progress {
  height: 1vmin;
  border-radius: 0.5vmin;
  width: min(80vw, 140vmin);
  align-self: center;
}
body.bt-big .bt-label {
  font-size: 2.4vmin;
}
body.bt-big .bt-blinds-value {
  font-size: 13vmin;
}
body.bt-big .bt-ante {
  font-size: 4.5vmin;
}
body.bt-big .bt-next {
  font-size: 3.6vmin;
}
body.bt-big .bt-keys {
  display: none;
}
body.bt-big .bt-controls {
  opacity: 0.55;
}
body.bt-big .bt-controls:hover,
body.bt-big .bt-controls:focus-within {
  opacity: 1;
}

/* ---------- chip calculator ---------- */
.cc-subhead {
  margin-top: 1.2rem;
}
.cc-colours {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cc-colour {
  display: grid;
  grid-template-columns: 1.6rem minmax(6.5rem, 1.3fr) 1fr 1fr 2.2rem;
  align-items: end;
  gap: 0.5rem;
}
/* The Owned / Value captions only over the first row, like a table head. */
.cc-colour:not(:first-child) .cc-field > span {
  display: none;
}
.cc-colour > .cc-swatch {
  margin-bottom: 0.7rem;
}
.cc-colour select.form-control {
  padding-right: 0.5rem;
}
.cc-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  min-width: 0;
}
.cc-field .form-control {
  padding: 0.6rem 0.6rem;
  font-family: var(--mono);
}
.cc-colour .bt-del {
  margin-bottom: 0.35rem;
}
.cc-swatch {
  --chip: #888;
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--chip) 0 42%, transparent 43%),
    repeating-conic-gradient(var(--chip) 0 30deg, #f4eede 30deg 45deg);
  border: 2px solid var(--chip);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  vertical-align: middle;
  flex: none;
}
.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.cc-table th,
.cc-table td {
  padding: 0.55rem 0.4rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.cc-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.cc-table th:first-child {
  text-align: left;
}
.cc-table tbody th {
  color: var(--cream);
  font-weight: 600;
}
.cc-table tbody th .cc-swatch {
  margin-right: 0.45rem;
  width: 1.1rem;
  height: 1.1rem;
}
.cc-table td {
  font-family: var(--mono);
}
.cc-each {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}
.cc-unused td,
.cc-unused th {
  color: var(--muted-2) !important;
}
.cc-tag {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--muted-2);
}
.cc-summary {
  margin-top: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.cc-summary strong {
  color: var(--cream);
}

/* ---------- settle up ---------- */
.su-top {
  grid-template-columns: minmax(0, 260px);
}
.su-head,
.su-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto 2.2rem;
  gap: 0.45rem;
  align-items: center;
}
.su-head {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.su-rows {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.su-row .form-control {
  padding: 0.6rem 0.6rem;
  min-width: 0;
}
.su-field {
  min-width: 0;
}
.su-caption-small {
  display: none;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted-2);
  margin-bottom: 0.2rem;
}
.su-row [data-field="buyin"],
.su-row [data-field="chips"] {
  font-family: var(--mono);
}
.su-rebuy {
  white-space: nowrap;
}
.su-totals {
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.su-totals.is-off {
  color: var(--red);
}
.su-transfers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.su-transfers li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--inset);
  border: 1px solid var(--line);
  font-size: 1.05rem;
}
.su-from,
.su-to {
  color: var(--cream);
  font-weight: 700;
}
.su-arrow {
  color: var(--muted-2);
}
.su-amount {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--gold);
}
.su-even {
  color: var(--green);
  font-weight: 700;
}
.su-caption {
  caption-side: top;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  padding: 1rem 0 0.3rem;
}
.su-table .is-up {
  color: var(--green);
}
.su-table .is-down {
  color: var(--red);
}

@media (max-width: 560px) {
  .tools-main .card {
    padding: 1rem 0.9rem;
  }
  .bt-stage {
    padding: 1rem 0.8rem 0.9rem;
  }
  .bt-controls-small {
    flex-wrap: wrap;
  }
  .bt-num {
    min-width: 0;
    padding: 0.4rem 0.35rem;
    font-size: 0.85rem;
  }
  .bt-table thead th {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
  }
  .bt-table tbody th {
    width: 2.2rem;
    font-size: 0.8rem;
  }
  .bt-break-cell {
    font-size: 0.78rem;
  }
  .bt-controls-small .btn-ghost {
    flex: 1 1 40%;
    max-width: none;
  }
  .cc-colour {
    grid-template-columns: 1.4rem minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 2.2rem;
    gap: 0.35rem;
  }
  .cc-table th,
  .cc-table td {
    padding: 0.5rem 0.25rem;
    font-size: 0.85rem;
  }
  /* Two lines per player: name across the top, numbers underneath. */
  .su-head {
    display: none;
  }
  .su-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.2rem;
    padding: 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }
  .su-row [data-field="name"] {
    grid-column: 1 / 3;
  }
  .su-row .bt-del {
    grid-column: 3;
    grid-row: 1;
  }
  .su-field-buyin {
    grid-column: 1;
  }
  .su-field-chips {
    grid-column: 2;
  }
  .su-caption-small {
    display: block;
  }
  .cc-table .cc-sum {
    display: none;
  }
  .su-row .su-rebuy {
    grid-column: 1 / 4;
    justify-self: start;
  }
  .su-row [data-field="buyin"]::placeholder,
  .su-row [data-field="chips"]::placeholder {
    color: var(--muted-2);
  }
}

/* ---------- hand rankings ---------- */
.hr-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.hr-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
}
.hr-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem 0.9rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}
.hr-row:first-child {
  border-top: 0;
}
.hr-rank {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--gold);
  text-align: center;
}
.hr-name {
  font-size: 1.05rem;
}
.hr-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 0.1rem;
}
.hr-odds {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  margin-top: 0.2rem;
}
.hr-cards {
  display: flex;
  gap: 4px;
}
.hr-card {
  width: 50px;
  height: 70px;
  display: block;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.hr-foot {
  margin-top: 0.6rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.hr-sub {
  margin-top: 1.3rem;
}
.hr-ties {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}
.hr-ties li {
  margin-bottom: 0.35rem;
}
.hr-ties strong,
.hr-variants dt {
  color: var(--cream);
}
.hr-variants {
  margin: 0.4rem 0 0;
}
.hr-variants dt {
  font-weight: 700;
  margin-top: 0.7rem;
}
.hr-variants dd {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.hr-print-credit {
  display: none;
}

@media (max-width: 560px) {
  .hr-row {
    grid-template-columns: 1.6rem minmax(0, 1fr);
  }
  .hr-cards {
    grid-column: 2;
  }
  .hr-card {
    width: 44px;
    height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tools-main *,
  .tools-main *::before,
  .tools-main *::after {
    transition: none !important;
    animation: none !important;
  }
  .tools-main button:hover,
  .tools-main .action-button:hover {
    transform: none;
  }
}

/* ---------- print ---------- */
/* Any tools page prints without the site around it; the hand-rankings
   sheet is laid out to fit one page in black and white. */
@media print {
  @page {
    margin: 10mm 12mm;
  }
  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }
  body {
    padding: 0 !important;
    display: block;
  }
  .tools-head .brand img,
  .tools-crumbs,
  .site-foot,
  .tools-cta,
  .tools-about,
  .tools-lede,
  .bt-controls,
  .bt-keys,
  .bt-presets,
  .bt-table-actions,
  .cc-result-actions,
  #hr-print,
  .bt-del,
  .su-rebuy {
    display: none !important;
  }
  .tools-head,
  .tools-main {
    width: 100%;
  }
  .tools-head .brand .wordmark,
  .tools-main h1,
  .tools-main h2,
  .tools-main h3,
  .tools-main dt,
  .tools-main strong {
    color: #000 !important;
  }
  .tools-head .brand .tagline {
    display: none;
  }
  .card,
  .bt-stage {
    background: none !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
  }
  .tools-main p,
  .tools-main dd,
  .tools-main li {
    color: #222 !important;
  }

  .tools-hand-rankings .tools-head {
    display: none;
  }
  .tools-hand-rankings .tools-main {
    gap: 0;
  }
  .tools-hand-rankings h1 {
    font-size: 20pt;
    margin-bottom: 2mm;
  }
  .hr-sheet h2 {
    font-size: 13pt;
    margin: 3mm 0 1mm;
  }
  .hr-sheet-head {
    display: none;
  }
  .hr-text,
  .hr-text p {
    line-height: 1.25;
  }
  .hr-row {
    grid-template-columns: 8mm minmax(0, 1fr) auto;
    padding: 1mm 0;
    border-top: 0.3mm solid #bbb;
    break-inside: avoid;
  }
  /* Description and odds share a line to keep each row one card high. */
  .hr-desc,
  .hr-odds {
    display: inline;
  }
  .hr-odds::before {
    content: " · ";
  }
  .hr-rank {
    color: #000;
    font-size: 14pt;
  }
  .hr-name {
    font-size: 11pt;
  }
  .hr-desc,
  .hr-odds,
  .hr-foot,
  .hr-ties,
  .hr-variants dd {
    font-size: 8.5pt;
    line-height: 1.3;
    margin-top: 0;
  }
  .hr-odds {
    color: #555 !important;
  }
  .hr-card {
    width: 8mm;
    height: 11.2mm;
    box-shadow: none;
    border-radius: 1mm;
  }
  .hr-foot {
    border-top: 0.3mm solid #bbb;
    padding-top: 1.5mm;
    margin-top: 1mm;
  }
  .hr-ties {
    padding-left: 4mm;
  }
  .hr-ties li {
    margin-bottom: 0.6mm;
  }
  .hr-variants {
    columns: 2;
    column-gap: 6mm;
  }
  .hr-ties {
    columns: 2;
    column-gap: 6mm;
  }
  .hr-ties li {
    break-inside: avoid;
  }
  .hr-variants dt {
    margin-top: 1.5mm;
    font-size: 9pt;
    break-after: avoid;
  }
  .hr-variants dd {
    break-inside: avoid;
  }
  .hr-print-credit {
    display: block;
    margin-top: 3mm;
    font-family: var(--mono);
    font-size: 7.5pt;
    color: #555 !important;
    text-align: right;
  }
}
