:root {
  --bg: #f4f8f6;
  --paper: #ffffff;
  --ink: #0f1f1c;
  --muted: #5f7570;
  --line: #0f1f1c;
  --hair: #c9ddd7;
  --aqua: #12a594;
  --aqua-dark: #0b7d70;
  --aqua-soft: #dcf3ed;
  --mint: #a6e6d7;
  --danger: #c8423b;
  --gap: 24px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); }
.label { grid-column: 1 / span 3; }
.body { grid-column: 4 / -1; min-width: 0; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Header */
header .grid { align-items: center; padding-top: 20px; padding-bottom: 20px; border-bottom: 3px solid var(--ink); }
.brand { grid-column: 1 / span 6; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.nav { grid-column: 1 / -1; grid-row: 2; display: flex; gap: 6px 22px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--hair); }
.nav a { font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; text-decoration: none;
         padding: 4px 0; border-bottom: 3px solid transparent; }
.nav a:hover { border-color: var(--hair); }
.nav a.on { border-color: var(--aqua); }
header .cafecito { grid-column: 7 / -1; justify-self: end; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 0; padding: 9px 16px; transition: background .12s, color .12s;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--aqua); border-color: var(--aqua); }
.btn.big { font-size: 20px; padding: 16px 30px; letter-spacing: -.01em; }
.btn.ghost { border-width: 1px; padding: 6px 12px; font-size: 14px; font-weight: 500; }
.btn.coffee { background: var(--mint); border-color: var(--mint); }
.btn.coffee:hover { background: var(--ink); border-color: var(--ink); color: var(--mint); }

/* Hero */
.hero { padding: 64px 0 56px; align-items: end; }
.hero .label { align-self: start; padding-top: 14px; }
.hero h1 {
  margin: 0; font-weight: 800; letter-spacing: -.055em;
  font-size: clamp(52px, 10vw, 128px); line-height: .86;
}
.hero h1 em { font-style: normal; color: var(--aqua); }

/* Filas numeradas */
.row { padding: 22px 0 28px; border-top: 1px solid var(--line); row-gap: 14px; }
.num { font-size: 56px; font-weight: 800; line-height: .9; letter-spacing: -.05em; color: var(--aqua); }
.row .label .kicker { display: block; margin-top: 8px; color: var(--ink); }

