/* taller.css — Taller de imagen: Marcar → Ajustar → Elegir + Historial. Usa los tokens de player.css. */
:root {
  --tw-warm: #2a2418;
  --tw-warm-line: #6b5b34;
  --tw-warm-text: #f0e3bf;
  --tw-blue-bg: #1b2638;
  --tw-blue-line: #2c3e5c;
  --tw-blue-text: #9ec3ff;
  --tw-off: #f5a77a;
  --tw-off-bg: #3a2218;
  --tw-off-line: #f08a4b;
}

.taller { position: fixed; inset: 0; z-index: 60; color: var(--paper); font-family: var(--f-ui); }
.taller[hidden] { display: none; }
body.tw-open { overflow: hidden; }

/* ---- hoja (paso 1) ---- */
.tw-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.tw-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92dvh; overflow: auto;
  background: var(--ink-3); border-radius: 18px 18px 0 0; padding: 10px 16px calc(20px + var(--sab));
  display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow);
}
.tw-grip { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: #4a4556; }

/* ---- página completa (pasos 2-3, historial) ---- */
.tw-page {
  position: absolute; inset: 0; overflow: auto; background: var(--ink);
  padding: var(--sat) var(--sar) 0 var(--sal);
}
.tw-page > * { max-width: 640px; margin-left: auto; margin-right: auto; }

.tw-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 8px; border-bottom: 1px solid var(--ink-4); }
.tw-head-main { flex: 1; min-width: 0; }
.tw-title { font-family: var(--f-display); font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-sub { font-size: 12px; color: var(--paper-2); }
.tw-icon { width: 44px; height: 44px; border: 0; background: transparent; color: var(--paper-2); font-size: 18px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; }
.tw-icon:hover { background: var(--ink-4); }
.tw-link { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--gold); font: inherit; font-size: 14px; }

