/* Step Adder v2 additions. The original palette and basic controls remain in styles.css. */
:root {
  --v2-dark-red: #7b241c;
  --v2-ink: #5c3b1e;
  --v2-paper: #fffdf7;
}

.optional { font-weight: 400; opacity: .6; font-size: .78em; font-style: italic; }
.topbar .step-home-link, .topbar .step-home-link:visited,
.topbar .classic-link, .topbar .classic-link:visited { color: var(--muted) !important; }
.v2-start { max-width: 680px; }
.start-fields { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: .75rem; }
.endpoint-arrow { color: var(--muted); font-size: 1.4rem; padding-bottom: .45rem; }
.target-row { display: flex; justify-content: center; align-items: center; gap: .5rem; flex-wrap: wrap; }
.target-row label { font-weight: 600; color: var(--soft-brown); }
#target-rungs-input { min-width: 5.5rem; width: 5.5rem; }
.override-warning { margin: .35rem auto; max-width: 600px; display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .55rem .75rem; border: 1px solid rgba(123,36,28,.25); border-radius: 10px; background: rgba(255,255,255,.55); color: var(--v2-dark-red); font-size: .9rem; }
.override-warning[hidden] { display: none !important; }

.start-tip { color: var(--muted); font-size: .78rem; }
.start-tip summary { cursor: pointer; list-style: none; }
.start-tip summary::-webkit-details-marker { display: none; }
.start-tip summary::after { content: ' ⓘ'; }
.start-tip span { display: block; max-width: 420px; margin: .3rem auto 0; }
.build-context { display: grid; justify-items: center; gap: .22rem; margin: .3rem 0 .8rem; }
#endpoint-summary { color: var(--dark-brown); letter-spacing: .08em; font-size: 1.02rem; }
.rung-target-line { display: inline-flex; align-items: baseline; gap: .18rem; }
#rung-count { color: var(--muted); font-size: .75rem; }
.builder-target-control { color: var(--muted); font-size: .75rem; font-weight: 500; padding: .12rem .3rem; }
.builder-target-control:hover, .builder-target-control:focus-visible { color: var(--dark-brown); text-decoration: underline; }
.builder-target-input { width: 4.3rem; min-width: 4.3rem; padding: .22rem .35rem; font-size: .78rem; text-align: center; }
.classic-link { font-size: .78rem; text-decoration: none; }
.builder-actions { align-items: center; margin: .45rem 0 .7rem; }
#flip-btn { padding-inline: .7rem; }

.ladder-list { list-style: none; padding: 0; margin: .5rem auto .75rem; max-width: 420px; display: grid; gap: .16rem; }
.v2-rung { position: relative; display: grid; grid-template-columns: 1fr; align-items: center; min-height: 2.25rem; border-radius: 9px; transition: background 120ms ease; }
.v2-rung.active { background: rgba(166,124,82,.14); outline: 1px solid rgba(92,59,30,.14); }
.v2-rung.future-branch { opacity: .48; }
.v2-rung.anchor-rung .rung-word-btn { font-weight: 700; }
.rung-word-btn { border: 0; background: transparent; color: var(--dark-brown); border-radius: 7px; font-size: 1.12rem; letter-spacing: .07em; justify-self: stretch; padding: .35rem 2rem .35rem 2.4rem; }
.rung-word-btn:hover { background: rgba(92,59,30,.06); color: var(--dark-brown); }
.rung-menu { position: absolute; inset: 0; pointer-events: none; }
.rung-menu__panel { position: absolute; z-index: 4; left: calc(100% + .5rem); top: 50%; min-width: 9.75rem; display: none; padding: .25rem; border: 1px solid rgba(92,59,30,.2); border-radius: 8px; background: var(--v2-paper); box-shadow: 0 4px 14px rgba(92,59,30,.14); pointer-events: auto; transform: translateY(-50%); }
.rung-menu__panel a, .rung-menu__panel button { color: var(--muted); text-align: left; text-decoration: none; font: inherit; font-size: .75rem; padding: .38rem .5rem; border: 0; background: transparent; }
.rung-menu__panel a:hover, .rung-menu__panel button:hover { color: var(--dark-brown); background: rgba(92,59,30,.06); }
.rung-menu__panel .rung-remove { color: var(--v2-dark-red); }
.v2-rung:hover .rung-menu__panel, .rung-menu.is-open .rung-menu__panel { display: grid; }
.clue-lookup, .candidate-row-actions a { color: var(--muted); text-decoration: none; font-size: .82rem; }
.clue-lookup:hover, .candidate-row-actions a:hover { color: var(--dark-brown); }
.ladder-gap { display: grid; justify-items: center; color: var(--muted); padding: .45rem 0; }
.ladder-gap span { font-size: 1.65rem; line-height: .7; }
.ladder-gap small { font-size: .72rem; font-style: italic; }

