/*
 * Tang Luck Builder: the wizard steps of web/js/wizard/steps (Template,
 * Identity, Images, Animation, Keystore, Review) and their parts. The
 * wizard frame itself (step bar, sections, footer) is in layout.css; the
 * widgets (crop and icon editors, splash mock, gallery) in components.css.
 */

/* shared pieces of the steps */
.step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.save-status { color: var(--dim); font-size: .82rem; }
.save-status.err { color: var(--bad); }
.loading-line { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.note { color: var(--muted); }
.form-errors:empty { display: none; }
.field .count { color: var(--dim); align-self: flex-end; margin-top: -2px; }
.vc-hint { color: var(--dim); }
.op-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin-top: 8px; }
.op-status:empty { display: none; }
.op-status.ok { color: var(--ok); }
.op-status.err { color: var(--bad); }
.op-status .up-bar { width: 180px; }

/* progress bars of uploads */
.up-bar { flex: none; width: min(80%, 220px); height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--gold)); transition: width .2s; }
.up-bar.indeterminate i { width: 40% !important; animation: upIndet 1.1s ease-in-out infinite; }
@keyframes upIndet { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Template step: plain cards when the gallery has no screenshots */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tpl-card { display: flex; flex-direction: column; align-items: stretch; text-align: left; padding: 0; overflow: hidden; background: rgba(255, 255, 255, .04); border-radius: 16px; }
.tpl-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.tpl-info { display: flex; flex-direction: column; gap: 4px; padding: 14px; font-weight: 400; }
.tpl-card.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 26px rgba(255, 213, 74, .35); }

