/* Every calculator on the site shares this frame. */

.tool {
  margin: 30px 0; border-radius: 2px; overflow: hidden;
  border: 1px solid var(--line); border-top: 2px solid var(--verd-deep);
  background: linear-gradient(180deg, var(--verd-wash), rgba(255,255,255,.012));
}

.tool__head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px 0;
}
.tool__k {
  font-family: var(--face-data); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--verd);
}
.tool__t { font-family: var(--face-sc); font-size: 17px; letter-spacing: .04em; }
.tool__note {
  margin-left: auto; font-family: var(--face-data); font-size: 9.5px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--grey-dim);
}
.tool__body { padding: 14px 20px 20px; }
.tool__hint { margin: 0 0 16px; color: var(--grey); font-size: 14.5px; }
.tool__foot { margin: 14px 0 0; color: var(--grey-dim); font-size: 13.5px; line-height: 1.6; }

/* Fields --------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .flabel {
  font-family: var(--face-data); font-size: 10px; letter-spacing: .17em;
  text-transform: uppercase; color: var(--grey);
}

input[type="number"], input[type="text"], textarea, select {
  width: 100%; min-width: 0; padding: 9px 11px;
  background: var(--ink); color: var(--bone);
  border: 1px solid var(--line); border-radius: 2px;
  font-family: var(--face-data); font-size: 14px;
}
textarea { font-family: var(--face-text); font-size: 15px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--verd-deep); box-shadow: 0 0 0 3px var(--verd-wash);
}
select {
  appearance: none; cursor: pointer; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--grey) 50%),
                    linear-gradient(135deg, var(--grey) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type="range"] { width: 100%; accent-color: var(--verd); padding: 0; }

.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.cols3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }

/* Readout -------------------------------------------------------------- */

.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 1px; margin-top: 16px; background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.readout__c { background: var(--panel); padding: 13px 14px; }
.readout__k {
  display: block; margin-bottom: 5px;
  font-family: var(--face-data); font-size: 9.5px; letter-spacing: .17em;
  text-transform: uppercase; color: var(--grey-dim);
}
.readout__v {
  display: block; font-family: var(--face-data); font-size: 21px;
  line-height: 1.15; color: var(--brass);
}
.readout__v.sm { font-size: 14px; color: var(--bone); }
.readout__v.verd { color: var(--verd); }
.readout__s {
  display: block; margin-top: 4px;
  font-family: var(--face-data); font-size: 10px; color: var(--grey-dim);
}

/* Stat rows ------------------------------------------------------------ */

.statrow {
  display: grid; grid-template-columns: 46px 1fr 60px 30px 30px;
  gap: 8px; align-items: center; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}
.statrow:last-of-type { border-bottom: 0; }
.statrow__a { font-family: var(--face-data); font-size: 12px; letter-spacing: .1em; color: var(--brass); }
.statrow__n { font-size: 15px; }
.statrow__n small { display: block; font-size: 12.5px; color: var(--grey-dim); line-height: 1.35; }
.statrow__bar { height: 4px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.statrow__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass-deep), var(--brass)); transition: width .3s; }
.statrow__v { font-family: var(--face-data); font-size: 15px; text-align: right; color: var(--bone); }

.step-btn {
  width: 28px; height: 28px; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  color: var(--bone-dim); font-family: var(--face-data); font-size: 13px; line-height: 1;
}
.step-btn:hover { border-color: var(--verd-deep); color: var(--verd); background: var(--verd-wash); }
.step-btn:disabled { opacity: .3; cursor: not-allowed; }

.budget {
  display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 2px; background: var(--ink);
}
.budget__n { font-family: var(--face-data); font-size: 22px; color: var(--verd); }
.budget__l { font-family: var(--face-data); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); }
.budget__r { margin-left: auto; font-family: var(--face-data); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--grey-dim); }
.budget.is-over { border-color: var(--ember); }
.budget.is-over .budget__n { color: var(--ember); }