.tw-steps { list-style: none; margin: 0 auto; padding: 12px 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-size: 12px; }
.tw-steps li { padding-top: 6px; border-top: 3px solid var(--ink-4); color: var(--paper-dim); }
.tw-steps li.is-done { border-color: #6e6878; color: var(--paper-2); }
.tw-steps li.is-on { border-color: var(--gold); color: var(--gold); font-weight: 600; }

.tw-pad { padding-left: 16px; padding-right: 16px; }
.tw-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tw-h2 { margin: 6px 0 10px; font-family: var(--f-display); font-size: 22px; font-weight: 600; }
.tw-sheet .tw-h2 { margin: 0; }
.tw-hint { margin: 0; font-size: 13px; color: var(--paper-2); }
.tw-hint.center { text-align: center; }
.tw-err { color: var(--red); }
.tw-note { margin: 0 0 10px; font-size: 12px; color: var(--paper-2); }
.tw-mono { font-family: var(--f-mono); font-size: 12px; line-height: 1.6; color: var(--paper-2); margin: 0; word-break: break-word; }
.tw-mark { color: #ffc9a8; }
.tw-plus { color: var(--tw-blue-text); }
.tw-mine { color: var(--tw-warm-text); }
s { color: var(--tw-off); }

/* ---- objetivo (fondo / personaje) ---- */
.tw-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tw-targets.one { grid-template-columns: minmax(0, 1fr); }
.tw-target { min-height: 72px; padding: 8px; border-radius: 12px; border: 1px solid #3a3546; background: var(--ink-2); color: var(--paper); display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; }
.tw-target.is-on { border: 2px solid var(--gold); background: var(--tw-warm); }
.tw-target img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--ink-4); flex: none; }
.tw-target img.is-sprite { object-fit: contain; background: var(--checker); }
.tw-target span { display: flex; flex-direction: column; min-width: 0; }
.tw-target small { font-size: 12px; color: var(--paper-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- chips ---- */
.tw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-chip { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #3a3546; background: transparent; color: var(--paper); font: inherit; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
button.tw-chip { cursor: pointer; }
.tw-reason.is-on { border-color: var(--tw-off-line); background: var(--tw-off-bg); color: #ffc9a8; }
.tw-term { border-color: var(--tw-warm-line); background: var(--tw-warm); color: var(--tw-warm-text); }
.tw-term.is-off { border-color: var(--tw-off-line); background: transparent; color: var(--tw-off); text-decoration: line-through; }
.tw-term.is-static { opacity: 0.85; }
.tw-phrase { border-color: var(--gold-2); color: var(--gold); }
.tw-phrase:disabled { border-color: var(--ink-4); color: #6e6878; }
.tw-added-chip { border-color: var(--tw-blue-line); background: var(--tw-blue-bg); color: var(--tw-blue-text); padding-right: 0; }
.tw-avoid { border: 1px dashed var(--tw-off-line); color: #ffc9a8; padding-right: 0; }
.tw-avoid.is-static { padding-right: 14px; opacity: 0.7; }
.tw-x { width: 40px; height: 40px; border: 0; background: transparent; color: inherit; font-size: 13px; cursor: pointer; }

/* ---- campos ---- */
.tw-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--paper-2); }
.tw-field input, .tw-inline input { height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid #3a3546; background: var(--ink); color: var(--paper); font-size: 16px; min-width: 0; }
.tw-inline { display: flex; gap: 8px; margin-top: 10px; }
.tw-inline input { flex: 1; }
.tw-inline button { min-width: 88px; border-radius: 10px; border: 1px solid #3a3546; background: var(--ink-3); color: var(--paper); font: inherit; }

.tw-primary { min-height: 52px; border-radius: 12px; border: 0; background: var(--gold); color: #1a1408; font: inherit; font-weight: 600; font-size: 16px; cursor: pointer; }
.tw-primary.is-danger { background: var(--tw-off-line); color: #1e0e05; }
.tw-primary:disabled, .tw-secondary:disabled { opacity: 0.5; cursor: default; }
.tw-secondary { min-height: 44px; border: 0; background: transparent; color: var(--paper); font: inherit; font-size: 14px; cursor: pointer; }

/* ---- ajustar ---- */
.tw-intro { display: flex; gap: 12px; align-items: center; padding-top: 4px; padding-bottom: 16px; }
.tw-intro img { width: 132px; height: 74px; object-fit: cover; border-radius: 8px; flex: none; }
.tw-intro img.is-sprite { width: 74px; height: 110px; object-fit: contain; background: var(--checker); }
.tw-intro p { margin: 0; font-size: 13px; color: var(--paper-2); line-height: 1.45; }
.tw-book { margin: 0 16px 18px; padding: 14px; border-radius: 12px; background: var(--ink-3); }
.tw-book h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--paper-2); text-transform: uppercase; letter-spacing: 0.06em; }
.tw-quote { margin: 0 0 10px; font-family: var(--f-display); font-size: 17px; line-height: 1.5; }
.tw-book .tw-hint { margin-bottom: 8px; font-size: 12px; }
.tw-lock { margin: 0 16px 10px; border: 1px solid var(--ink-4); border-radius: 12px; }
.tw-lock summary { min-height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 14px; cursor: pointer; list-style: none; }
.tw-lock summary::-webkit-details-marker { display: none; }
.tw-lock summary span:last-child { display: flex; flex-direction: column; }
.tw-lock summary small { font-size: 12px; color: var(--paper-2); }
.tw-lock .tw-mono { padding: 0 14px 14px; }
.tw-layer { margin: 0 16px 10px; padding: 14px; border: 1px solid var(--ink-4); border-radius: 12px; }
.tw-layer h3 { margin: 0 0 4px; font-size: 15px; }
.tw-layer small { font-size: 12px; color: var(--paper-2); }
.tw-layer.is-edit { border-color: #4a4030; background: #17150f; }
.tw-layer.is-warn { border: 2px solid var(--tw-off-line); background: #1e1510; }
.tw-layer.is-add { border-color: var(--tw-blue-line); background: #111723; }
.tw-warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--tw-off-bg); color: #ffc9a8; font-size: 13px; line-height: 1.45; }
.tw-added { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tw-added-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--tw-blue-bg); font-size: 14px; }
.tw-added-row span { flex: 1; }
.tw-added-row small { color: var(--tw-blue-text); }
.tw-added-row .tw-x { color: var(--tw-blue-text); }
.tw-full { margin-bottom: 16px; }
.tw-full summary { min-height: 44px; display: flex; align-items: center; color: var(--gold); cursor: pointer; font-size: 14px; }
.tw-full .tw-mono { padding: 12px; border-radius: 10px; background: var(--ink-3); }
.tw-foot {
  position: sticky; bottom: 0; padding: 12px 16px calc(16px + var(--sab)); background: var(--ink-2); border-top: 1px solid var(--ink-4);
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
}

/* ---- elegir ---- */
.tw-changes { padding: 10px 12px; border-radius: 10px; background: var(--ink-3); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.tw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px; }
.tw-card { position: relative; aspect-ratio: 16 / 10; padding: 0; overflow: hidden; border-radius: 12px; border: 1px solid #3a3546; background: var(--ink-3); cursor: pointer; }
.tw-card.is-sprite { aspect-ratio: 2 / 3; background: var(--checker); }
.tw-card.is-on { border: 3px solid var(--gold); }
.tw-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tw-card.is-sprite img { object-fit: contain; }
.tw-card.is-pending { display: flex; align-items: center; justify-content: center; color: var(--paper-2); font-size: 13px; cursor: default; }
.tw-tag { position: absolute; left: 6px; top: 6px; padding: 3px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--tw-blue-bg); color: var(--tw-blue-text); }
.tw-tag.is-cur { background: var(--ink-4); color: var(--paper); }
.tw-bar { margin-top: 14px; height: 4px; border-radius: 2px; background: var(--ink-4); }
.tw-bar b { display: block; height: 4px; border-radius: 2px; background: var(--gold); }
.tw-grid + .tw-pad .tw-hint { margin-top: 6px; }

/* ---- historial ---- */
.tw-timeline { list-style: none; margin: 0 auto; padding: 16px; }
.tw-hist { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 22px; position: relative; }
.tw-hist::before { content: ""; position: absolute; left: 13px; top: 20px; bottom: 0; width: 2px; background: var(--ink-4); }
.tw-hist:last-child::before { display: none; }
.tw-dot { width: 14px; height: 14px; border-radius: 7px; border: 2px solid #6e6878; box-sizing: border-box; margin: 4px auto 0; }
.tw-hist.is-active .tw-dot { background: var(--gold); border-color: var(--gold); }
.tw-badge { padding: 2px 8px; border-radius: 10px; background: var(--tw-warm); color: var(--gold); font-size: 12px; font-weight: 600; }
.tw-thumbs { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
.tw-thumbs img { width: 96px; height: 56px; object-fit: cover; border-radius: 8px; opacity: 0.55; }
.tw-thumbs img.is-sprite { width: 48px; height: 72px; object-fit: contain; background: var(--checker); }
.tw-thumbs img.is-chosen { opacity: 1; outline: 2px solid var(--gold); }
.tw-lines { margin: 0; font-size: 13px; line-height: 1.5; }

@media (min-width: 1024px) {
  .tw-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