/* Images step: summary, options and slot cards */
.img-summary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin: 6px 0 12px;
  border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04);
}
.img-count { font-size: 1.02rem; }
.img-pending { display: flex; align-items: center; gap: 8px; color: var(--blue); font-weight: 650; font-size: .9rem; margin-top: 2px; }
.opts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 16px; color: var(--muted); }
.opts-title { color: var(--text); font-size: .9rem; }
.zip-panel { padding: 12px 14px; margin: 0 0 16px; border-radius: 14px; border: 1px solid rgba(74, 168, 255, .4); background: rgba(74, 168, 255, .06); }
.zip-panel h4, h4.one-by-one { margin: 0 0 6px; }
.zip-panel p { margin: 0; font-size: .88rem; }
.zip-panel .actions { margin-top: 10px; }
.zip-result { margin: 12px 0 0; }
.zr-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.zr-head .link { margin-left: auto; }
.zr-help { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.zr-rows { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .84rem; }
.zr-row { display: grid; grid-template-columns: minmax(0, 15rem) auto minmax(0, 1fr); gap: 4px 8px; align-items: baseline; }
.zr-row + .zr-row { border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 4px; }
.zr-slot { color: var(--text); }
.zr-row .pill.bad { color: var(--bad); border-color: rgba(255, 90, 122, .5); background: rgba(255, 90, 122, .1); }
.zr-row.refused .zr-info, .zr-row.duplicate .zr-info { color: #ffb3c2; }
.zr-info { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.zr-info .warn { color: #ffe3a3; }
.zr-ignored { margin-top: 8px; font-size: .84rem; }
.zr-ignored ul { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.slot { display: flex; flex-direction: column; gap: 9px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(10, 5, 30, .45); min-width: 0; }
.slot.replaced { border-color: rgba(255, 213, 74, .55); background: linear-gradient(180deg, rgba(255, 213, 74, .07), rgba(10, 5, 30, .45)); }
.slot.derived { border-color: rgba(74, 168, 255, .45); }
.slot.drop { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.slot.busy { border-color: rgba(74, 168, 255, .6); }
.slot.busy .slot-actions, .slot.busy .slot-choice { opacity: .45; pointer-events: none; }
.slot.flash { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(62, 224, 143, .4); }
.slot-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; font-size: .9rem; }
.slot-head .dim { font-size: .78rem; white-space: nowrap; }
.pill { flex: none; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; white-space: nowrap; border: 1px solid var(--line2); }
.pill.kept { color: var(--ok); border-color: rgba(62, 224, 143, .45); background: rgba(62, 224, 143, .08); }
.pill.new { color: #2a1300; border-color: rgba(255, 220, 120, .8); background: linear-gradient(180deg, #fff1a8, var(--gold)); }
.pill.auto { color: var(--blue); border-color: rgba(74, 168, 255, .5); background: rgba(74, 168, 255, .08); }
.pill.up { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); border-color: rgba(74, 168, 255, .5); background: rgba(74, 168, 255, .08); }
.slot-media { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.slot-pic-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.slot-pic {
  position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 120px; padding: 8px; border-radius: 10px;
  background: repeating-conic-gradient(rgba(255, 255, 255, .05) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}
.slot-img { display: block; max-width: 100%; max-height: 170px; width: auto; height: auto; border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.slot-img.round, .rv-img.round, .rv-icon.round { border-radius: 22%; }
.pic-tag { position: absolute; left: 6px; bottom: 6px; font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(8, 4, 20, .78); color: var(--muted); }
.slot-ph { color: var(--dim); font-size: .85rem; padding: 10px; text-align: center; }
.seg.mini button { padding: 3px 10px; font-size: .78rem; }
.slot-where {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px; border-radius: 10px; background: rgba(255, 255, 255, .04);
  box-shadow: none; font-size: .72rem; font-weight: 600; color: var(--muted);
}
.slot-where img { display: block; max-width: 132px; max-height: 150px; width: auto; height: auto; border-radius: 6px; }
.slot-text { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }
.slot-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: .78rem; }
.slot-msgs:empty { display: none; }
.slot-msgs li.warn::before { content: "⚠ "; }
.slot-msgs li.err::before { content: "✗ "; }
.slot-msgs li.note { color: var(--muted); }
.slot-msgs li.err { color: var(--bad); font-weight: 600; padding: 6px 8px; border-radius: 8px; background: rgba(255, 90, 122, .1); border: 1px solid rgba(255, 90, 122, .35); }
.slot-msgs li.retry { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.slot-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.slot-choice { margin-top: auto; align-self: flex-start; }
.slot-actions .slot-choice { margin-top: 0; }

.slot-choice button { font-size: .84rem; padding: 6px 12px; }
.seg.slot-choice button.on { color: #06210f; background: linear-gradient(180deg, #b9ffd9, var(--ok)); cursor: default; }
.where-big { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; margin: 0 auto 10px; border-radius: 10px; }
/* the bank of ready-made game pictures */
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; max-height: min(62vh, 640px); overflow: auto; padding: 2px; }
.bank-tile { padding: 0; border: 2px solid var(--line2); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .3); box-shadow: none; aspect-ratio: 16 / 9; }
.bank-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bank-tile:hover, .bank-tile:focus-visible { border-color: var(--gold); }

/* a picture going up */
.up-preview { opacity: .38; filter: saturate(.6); }
.up-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px;
  text-align: center; color: var(--text); background: rgba(10, 5, 30, .45); border-radius: 10px; overflow: hidden;
}
.up-overlay .spin { width: 20px; height: 20px; border-width: 3px; color: var(--blue); }
.up-overlay .up-cancel { padding: 0 4px; font-size: .82rem; }
.up-text { font-size: .9rem; }
.up-overlay small { color: var(--muted); font-size: .72rem; word-break: break-all; }
.up-flash {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: rgba(6, 40, 22, .62);
  color: #b9ffd9; font-weight: 800; font-size: 1.05rem; transition: opacity .5s;
}
.up-flash.out { opacity: 0; }

/* Animation step */
.fx-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.fx-left { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 70px; }
.td-head p { color: var(--muted); }
.fx-stages { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fx-stages figure { margin: 0; }
.fx-stages figure.wide { grid-column: 1 / -1; }
.fx-rec { position: relative; margin: 0; }
.fx-video { width: 100%; aspect-ratio: 9 / 19; object-fit: cover; border-radius: 14px; border: 2px solid #2a2440; background: #000; display: block; }
.fx-rec.v-wait::after {
  content: ""; position: absolute; left: 50%; top: 42%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: var(--gold); animation: spin .8s linear infinite; pointer-events: none;
}
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.fx-card { flex-direction: column; padding: 6px; gap: 5px; border-radius: 12px; background: rgba(255, 255, 255, .04); font-weight: 600; font-size: .82rem; }
.fx-card.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(255, 213, 74, .3); }
.mock-box.mini .mock { border-radius: 9px; }
.mock-box.mini .mock-sub, .mock-box.mini .mock-load, .mock-box.mini .mock-brand { display: none; }
.fx-params { display: flex; flex-direction: column; gap: 10px; }
.param { display: flex; flex-direction: column; gap: 5px; }
.param > span { font-weight: 600; color: var(--muted); font-size: .9rem; }
.seg.symbols button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; }
.seg.symbols canvas { width: 40px; height: 40px; }
.seg.symbols small { font-size: .72rem; }

/* Keystore step: modes, forms, passwords and keystore cards */
.radio-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.radio-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; background: rgba(255, 255, 255, .03); }
.radio-card input { flex: none; margin: 3px 0 0; width: 16px; height: 16px; }
.radio-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.radio-card.disabled { opacity: .55; cursor: not-allowed; }
.rc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rc-text b { line-height: 1.25; }
.rc-sub { color: var(--text); font-size: .88rem; }
.rc-details { color: var(--dim); font-size: .76rem; }
.ks-mismatch .actions { margin: 8px 0; }
.ks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.ks-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
fieldset.ks-fs { display: flex; flex-direction: column; gap: 10px; margin: 0; }
fieldset.ks-fs legend { padding: 0 6px; font-weight: 700; color: var(--gold); }
.pw-wrap { display: flex; flex-direction: column; gap: 5px; }
.pw-row { display: flex; gap: 6px; }
.pw-row input { flex: 1; min-width: 0; font-family: var(--mono); }
.pw-meter { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--dim); }
.pw-meter i { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); }
.pw-meter span { min-width: 9.5em; }
.pw-meter.s1 i { background: linear-gradient(90deg, var(--bad) 0 25%, rgba(255, 255, 255, .08) 0); }
.pw-meter.s2 i { background: linear-gradient(90deg, var(--warn) 0 50%, rgba(255, 255, 255, .08) 0); }
.pw-meter.s3 i { background: linear-gradient(90deg, var(--ok) 0 75%, rgba(255, 255, 255, .08) 0); }
.pw-meter.s4 i { background: var(--ok); }
.pw-match { font-size: .78rem; margin-top: -4px; }
.pw-match:empty { display: none; }
.pw-match.ok { color: var(--ok); }
.pw-match.err { color: var(--bad); }
.key-pw { display: flex; flex-direction: column; gap: 10px; }
.gen-row { display: flex; }
.gen-box:empty { display: none; }
.gen-pw { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: rgba(62, 224, 143, .08); border: 1px solid rgba(62, 224, 143, .35); }
.gen-pw code { font-size: .95rem; color: var(--text); word-break: break-all; user-select: all; }
.gen-box small { display: block; margin-top: 4px; }
.dn-box { display: flex; flex-direction: column; gap: 4px; padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .04); font-size: .82rem; color: var(--muted); }
.dn-preview { color: var(--text); word-break: break-word; }
.ks-made { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.ks-made h4 { margin: 0; color: var(--ok); }
.ks-save { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ks-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ks-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; cursor: pointer; }
.ks-pick.on .ks-card { border-color: var(--gold); }
.ks-card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); min-width: 0; }
.ks-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ks-card .fp { color: var(--dim); }
.alias-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; }
.alias-pick span { color: var(--dim); font-size: .82rem; margin-right: 4px; }
.big-fp { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); font-size: .9rem; color: var(--text); user-select: all; }