.v2-candidate-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: .55rem; align-items: start; margin-top: .55rem; }
.candidate-col { min-width: 0; border: 1px solid rgba(92,59,30,.12); border-radius: 11px; background: rgba(255,255,255,.22); overflow: visible; }
.candidate-col-head { display: grid; justify-items: center; gap: .05rem; padding: .42rem .5rem; color: var(--soft-brown); font-size: .78rem; border-bottom: 1px solid rgba(92,59,30,.1); }
.candidate-letter { color: var(--dark-brown); font-weight: 700; font-size: 1rem; letter-spacing: .05em; }
.candidate-col-head .candidate-tally { opacity: .72; font-size: .72rem; }
.candidate-tally { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; white-space: nowrap; }
.candidate-scroll { overflow: visible; padding: .35rem; display: grid; gap: .32rem; }
.candidate-row { position: relative; min-width: 0; }
.v2-candidate-btn { min-width: 0; width: 100%; border-radius: 999px; border: 1px solid rgba(92,59,30,.12); background: var(--candidate-bg); color: var(--candidate-fg); padding: .24rem .7rem; min-height: 2.05rem; display: flex; align-items: center; justify-content: center; }
.v2-candidate-btn:hover { filter: brightness(.96); background: var(--candidate-bg); color: var(--candidate-fg); }
.candidate-word { font-size: .9rem; letter-spacing: .05em; }
.candidate-metric { font-size: .63rem; font-weight: 500; opacity: .84; line-height: 1.2; }
.candidate-row-actions { position: absolute; right: .2rem; top: 50%; transform: translateY(-50%); z-index: 1; }
.candidate-row-actions summary { list-style: none; cursor: pointer; color: var(--muted); font-weight: 700; padding: .05rem .25rem; line-height: 1; }
.candidate-row-actions summary::-webkit-details-marker { display: none; }
.candidate-row-actions:not([open]) summary { opacity: 0; }
.candidate-row:hover .candidate-row-actions summary, .candidate-row:focus-within .candidate-row-actions summary { opacity: .8; }
.candidate-action-menu { position: absolute; right: 0; top: 1.25rem; display: flex; gap: .1rem; align-items: center; padding: .18rem; border: 1px solid rgba(92,59,30,.16); border-radius: 999px; background: var(--v2-paper); box-shadow: 0 2px 7px rgba(92,59,30,.15); }
.candidate-action-menu a { color: var(--muted); text-decoration: none; padding: .08rem .22rem; font-size: .82rem; }
.candidate-empty { margin: .3rem 0; padding: .5rem .2rem; color: var(--muted); font-size: .75rem; font-style: italic; }
.nix-btn, .finish-nix { border: 0; background: transparent; color: var(--muted); padding: .1rem .25rem; font-size: 1rem; min-width: 0; }
.nix-btn:hover, .finish-nix:hover { background: rgba(123,36,28,.08); color: var(--v2-dark-red); }
.connected-card { max-width: 560px; margin: .65rem auto; padding: .75rem; border-radius: 10px; background: rgba(205,230,198,.55); color: #35502d; font-size: .88rem; }

.manual-word-row { margin: .65rem auto .25rem; color: var(--muted); font-size: .78rem; }
.manual-word-row summary { cursor: pointer; list-style: none; }
.manual-word-row summary::-webkit-details-marker { display: none; }
.manual-word-row summary::after { content: ' +'; }
.manual-word-row > div { display: flex; justify-content: center; align-items: center; gap: .35rem; margin-top: .35rem; }
.manual-word-row input { min-width: 7.2rem; width: 7.2rem; }
.nixed-details { max-width: 560px; margin: .45rem auto; color: var(--muted); font-size: .84rem; }
.nixed-details summary { cursor: pointer; }
.nixed-list { display: flex; justify-content: center; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.nixed-chip { background: transparent; color: var(--muted); border: 1px solid rgba(92,59,30,.18); padding: .2rem .45rem; font-size: .74rem; }
.nixed-chip:hover { color: var(--dark-brown); background: rgba(92,59,30,.05); }

.finish-summary { margin-bottom: .45rem; font-weight: 600; font-size: .85rem; color: var(--soft-brown); }
.finish-path-list { display: grid; gap: .4rem; }
.finish-path-card { display: grid; gap: .3rem; justify-items: center; padding: .45rem; border-radius: 8px; background: rgba(255,255,255,.4); }
.finish-path-words { line-height: 1.9; font-size: .82rem; }
.finish-word-token { display: inline-flex; align-items: center; gap: .12rem; font-weight: 600; }
.finish-longer-btn { margin-top: .5rem; }

.clue-row { position: relative; padding-bottom: .25rem; }
.clue-word { display: inline-block; margin-right: .28rem; }
.clue-lookup { position: absolute; left: calc(100% + .3rem); top: .15rem; font-size: .68rem; opacity: 0; visibility: hidden; margin: 0; transition: opacity 120ms ease; }
.clue-row:hover .clue-lookup, .clue-row:focus-within .clue-lookup { opacity: .85; visibility: visible; }
.utility-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.clues-next-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.publish-utilities { justify-content: center; margin: .6rem 0 .15rem; }

@media (hover: none) {
  .clue-lookup { opacity: .85; visibility: visible; }
}

.publish-section { margin: 1rem auto .4rem; padding-top: .85rem; border-top: 1px solid rgba(92,59,30,.15); }
.publish-section-head { display: grid; gap: .12rem; justify-items: center; margin-bottom: .55rem; }
.wishy-publish { max-width: 560px; }
.wishy-issue-label { display: flex !important; gap: .5rem; align-items: center; justify-content: center; font-weight: 600; color: var(--soft-brown); }
#wishy-issue-input { min-width: 6.5rem; width: 6.5rem; }
#wishy-validation { margin: .45rem auto; max-width: 500px; }
#wishy-validation.ready { color: #4e6b3d; }
#export-wishy-pdf-btn:disabled { opacity: .45; }

.history-row.delete-mode { grid-template-columns: auto minmax(0,1fr) 10rem; }
.history-row.delete-mode .history-trash { position: static; opacity: 1; transform: none; grid-column: 1; }
.history-row.delete-mode .history-item { grid-column: 2; }
.history-row.delete-mode .history-edited { grid-column: 3; }

@media (max-width: 800px) {
  .start-fields { grid-template-columns: 1fr; }
  .endpoint-arrow { transform: rotate(90deg); padding: 0; }
  .v2-candidate-grid { grid-auto-flow: column; grid-auto-columns: minmax(155px, 70vw); grid-template-columns: none; overflow-x: auto; padding-bottom: .35rem; scroll-snap-type: x proximity; }
  .candidate-col { scroll-snap-align: center; }
  .candidate-scroll { overflow: visible; }
  .candidate-row-actions:not([open]) summary { opacity: .72; }
  .candidate-row-actions summary { min-width: 1.55rem; min-height: 1.55rem; display: grid; place-items: center; }
  .build-footer-actions { flex-wrap: wrap; }
}

@media print {
  @page { size: letter portrait; margin: 0; }
  body { background: #fff !important; }
  body > .app { display: none !important; }
  .print-region { display: block !important; width: 8.5in; height: 11in; margin: 0; }
  .print-region svg { width: 8.5in; height: 11in; display: block; }
}
