/* ============================================================================
   Create page — styles specific to building a lock.
   Shared tokens and components live in app.css; motion lives in motion.css.
   ========================================================================== */

.btn-wrongchain { border-color: var(--loose); color: var(--loose); }
.btn-x { padding: 4px 12px; }

/* ---------------------------------------------------------------- token card */

.token-card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border-radius: var(--r-box);
}

.token-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: var(--line);
}
.token-ini {
  display: grid;
  place-content: center;
  background: var(--ink);
  color: var(--lime);
  font: 800 16px var(--font);
}
.token-id { min-width: 0; flex: 1 1 140px; }
.token-sym { font-size: 16px; }
.token-ok { color: var(--hard); }

.token-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.token-stats > div { display: flex; flex-direction: column; }
.token-stats b { font-size: 15px; }

/* ---------------------------------------------------------------- time mode */

.modes { flex-wrap: wrap; }
.time-wrap { margin-top: 14px; }
.warn { margin-top: 14px; }

/* ---------------------------------------------------------------- ladder */

.ladder-legend { display: flex; align-items: center; gap: 8px; }
.ladder-note { margin: 6px 0 0; line-height: 1.6; }
.hardness-note { margin: 12px 0 0; line-height: 1.7; }

/* A tier pin sitting past the graduation wall. The red is doing real work:
   it is the difference between a lock that can open and one that never will. */
.ladder-pin.over {
  background: var(--loose);
  border-color: var(--loose);
  color: #fff;
}

/* ---------------------------------------------------------------- tiers */

.tiers { display: grid; gap: 12px; margin-top: 16px; }

.tier {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  padding: 14px 16px;
}
.tier.bad { border-color: var(--loose); background: var(--loose-bg); }

.tier-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.tier-no { font: 800 13px var(--font); }
.tier-del {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font: 700 18px/1 var(--font);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.tier-del:hover { background: var(--loose-bg); color: var(--loose); }

.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 14px;
}
.tier-cell { min-width: 0; }
.tier-cell > label { display: block; margin-bottom: 5px; }
.tier-cell .field { padding: 9px 11px; font-size: 13.5px; }

.mul-wrap { display: flex; align-items: center; gap: 6px; }
.mul-wrap .field { flex: 1; min-width: 0; }
.mul-x { font: 800 14px var(--font); color: var(--ink-3); }

.tier-readout { margin: 6px 0 0; line-height: 1.5; }
.tier-err { margin: 8px 0 0; font-size: 12px; }

input[type="range"] {
  accent-color: var(--ink);
  width: 100%;
  margin: 6px 0 0;
  cursor: pointer;
}

/* ---------------------------------------------------------------- vault */

.vault-card { background: var(--panel); }

.vault {
  position: relative;
  height: 168px;
  display: grid;
  place-items: end center;
  overflow: hidden;
}

.vault-jar {
  position: relative;
  width: 118px;
  height: 104px;
  border: 3px solid var(--ink);
  border-radius: 10px 10px 16px 16px;
  background: var(--paper);
  overflow: hidden;
}

/* Fill height is set from JS as a share of the user's balance, so the jar
   reads as "how much of what you hold are you actually locking". */
.vault-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0;
  background: var(--lime);
  transition: height .5s cubic-bezier(.2,.9,.3,1);
}

.vault-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.vault-amt { font: 800 19px var(--font); line-height: 1.1; }

.vault-lid {
  position: absolute;
  bottom: 100px;
  width: 132px;
  height: 15px;
  border: 3px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
}

.vault-lock {
  position: absolute;
  bottom: 88px;
  font-size: 24px;
  transform: scale(0);
}
.vault-lock.on { animation: lockPop .5s cubic-bezier(.2,1.4,.4,1) forwards; }

.vault-coin {
  position: absolute;
  bottom: 96px;
  font-size: 26px;
  color: var(--medium);
  opacity: 0;
}
.vault-coin.fly { animation: coinFly 1.05s cubic-bezier(.3,.7,.3,1) forwards; }

.vault-caption { text-align: center; margin: 10px 0 0; }
.vault-foot { text-align: center; margin: 8px 0 0; line-height: 1.6; }

/* ---------------------------------------------------------------- seal */

.seal-row { display: flex; align-items: center; gap: 14px; }
.seal span { display: block; }
.seal #sealTop, .seal #doneSealTop { font-size: 10px; letter-spacing: .06em; }
.seal #sealBot, .seal #doneSealBot { font-size: 11px; }

/* ---------------------------------------------------------------- wallet list */

.wallet-opt .rdns { font: 500 11px var(--font); color: var(--ink-3); }