.drop {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  background: var(--aqua); color: #fff; padding: 28px; min-height: 200px; cursor: pointer;
  transition: background .15s;
}
.drop:hover { background: var(--aqua-dark); }
.drop.over { background: var(--ink); }
.drop .big { font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.drop .small { font-size: 13px; font-weight: 600; letter-spacing: .08em; margin-top: 10px; opacity: .85; }
.drop .plus { font-size: 96px; font-weight: 300; line-height: .7; transition: transform .2s; }
.drop:hover .plus { transform: rotate(90deg); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.count { margin-right: auto; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.count span { color: var(--muted); font-weight: 400; font-size: 15px; }

#list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 46vh; overflow: auto;
        border-top: 1px solid var(--hair); }
#list:empty { display: none; }
#list li { display: flex; align-items: center; gap: 14px; padding: 8px 2px; border-bottom: 1px solid var(--hair); background: var(--bg); }
#list li:hover { background: var(--aqua-soft); }
#list li.dragging { opacity: .35; }
#list li.target { box-shadow: inset 0 3px 0 var(--aqua); }
#list .handle { cursor: grab; color: var(--muted); user-select: none; letter-spacing: -2px; }
#list .n { width: 3.2ch; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
#list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list .tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--aqua-dark); width: 4ch; }
#list .size { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; min-width: 7ch; text-align: right; }
#list .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; }
#list .rm:hover { color: #fff; background: var(--danger); }

.actions { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.bar { flex: 1; min-width: 180px; height: 6px; background: var(--hair); overflow: hidden; display: none; }
.bar > div { height: 100%; width: 0; background: var(--aqua); transition: width .2s; }
.bar.indeterminate > div { width: 35% !important; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.status { min-height: 1.45em; color: var(--muted); margin-top: 12px; }
.status.err { color: var(--danger); font-weight: 600; }

/* Resultado */
.done { display: none; }
.done h2 { margin: 0; font-size: clamp(44px, 7vw, 88px); font-weight: 800; letter-spacing: -.055em; line-height: .9; }
.done h2 em { font-style: normal; color: var(--aqua); }
.done p { margin: 10px 0 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.done .btns { display: flex; gap: 12px; flex-wrap: wrap; }
.done .coffee-box { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--hair);
                    display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.done .coffee-box span { font-weight: 600; }
body.finished .done { display: grid; }
body.finished .work { display: none !important; }

/* Footer */
footer .grid { border-top: 3px solid var(--ink); padding-top: 20px; padding-bottom: 32px; font-size: 14px; }
footer .by { grid-column: 4 / -1; display: flex; align-items: center; gap: 8px; color: var(--muted); }
footer a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--aqua); }
.uq-logo { height: 18px; width: auto; }

/* Archivo único cargado */
.picked { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.picked:empty { display: none; }
.picked b { font-size: 18px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.picked span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Opciones */
.opt { display: grid; gap: 10px; margin-bottom: 18px; }
.opt:last-child { margin-bottom: 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 2px solid var(--ink); width: fit-content; max-width: 100%; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 16px; font-weight: 600; font-size: 15px; border-right: 2px solid var(--ink); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--aqua); outline-offset: -3px; }
.seg label:hover input:not(:checked) + span { background: var(--aqua-soft); }
.field { font: inherit; font-size: 18px; padding: 10px 12px; border: 2px solid var(--ink); background: var(--paper);
         border-radius: 0; width: 100%; max-width: 420px; }
.field:focus { outline: 3px solid var(--aqua); outline-offset: 0; }
.hint { font-size: 14px; color: var(--muted); }
.range { width: 100%; max-width: 420px; accent-color: var(--aqua); }

/* Miniaturas (organizar) */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 16px; margin-top: 14px; }
.thumbs:empty { display: none; }
.thumb { position: relative; background: var(--paper); border: 1px solid var(--hair); padding: 8px 8px 6px; cursor: grab; }
.thumb.dragging { opacity: .35; }
.thumb.target { outline: 3px solid var(--aqua); }
.thumb .pic { height: 140px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb canvas { max-width: 100%; max-height: 132px; box-shadow: 0 0 0 1px var(--hair); transition: transform .2s; background: #fff; }
.thumb .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.thumb .meta b { font-variant-numeric: tabular-nums; }
.thumb .meta button { border: 0; background: none; cursor: pointer; font-size: 16px; padding: 2px 6px; color: var(--muted); }
.thumb .meta button:hover { background: var(--ink); color: #fff; }
.thumb .meta .del:hover { background: var(--danger); }
.thumb.off { opacity: .3; }
.thumb.off .pic { filter: grayscale(1); }

@media (max-width: 760px) {
  .nav { gap: 16px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .thumbs { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .label, .body, .brand, header .cafecito, footer .by { grid-column: 1 / -1; }
  header .grid { grid-template-columns: 1fr auto; }
  .brand { grid-column: 1; } header .cafecito { grid-column: 2; }
  .hero { padding: 40px 0 36px; row-gap: 12px; }
  .hero .label { padding-top: 0; }
  .row .label { display: flex; align-items: baseline; gap: 12px; }
  .num { font-size: 40px; }
  .drop { min-height: 150px; padding: 20px; }
  .drop .plus { font-size: 64px; }
  #list .size { display: none; }
}

/* Lector de fotos */
.preview { margin-top: 14px; max-height: 320px; display: none; }
.preview img { max-width: 100%; max-height: 320px; display: block; box-shadow: 0 0 0 1px var(--hair); }
.textout { font: inherit; font-size: 16px; line-height: 1.5; width: 100%; min-height: 260px; padding: 14px;
           border: 2px solid var(--ink); background: var(--paper); border-radius: 0; resize: vertical; }
.textout:focus { outline: 3px solid var(--aqua); outline-offset: 0; }
.done .textout + .hint { margin: 8px 0 18px; }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
