/*
 * 7 Wonders science calculator (/tools/7-wonders-science-calculator).
 * One card per player (stacked on phones, side by side on wide screens) with big −/+ steppers,
 * the science breakdown and a ranking when more than one player is scored.
 * Builds on the "Free tools" block in site.css (.nk-input, .nk-table, .nk-text-btn).
 */

/* ---- Setup bar ---- */
.sc-setup {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px clamp(16px, 3vw, 28px);
  background: #fffdf9;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
}

/* ---- Steppers ---- */
.sc-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.sc-step__btn {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid #ddd5c8;
  border-radius: 50%;
  background: #fffdf9;
  color: #3b302b;
  font-family: inherit;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}
.sc-step__btn:hover {
  background: #f2ebe0;
  border-color: #c8bbae;
}
.sc-step__btn:active {
  background: #ede5d8;
}
.sc-step__btn:focus-visible,
.sc-check input:focus-visible + span,
.sc-extras summary:focus-visible {
  outline: 2px solid #8b5e3c;
  outline-offset: 2px;
}
.sc-step__num {
  width: 52px;
  height: 44px;
  padding: 0 4px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sc-count {
  min-width: 36px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}

/* ---- Player cards ---- */
.sc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  align-items: start;
}
.sc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: clamp(16px, 3vw, 24px);
  background: #fffdf9;
  border-radius: 22px;
  box-shadow:
    0 0 0 1px rgba(59, 48, 43, 0.06),
    0 30px 70px rgba(59, 48, 43, 0.08);
}
.sc-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sc-name {
  flex: 1;
  height: 44px;
  font-size: 16px;
  font-weight: 700;
}
.sc-card__total {
  flex: none;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 14px;
  border-radius: 999px;
  background: #ffb900;
  color: #2e2018;
  font-variant-numeric: tabular-nums;
}
.sc-card__total [data-o='total'] {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.sc-card__unit {
  font-size: 13px;
  font-weight: 600;
}

/* ---- Symbol fields ---- */
.sc-fields {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sc-field {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #efe7dc;
}
.sc-fields .sc-field:last-child {
  border-bottom: 0;
}
.sc-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: #e5ebe1;
  color: #4f6d4c;
}
.sc-icon svg {
  width: 22px;
  height: 22px;
}
.sc-icon--wild,
.sc-icon--most {
  background: #f4e9d2;
  color: #8b5e3c;
}
.sc-icon--sm {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  vertical-align: middle;
}
.sc-icon--sm svg {
  width: 15px;
  height: 15px;
}
.sc-field__label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #2e2018;
}
.sc-field__hint {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.35;
  color: #7a6a5c;
}

/* ---- Expansion extras ---- */
.sc-extras {
  border-radius: 14px;
  background: #f7f1e8;
  padding: 0 14px;
}
.sc-extras summary {
  /* A visible +/− so the closed panel reads as something that opens. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  padding: 12px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.sc-extras summary::-webkit-details-marker {
  display: none;
}
.sc-extras summary::after {
  content: '+';
  flex: none;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}
.sc-extras[open] summary::after {
  content: '−';
}
.sc-extras .sc-field {
  border-bottom: 0;
  padding-top: 0;
}
.sc-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-bottom: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: #3b302b;
  cursor: pointer;
}
.sc-check input {
  width: 20px;
  height: 20px;
  flex: none;
  margin: 0;
  accent-color: #8b5e3c;
}

/* ---- Breakdown ---- */
.sc-break {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.sc-table th,
.sc-table td {
  padding: 7px 0;
  border-bottom: 1px solid #efe7dc;
  text-align: right;
}
.sc-table th:first-child {
  text-align: left;
  font-weight: 500;
  color: #3b302b;
}
.sc-table thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b5e3c;
}
.sc-table td:last-child {
  font-weight: 700;
  color: #2e2018;
  width: 64px;
}
.sc-table tfoot th,
.sc-table tfoot td {
  border-bottom: 0;
  font-weight: 800;
  color: #2e2018;
  font-size: 16px;
}
.sc-plus {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f4e9d2;
  color: #8b5e3c;
  font-size: 12px;
  font-weight: 700;
}
.sc-best,
.sc-base {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #7a6a5c;
}
.sc-best strong {
  color: #2e2018;
}

/* ---- Ranking and actions ---- */
.sc-foot {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 3vw, 26px) clamp(16px, 3vw, 28px);
  background: #fffdf9;
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(59, 48, 43, 0.06);
}
.sc-rank {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5ddd2;
}
.sc-rank[hidden] {
  display: none;
}
.sc-rank__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sc-rank__list li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 15px;
  color: #3b302b;
  font-variant-numeric: tabular-nums;
}
.sc-rank__pos {
  width: 20px;
  flex: none;
  font-weight: 700;
  color: #8b5e3c;
}
.sc-rank__name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.sc-rank__pts {
  font-weight: 800;
  color: #2e2018;
}

/* ---- Content tables ---- */
.sc-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: #f7f1e8;
  color: #3b302b;
}
.sc-best-cell {
  background: #ffb900;
  color: #2e2018;
  border-radius: 999px;
  padding: 0 0.4em;
  font-weight: 700;
}

/* Narrow phones: the long expansion label gets its own line, the stepper goes under it. */
@media (max-width: 420px) {
  .sc-extras .sc-field {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .sc-extras .sc-step {
    grid-column: 2;
  }
}