/* Meter, pills, ticks -------------------------------------------------- */

.meter { margin-top: 14px; }
.meter__t { height: 6px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.meter__t i { display: block; height: 100%; background: linear-gradient(90deg, var(--verd-deep), var(--verd)); transition: width .35s; }
.meter__l {
  display: flex; justify-content: space-between; margin-top: 7px;
  font-family: var(--face-data); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--grey-dim);
}

.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 7px 13px; cursor: pointer; border-radius: 2px;
  background: transparent; border: 1px solid var(--line); color: var(--bone-dim);
  font-family: var(--face-data); font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase;
}
.pill:hover { border-color: var(--verd-deep); color: var(--bone); }
.pill[aria-pressed="true"] { background: var(--verd); border-color: var(--verd); color: var(--ink); }

/* Legend rows size the mark to its text rather than a fixed tick column. */
.legendrow {
  display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.legendrow:last-child { border-bottom: 0; }
.legendrow .mark { justify-self: start; }
@media (max-width: 520px) {
  .legendrow { grid-template-columns: 1fr; gap: 6px; }
}

.tickrow {
  display: grid; grid-template-columns: 26px 1fr; gap: 11px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
}
.tickrow:last-child { border-bottom: 0; }
.tick {
  width: 24px; height: 24px; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 2px;
  color: var(--verd); font-family: var(--face-data); font-size: 12px;
}
.tick[aria-pressed="true"] { border-color: var(--verd); background: var(--verd-wash); }
.tickrow input[type="text"] {
  border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
  background: transparent; font-family: var(--face-text); font-size: 15px; padding: 5px 2px;
}
.tickrow input[type="text"]:focus { box-shadow: none; border-bottom-color: var(--verd-deep); }
.tickrow.is-on input[type="text"] { color: var(--verd); }

/* Rank ladder ---------------------------------------------------------- */

.ladder { display: grid; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
.ladder__r {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 11px 14px; background: var(--panel);
  border-left: 3px solid var(--rank, var(--line));
}
.ladder__r.is-here { background: var(--panel-2); }
.ladder__n { display: block; font-family: var(--face-sc); font-size: 16px; letter-spacing: .04em; color: var(--rank, var(--bone)); }
.ladder__g { display: block; margin-top: 2px; font-size: 13.5px; color: var(--grey); line-height: 1.5; }
.ladder__m { font-family: var(--face-data); font-size: 11px; color: var(--grey-dim); text-align: right; white-space: nowrap; }

/* Resource pips -------------------------------------------------------- */

.pool { margin-bottom: 14px; }
.pool__h {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
  font-family: var(--face-data); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--grey);
}
.pool__h b { color: var(--bone); font-weight: 400; font-size: 12px; }
.pool__pips { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.pool__pips i { height: 8px; border-radius: 1px; background: var(--line-soft); }
.pool__pips i.on { background: var(--c, var(--brass)); }
.pool__pips i.cap { border: 1px dashed var(--line); background: transparent; }

/* Templates ------------------------------------------------------------ */

.tmpl { margin: 24px 0; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); }
.tmpl__head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.tmpl__t { font-family: var(--face-sc); font-size: 16px; letter-spacing: .04em; }
.tmpl__fields { padding: 14px 16px; display: grid; gap: 12px; }
.tmpl pre {
  margin: 0; padding: 16px; overflow-x: auto; white-space: pre-wrap;
  border-top: 1px solid var(--line-soft);
  font-family: var(--face-data); font-size: 13px; line-height: 1.9; color: var(--bone-dim);
}
.copy {
  padding: 6px 11px; cursor: pointer; white-space: nowrap; border-radius: 2px;
  background: transparent; border: 1px solid var(--line); color: var(--grey);
  font-family: var(--face-data); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
}
.copy:hover { color: var(--verd); border-color: var(--verd-deep); }
.copy.is-ok { color: var(--verd); border-color: var(--verd); }
