:root {
  color-scheme: light;
  font-family: "Instrument Sans", system-ui, sans-serif;
  color: #192a33;
  background: #f3f6f7;
  --line: #d9e3e6;
  --muted: #4d636d;
  --teal: #08695d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select {
  border: 1px solid #cddbdd;
  border-radius: .55rem;
  background: white;
  color: #20353f;
  padding: .6rem .82rem;
  font-weight: 650;
}
button { cursor: pointer; }
button:hover:not(:disabled) { filter: brightness(.96); }
button:disabled { opacity: .53; cursor: default; }
:focus-visible { outline: 3px solid #08786f; outline-offset: 2px; }
.top {
  background: #132d35;
  color: white;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
  padding: .9rem max(1rem, calc((100% - 1120px) / 2));
}
.brand, .connection { display: flex; align-items: center; gap: .65rem; }
.brand { font-size: 1.05rem; font-weight: 750; white-space: nowrap; }
.brand-icon { background: #8de1cb; color: #132d35; border-radius: .55rem; padding: .15rem .48rem; font-size: 1.38rem; }
.connection { font-size: .84rem; color: #e4eff0; }
.indicator { width: .55rem; height: .55rem; background: #a6b7bf; border-radius: 50%; }
.indicator.online { background: #8de1cb; }
main { max-width: 1152px; margin: auto; padding: 1.85rem 1rem 2rem; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.05rem); letter-spacing: -.055em; line-height: 1.04; margin-bottom: .5rem; }
h2 { font-size: 1.12rem; letter-spacing: -.02em; }
p { color: var(--muted); }
.controls label { display: block; font-size: .8rem; font-weight: 750; margin-bottom: .35rem; }
.control-row, .actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.primary { background: var(--teal); color: white; border-color: var(--teal); }
.primary span { margin-right: .27rem; font-size: .74rem; }
.danger { color: #922d29; border-color: #e4b5b1; background: #fff5f4; }
.wifi-help { margin: -.35rem 0 1rem; padding: .75rem .9rem; background: #e0efec; border-radius: .65rem; }
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: .9rem; overflow: hidden; box-shadow: 0 2px 5px #132d3509; }
.panel-head { padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.panel-head p { margin-top: .24rem; font-size: .85rem; }
.work-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.actions button { font-size: .8rem; padding: .45rem .62rem; }
.palette { padding: .65rem .8rem .85rem; display: grid; gap: .65rem; }
.group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .32rem; }
.group h3 { grid-column: 1 / -1; margin: 0 0 .06rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.group button { font-size: .77rem; padding: .34rem .38rem; text-align: left; line-height: 1.17; min-height: 2.12rem; cursor: grab; }
.block { border: 1px solid var(--edge); background: var(--fill); color: var(--ink); border-radius: .48rem; }
.vol { --edge: #a9d8c9; --fill: #def4ec; --ink: #175449; }
.moviment { --edge: #acd2ed; --fill: #e4f2fe; --ink: #1d5073; }
.gir { --edge: #cfc4eb; --fill: #f0eafa; --ink: #563c80; }
.temps { --edge: #ead299; --fill: #fff1d0; --ink: #705212; }
.symbol { display: inline-block; font-weight: 800; margin-right: .27rem; }
.board {
  min-height: 414px;
  padding: .8rem clamp(.55rem, 3vw, 1.5rem);
  background: radial-gradient(#cbd9dc 1px, transparent 1px) 0 0 / 17px 17px, #f7fafb;
}
#program { margin: 0 auto; padding: 0; max-width: 620px; list-style: none; }
.program-row { position: relative; display: flex; align-items: center; gap: .55rem; margin-bottom: .43rem; }
.block-number { font-variant-numeric: tabular-nums; width: 1.25rem; text-align: right; flex: none; font-size: .75rem; font-weight: 720; color: #4e656f; }
.program-row .block { display: flex; align-items: center; flex: 1; flex-wrap: wrap; gap: .4rem; padding: .38rem .5rem; border-left-width: 4px; min-width: 0; }
.program-row.active .block { outline: 3px solid #08786f; outline-offset: 1px; }
.handle, .row-action { padding: .22rem .3rem; font-size: .84rem; min-width: 1.6rem; }
.handle { cursor: grab; }
.block-label { font-size: .87rem; font-weight: 700; margin-right: auto; }
.param { display: flex; align-items: center; gap: .25rem; font-size: .83rem; }
.param input { width: 4.1rem; padding: .3rem; border: 1px solid var(--edge); border-radius: .34rem; color: #192a33; }
.row-actions { display: flex; gap: .15rem; }
.empty { text-align: center; padding: 2rem .65rem; border: 2px dashed #a9bfc4; border-radius: .65rem; background: #f7fafb; color: #36535d; font-size: .9rem; margin: .5rem 0; }
.drop-before::before, .drop-end::after { content: ""; display: block; background: #08786f; height: 3px; border-radius: 4px; }
.drop-before::before { position: absolute; top: -.31rem; left: 1.78rem; right: 0; }
.drop-end::after { max-width: 620px; margin: 0 auto; }
.results { margin-top: 1rem; }
.count { font-size: .79rem; color: #3e565f; background: #ecf3f4; padding: .33rem .6rem; border-radius: 99px; }
#log { list-style: none; margin: 0; padding: 0 .95rem; max-height: 10rem; overflow: auto; font-size: .83rem; }
#log:not(:empty) { padding-top: .5rem; padding-bottom: .5rem; }
#log li { padding: .2rem 0; }
#error { color: #922d29; padding: .6rem .95rem; background: #fff5f4; font-size: .85rem; }
@media (max-width: 690px) {
  main { padding-top: 1.3rem; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .palette { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); align-items: start; }
  .board { min-height: 250px; }
}

main { max-width: 1480px; }
.simulation { position: sticky; top: 1rem; }
#flight-view { display: block; width: 100%; aspect-ratio: 1.05; background: #f7fafb; }
#flight-readout { padding: .7rem 1rem; font-size: .85rem; font-variant-numeric: tabular-nums; }
.simulation-note { padding: 0 1rem 1rem; font-size: .78rem; }
@media (max-width: 1120px) {
  .simulation { grid-column: 1 / -1; position: static; }
  #flight-view { max-height: 460px; aspect-ratio: auto; }
}
@media (max-width: 690px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  .simulation { grid-column: auto; }
}

.view-controls { display: flex; gap: .35rem; flex-wrap: wrap; padding: .75rem 1rem .4rem; }
.view-controls button { font-size: .78rem; padding: .4rem .55rem; }
.view-controls [aria-pressed="true"] { background: #08695d; color: white; border-color: #08695d; }
.view-help { padding: 0 1rem .7rem; font-size: .77rem; }
#flight-view { touch-action: none; cursor: grab; }
#flight-view.dragging { cursor: grabbing; }

body { padding-bottom: 4rem; }
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: .7rem 1rem;
  text-align: center;
  font-size: .82rem;
  color: #e4eff0;
  background: #132d35;
}

.layout { grid-template-columns: minmax(180px, .5fr) minmax(280px, .85fr) minmax(360px, 1.5fr); }
.hero select { margin: .25rem 0 .65rem; }
#progress { font-weight: 700; }
.simulation-head { flex-wrap: wrap; }
.simulation-head .actions { flex-wrap: wrap; }
#flight-view { height: clamp(320px, 48vh, 580px); aspect-ratio: auto; }
#progress-error, .pad-data, .feedback { margin: .65rem 1rem; }
.pad-data summary { cursor: pointer; font-weight: 650; }
.pad-data p { margin-top: .4rem; font-size: .82rem; }
.pad-table { overflow-x: auto; }
.pad-data table { width: 100%; border-collapse: collapse; font-size: .8rem; white-space: nowrap; }
.pad-data th, .pad-data td { text-align: left; padding: .4rem; border-bottom: 1px solid #dbe5e8; }
.feedback { padding: .85rem; background: #e8f5f1; border-radius: .65rem; }
.feedback button { margin-top: .5rem; }
body.simulator-expanded { overflow: hidden; }
.simulation.expanded { position: fixed; inset: .6rem; z-index: 20; overflow: auto; box-shadow: 0 0 0 100vmax #10232ca6; }
.simulation.expanded #flight-view { height: max(280px, calc(100dvh - 240px)); max-height: none; }
@media (max-width: 1120px) {
  .layout { grid-template-columns: minmax(180px, .55fr) minmax(0, 1fr); }
}
@media (max-width: 690px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
#status { margin: .65rem 1rem; font-size: .85rem; }

.block.càrrega {
  background: #f4e6d2;
  color: #573815;
}