/* ---------------------------------------------------------------- tx sheet */

.tx-err-hex { display: block; margin-top: 6px; font-size: 11px; opacity: .7; word-break: break-all; }

.tx-step-spin {
  display: inline-block;
  width: 11px; height: 11px;
  border: 2px solid var(--line-2);
  border-top-color: var(--ink);
  border-radius: 50%;
}

/* ---------------------------------------------------------------- done */

.done-card { text-align: center; padding: 36px 22px; }
.done-seal { width: 88px; height: 88px; margin: 0 auto 18px; }
.done-seal span { font-size: 13px !important; }
.done-actions { justify-content: center; flex-wrap: wrap; margin-top: 6px; }
#doneSummary { margin: 8px 0 18px; }

/* ---------------------------------------------------------------- duration */

.dur-chips { flex-wrap: wrap; margin-top: 8px; }

.chip-btn {
  appearance: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: inherit;
  font: 700 12.5px var(--font);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chip-btn:hover { border-color: var(--line-2); }
.chip-btn[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}

.dur-custom { margin-top: 10px; flex-wrap: wrap; }
.dur-custom .field { padding: 9px 12px; font-size: 13.5px; }
#durNum { flex: 0 1 90px; min-width: 70px; }

/* Segmented control replacing a <select>; see the note in create.html. */
.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--line);
  border-radius: var(--r-pill);
  flex: none;
}
.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font: 700 12.5px var(--font);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.seg-btn:hover:not([aria-pressed="true"]) { background: var(--paper); }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--lime); }

#unlockPreview { margin: 10px 0 0; }
#timeMsg { margin: 6px 0 0; }

/* A tier the contract accepts but that is unlikely to ever open. Brass, not
   red: it is a caution, not a blocked submission. */
.tier.warn-tier { border-color: var(--medium); background: var(--medium-bg); }
.tier-warn { margin: 8px 0 0; font-size: 12px; color: var(--medium); line-height: 1.55; }

/* ============================================================================
   Vault sequences.

   The designer's keyframes are not independent animations — they are tracks on
   one timeline. lidDown does nothing for its first 66%, coinOut nothing for its
   first 44%, badgePop nothing for its first 78%. Firing them separately, as
   this first shipped, throws away the choreography entirely.

   So every element in a sequence gets the SAME duration and starts together;
   the percentages inside each keyframe do the staging.
   ========================================================================== */

.vault-spark, .vault-badge {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.vault-spark { bottom: 104px; font-size: 20px; color: var(--medium); }
.vault-badge {
  bottom: 118px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--hard); color: #fff;
  display: grid; place-content: center;
  font: 800 17px var(--font);
  transform: scale(0);
}

/* ---- deposit: coin arcs in, lid drops, level rises, lock snaps shut ---- */
.vault[data-play="in"] .vault-coin { animation: coinFly  1.6s cubic-bezier(.3,.7,.3,1) both; }
.vault[data-play="in"] .vault-lid  { animation: lidDown  1.6s cubic-bezier(.3,.8,.3,1) both; }
.vault[data-play="in"] .vault-fill { animation: fillUp   1.6s cubic-bezier(.3,.8,.3,1) both; }
.vault[data-play="in"] .vault-lock { animation: lockPop  1.6s cubic-bezier(.2,1.4,.4,1) both; }
.vault[data-play="in"] .vault-jar  { animation: jarWobble 1.6s ease both; }

/* ---- withdraw: lock rattles free, shackle swings, lid flies, coin out ---- */
.vault[data-play="out"] .vault-lock  { animation: lockShake   2.2s ease both; }
.vault[data-play="out"] .vault-lid   { animation: lidOff      2.2s cubic-bezier(.3,.6,.3,1) both; }
.vault[data-play="out"] .vault-coin  { animation: coinOut     2.2s cubic-bezier(.3,.6,.3,1) both; }
.vault[data-play="out"] .vault-fill  { animation: drain       2.2s cubic-bezier(.4,.1,.4,1) both; }
.vault[data-play="out"] .vault-jar   { animation: jarWobble   2.2s ease both; }
.vault[data-play="out"] .vault-spark { animation: sparkOut    2.2s ease both; }
.vault[data-play="out"] .vault-badge { animation: badgePop    2.2s cubic-bezier(.2,1.4,.4,1) both; }

/* The idle jar keeps its JS-set fill height; a sequence overrides it. */
.vault[data-play] .vault-fill { transition: none; }

/* Compact copy for the success card and the transaction sheet. */
.vault-sm { height: 150px; transform: scale(.86); }