/* Review step: the checklist and the build buttons */
.rv-check { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rv-item { border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 12px 14px; background: rgba(10, 5, 30, .35); }
.rv-item.rv-warn { border-left-color: var(--warn); }
.rv-item.rv-bad { border-left-color: var(--bad); background: rgba(255, 90, 122, .06); }
.rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rv-head b { font-size: 1rem; }
.rv-mark {
  width: 24px; height: 24px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem;
  color: #10061f; background: var(--ok);
}
.rv-item.rv-warn .rv-mark { background: var(--warn); }
.rv-item.rv-bad .rv-mark { background: var(--bad); color: #fff; }
.rv-edit { margin-left: auto; font-size: .85rem; font-weight: 600; color: var(--gold); text-decoration: none; padding: 4px 10px; border: 1px solid rgba(255, 213, 74, .4); border-radius: 999px; }
.rv-edit:hover, .rv-edit:focus-visible { background: rgba(255, 213, 74, .12); }
.rv-body .kv { margin: 0; }
.rv-body .kv th { width: 9.5em; }
.rv-id { display: flex; gap: 14px; align-items: flex-start; }
.rv-icon { width: 72px; height: 72px; flex: none; object-fit: cover; }
.rv-count { margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.rv-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.rv-slot { margin: 0; display: flex; flex-direction: column; gap: 5px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 5, 30, .4); min-width: 0; }
.rv-slot.replaced { border-color: rgba(255, 213, 74, .55); }
.rv-slot.derived { border-color: rgba(74, 168, 255, .45); }
.rv-pic { height: 84px; display: flex; align-items: center; justify-content: center; }
.rv-img { display: block; max-width: 100%; max-height: 84px; width: auto; height: auto; border-radius: 5px; }
.rv-slot figcaption { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: .74rem; color: var(--muted); }
.rv-name { line-height: 1.25; }
.rv-msgs { margin: 10px 0 0; padding: 0 0 0 18px; font-size: .88rem; display: flex; flex-direction: column; gap: 4px; }
.rv-msgs li.rv-bad { color: #ffb3c2; }
.rv-msgs li.rv-warn { color: #ffe3a3; }
.sw.gradient { border-radius: 6px; overflow: hidden; gap: 0; }
.out-section { margin-top: 16px; }
.out-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.out-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }

@media (max-width: 860px) {
  .fx-layout { grid-template-columns: 1fr; }
  .fx-left { position: static; }
  .radio-row, .ks-grid, .ks-picks { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .slot-grid { grid-template-columns: 1fr; }
  .zr-row { grid-template-columns: minmax(0, 1fr) auto; }
  .zr-info { grid-column: 1 / -1; }
  .fx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .slot-where img { max-width: 110px; max-height: 130px; }
  .rv-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rv-id { flex-direction: column; }
  .rv-body .kv th { width: auto; }
  .rv-item { padding: 10px 12px; }
  .op-status .up-bar { width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .up-bar.indeterminate i, .fx-rec.v-wait::after { animation-duration: 2.4s; }
}
