/* Estilos propios de la calculadora (el tema base está en /tema.css) */
.intro { padding: 3rem 0 2rem; max-width: 62ch; }
.intro h1 { font-stretch: 112%; font-weight: 850; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 1rem; }
.intro p { margin: 0; color: var(--ink-2); font-size: 1.08rem; }

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

form { background: var(--paper-2); border: 2px solid var(--ink); border-radius: 6px; padding: 1.4rem; position: sticky; top: 80px; }
@media (max-width: 860px) { form { position: static; } }
label { display: block; font-weight: 700; margin: 0 0 .35rem; }
label .opt { font-weight: 400; color: var(--ink-3); }
input {
  width: 100%; padding: .75rem .8rem; font: 600 1.05rem var(--mono); color: var(--ink);
  background: var(--paper); border: 2px solid var(--line); border-radius: 4px;
}
input:focus { border-color: var(--net); outline: none; box-shadow: 0 0 0 3px rgba(36,71,201,.18); }
input + label, .hint + label { margin-top: 1.1rem; }
.hint { font-size: .85rem; color: var(--ink-3); margin: .4rem 0 0; }
form .btn { width: 100%; margin-top: 1.25rem; font-size: 1.02rem; }
.examples { margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .4rem; }
.examples p { width: 100%; margin: 0 0 .2rem; font-size: .88rem; color: var(--ink-2); }
.ex { font: .82rem var(--mono); padding: .28rem .55rem; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 3px; cursor: pointer; }
.ex:hover { border-color: var(--net); color: var(--net); }
code { font-family: var(--mono); font-size: .9em; }

/* ---------- Resultado ---------- */
#out { min-width: 0; }
.empty { border: 2px dashed var(--line); border-radius: 6px; padding: 2rem 1.5rem; color: var(--ink-3); }
.empty p { margin: 1.25rem 0 0; }

.card { background: var(--paper-2); border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.card-top { padding: 1.4rem 1.5rem 1.25rem; border-bottom: 2px solid var(--ink); }
.addr { font: 600 clamp(1.5rem, 3.6vw, 2.2rem) var(--mono); letter-spacing: -.02em; margin: 0; overflow-wrap: anywhere; }
.addr span { color: var(--net); }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .65rem 0 1.25rem; }
.badge { font-size: .85rem; font-weight: 600; padding: .18rem .6rem; border-radius: 3px; background: var(--paper); border: 1.5px solid var(--line); }
.badge.k { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Barra de 32 bits: la pieza central */
.bitbar { display: grid; grid-template-columns: repeat(32, 1fr); gap: 2px; }
.bitbar i {
  font: 600 .72rem/1 var(--mono); font-style: normal; text-align: center; padding: .5rem 0;
  border-radius: 2px; background: var(--net); color: #fff;
}
.bitbar i.h { background: var(--host); color: var(--ink); }
.bitbar i:nth-child(8n):not(:last-child) { margin-right: 5px; }
.bitbar.idle { height: 30px; }
.bitbar.idle::before { content: ""; grid-column: 1 / -1; background: repeating-linear-gradient(90deg, var(--line) 0 calc(3.125% - 2px), transparent calc(3.125% - 2px) 3.125%); border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: .65rem; font-size: .88rem; color: var(--ink-2); }
.legend b { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; vertical-align: -1px; margin-right: .35rem; background: var(--net); }
.legend .h b { background: var(--host); }
@media (max-width: 560px) { .bitbar i { font-size: 0; padding: .55rem 0; } .bitbar i:nth-child(8n):not(:last-child) { margin-right: 3px; } }
@media (prefers-reduced-motion: no-preference) {
  .bitbar:not(.idle) i { animation: bit .32s ease-out both; animation-delay: calc(var(--n) * 12ms); }
  @keyframes bit { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
}

.res { width: 100%; border-collapse: collapse; }
.res th, .res td { text-align: left; padding: .7rem 1.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.res tr:last-child th, .res tr:last-child td { border-bottom: 0; }
.res th { width: 44%; font-weight: 500; color: var(--ink-2); }
.res td { font: 600 .98rem var(--mono); overflow-wrap: anywhere; }
.res tr.key td { color: var(--net); }

details { border-top: 2px solid var(--ink); }
summary { padding: .85rem 1.5rem; cursor: pointer; font-weight: 600; }
pre { margin: 0; padding: 0 1.5rem 1.1rem; font: .9rem/1.8 var(--mono); overflow-x: auto; }
.nota { margin: 0; padding: 1rem 1.5rem 1rem 2.8rem; background: #fff6dc; border-top: 2px solid var(--ink); color: #5a4300; font-size: .93rem; }
.nota li + li { margin-top: .3rem; }

.error { border: 2px solid var(--bad); background: var(--badbg); color: var(--bad); border-radius: 6px; padding: 1.1rem 1.3rem; }
.error b { display: block; margin-bottom: .2rem; }

/* ---------- Casos de prueba ---------- */
.tests-sec, .notes { margin-top: 4rem; padding-top: 2.5rem; border-top: 2px solid var(--ink); }
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.sec-head h2, .notes h2 { font-stretch: 110%; font-weight: 800; font-size: 1.7rem; letter-spacing: -.015em; margin: 0 0 .4rem; }
.sec-head p { margin: 0; color: var(--ink-2); max-width: 60ch; }

.tests { width: 100%; border-collapse: collapse; background: var(--paper-2); border: 2px solid var(--ink); font-size: .9rem; }
.tests th, .tests td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tests thead th { background: var(--ink); color: var(--paper); font-weight: 600; }
button.link { background: none; border: 0; padding: 0; font: 600 .88rem var(--mono); color: var(--net); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.pass, .fail { font-weight: 700; white-space: nowrap; }
.pass { color: var(--ok); } .fail { color: var(--bad); }
.pass::before { content: "✓ "; } .fail::before { content: "✕ "; }
.summary-ok { margin: 0 0 .75rem; font-weight: 700; color: var(--ok); }
.summary-bad { margin: 0 0 .75rem; font-weight: 700; color: var(--bad); }
@media (max-width: 680px) {
  .tests, .tests tbody, .tests tr, .tests td { display: block; }
  .tests thead { display: none; }
  .tests tr { border-bottom: 1px solid var(--line); padding: .6rem .9rem; }
  .tests td { border: 0; padding: .12rem 0; }
}

/* ---------- Notas ---------- */
.notes { margin-bottom: 3rem; }
.notes dl { display: grid; grid-template-columns: 200px 1fr; margin: 1.25rem 0 0; }
.notes dt, .notes dd { margin: 0; padding: .85rem 0; border-top: 1px solid var(--line); }
.notes dt { font: 600 .95rem var(--mono); color: var(--net); }
.notes dd { color: var(--ink-2); }
@media (max-width: 620px) { .notes dl { grid-template-columns: 1fr; } .notes dd { border-top: 0; padding-top: 0; } }
