/* ZTUNE program simulator — layout is a fixed 1280x800 "window" scaled to fit (see fit() in app.js) */
:root {
  --o: #ff6b00;
  --o2: #ff8c00;
  --ink: #111;
  --line: #e4e4e7;
  --muted: #71717a;
  --blk: #0a0a0a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: transparent;
  font-family: Inter,system-ui,sans-serif;
  overflow: hidden;
}

#fit {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#holder {
  position: relative;
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 800px;
  transform-origin: 0 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px -25px rgba(255,107,0,.45),0 0 0 1px rgba(0,0,0,.12);
  background: #fff;
  user-select: none;
}

#caption {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

#caption .n {
  background: var(--o);
  color: #fff;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

#caption .dots {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}

#caption .dots i {
  width: 6px;
  height: 6px;
  border-radius: 9px;
  background: #e4e4e7;
}

#caption .dots i.on {
  background: var(--o);
}

/* window */
.titlebar {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 12px;
  color: #222;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.titlebar .t {
  display: flex;
  align-items: center;
  gap: 8px;
}

.titlebar .ico {
  width: 14px;
  height: 14px;
  background: #111;
  border-radius: 2px;
}

.titlebar .w {
  display: flex;
  gap: 22px;
  color: #444;
  font-size: 13px;
}

.app {
  display: flex;
  height: 770px;
}

/* sidebar */
.side {
  width: 236px;
  background: var(--blk);
  color: #f4f4f5;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
}

.side .logo {
  height: 52px;
  object-fit: contain;
  object-position: left;
  margin: 0 0 18px 4px;
}

.side .lbl {
  font-size: 10.5px;
  letter-spacing: .08em;
  color: #8a8a8a;
  margin: 0 0 10px 6px;
}

.brands {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.brands-inner {
  transition: transform .5s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-radius: 12px;
  cursor: default;
  transition: background .2s;
}

.brand.active {
  background: #1c1c1c;
}

.bico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.02em;
  flex: none;
  box-shadow: 0 0 0 3px #222;
}

.brand .nm {
  flex: 1;
  font-size: 14px;
}

.brand .ch {
  color: #888;
  font-size: 16px;
  transition: transform .25s;
}

.brand.active .ch {
  transform: rotate(90deg);
  color: var(--o);
}

.ecus {
  overflow: hidden;
  max-height: 0;
  transition: max-height .6s ease;
}

.ecus.open {
  max-height: 420px;
}

.ecu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 7px 26px;
  font-size: 13px;
  color: #d4d4d8;
  border-radius: 10px;
}

.ecu.sel {
  background: #1f1f1f;
  color: #fff;
  font-weight: 700;
}

.fb {
  font-size: 9px;
  font-weight: 800;
  border: 1.5px solid;
  border-radius: 999px;
  padding: 3px 8px;
  letter-spacing: .04em;
}

.fb.p {
  color: #ff7a1a;
  border-color: #ff7a1a;
}

.fb.d {
  color: #4f8cff;
  border-color: #4f8cff;
}

.sbar {
  position: absolute;
  right: 0;
  top: 4px;
  width: 4px;
  height: 60%;
  background: var(--o);
  border-radius: 4px;
  opacity: .9;
}

.filebox {
  margin-top: 12px;
  border: 1px solid #2a2a2a;
  background: #141414;
  border-radius: 12px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #8a8a8a;
  transition: all .3s;
  text-align: center;
  padding: 0 10px;
  position: relative;
  overflow: hidden;
}

.filebox.ready {
  border-color: var(--o);
  color: #fff;
  background: #1a120b;
}

.filebox.loaded {
  border-color: #333;
  color: var(--o);
  font-weight: 700;
  font-size: 13px;
}

.filebox .prog {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--o);
  width: 0;
  transition: width 1.1s linear;
}

/* main */
.main {
  flex: 1;
  padding: 16px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  min-width: 0;
}

.top {
  border: 1.5px solid #111;
  border-radius: 4px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
}

.top .ecuname {
  font-size: 19px;
  font-weight: 800;
  color: #111;
}

.top .sw {
  font-size: 11.5px;
  color: #666;
  margin-top: 2px;
}

.top .sw b {
  color: var(--o);
  font-weight: 600;
}

.btns {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  height: 42px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  background: #fff;
  transition: all .25s;
}

.btn.save {
  background: #e8e8e8;
  color: #aaa;
  border-color: #e8e8e8;
}

.btn.save.on {
  background: var(--o);
  color: #fff;
  border-color: var(--o);
  box-shadow: 0 6px 18px -6px rgba(255,107,0,.7);
}

.btn .tk {
  color: var(--o);
}

.h {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}

.h.or {
  color: var(--o);
  padding-bottom: 7px;
  border-bottom: 2px solid var(--o);
}

.tiles {
  display: flex;
  gap: 12px;
}

.tile {
  position: relative;
  width: 180px;
  height: 142px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  transition: transform .25s, box-shadow .25s, opacity .3s;
  opacity: .55;
}

.tile.en {
  opacity: 1;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile.sel {
  box-shadow: 0 0 0 3px var(--o),0 10px 24px -8px rgba(255,107,0,.8);
  transform: translateY(-3px);
}

.tile .badge {
  position: absolute;
  right: 8px;
  top: 8px;
  background: var(--o);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 9px;
  opacity: 0;
  transform: scale(.6);
  transition: all .25s;
}

.tile.sel .badge {
  opacity: 1;
  transform: scale(1);
}

.pop {
  position: absolute;
  z-index: 5;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
  padding: 12px;
  width: 230px;
  opacity: 0;
  transform: translateY(6px) scale(.97);
  pointer-events: none;
  transition: all .2s;
}

.pop.show {
  opacity: 1;
  transform: none;
}

.pop .pt {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pop .row {
  display: flex;
  gap: 8px;
}

.pop .sb {
  flex: 1;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 9px 0;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  transition: all .2s;
}

.pop .sb.on {
  background: var(--o);
  border-color: var(--o);
  color: #fff;
}

.maps {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
}

.map {
  height: 44px;
  background: #0d0d0d;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: opacity .3s;
}

.map.na {
  opacity: .35;
}

.map .l {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map .l::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 9px;
  background: #666;
}

.map.on .l::before {
  background: #22c55e;
}

.map .r {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: #888;
  font-weight: 600;
}

.sw2 {
  width: 50px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #fff;
  position: relative;
  transition: all .25s;
}

.sw2::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #555;
  transition: all .25s;
}

.map.on .sw2 {
  background: var(--o);
  border-color: var(--o);
}

.map.on .sw2::after {
  left: 25px;
  background: #fff;
}

.map.on .r {
  color: var(--o);
}

.dtchead {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dtcbtn {
  background: #111;
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: all .25s;
}

.dtcbtn.on {
  background: var(--o);
}

.dtcwrap {
  flex: 1;
  display: flex;
  gap: 18px;
  min-height: 0;
}

.dtc {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.dtc .empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-style: italic;
  font-size: 14px;
  transition: opacity .3s;
}

.dtc .srch {
  height: 34px;
  border: 1px solid #eee;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #aaa;
  font-size: 13px;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity .3s;
}

.dtc .th, .dtc .tr {
  display: grid;
  grid-template-columns: 34px 46px 30px 70px 1fr;
  align-items: center;
  font-size: 12.5px;
}

.dtc .th {
  color: #999;
  font-size: 10.5px;
  padding: 6px 8px;
  opacity: 0;
  transition: opacity .3s;
}

.dtc .tr {
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 5px;
  opacity: 0;
  transform: translateY(6px);
  transition: all .3s;
}

.dtc .tr.in {
  opacity: 1;
  transform: none;
}

.dtc .tr.pick {
  background: #fff4ec;
  border-color: #ffd2b0;
}

.dtc .tr.off {
  opacity: .45;
  text-decoration: line-through;
}

.cb {
  width: 15px;
  height: 15px;
  border: 1.5px solid #bbb;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  transition: all .2s;
}

.tr.pick .cb {
  background: var(--o);
  border-color: var(--o);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  transition: background .3s;
}

.tr.off .dot {
  background: #ef4444;
}

.code {
  color: var(--o);
  font-weight: 700;
}

.rp {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  flex: 1;
  padding: 6px 4px;
  font-size: 12px;
  color: #888;
  overflow: hidden;
}

.panel .pt {
  font-size: 10.5px;
  font-weight: 700;
  color: #111;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.panel .chip {
  display: inline-block;
  background: #fff4ec;
  color: var(--o);
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 8px;
  margin: 0 4px 6px 0;
  animation: pin .25s;
}

.log div {
  padding: 4px 0;
  border-bottom: 1px dashed #eee;
  color: #333;
  animation: pin .3s;
  display: flex;
  gap: 6px;
}

.log div span {
  color: #22c55e;
  font-weight: 700;
}

@keyframes pin {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.toast {
  position: absolute;
  right: 24px;
  bottom: 24px;
  background: #111;
  color: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  opacity: 0;
  transform: translateY(12px);
  transition: all .3s;
  z-index: 6;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast .ok {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
}

.spin {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sp .7s linear infinite;
  display: none;
}

.btn.busy .spin {
  display: inline-block;
}

@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}

/* cursor */
#cur {
  position: absolute;
  left: 640px;
  top: 420px;
  width: 26px;
  height: 26px;
  z-index: 20;
  transition: left .7s cubic-bezier(.45,.05,.25,1),top .7s cubic-bezier(.45,.05,.25,1);
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.35));
}

.ripple {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--o);
  z-index: 19;
  pointer-events: none;
  animation: rip .5s ease-out forwards;
}

@keyframes rip {
  from {
    transform: translate(-50%,-50%) scale(.4);
    opacity: 1;
  }
  to {
    transform: translate(-50%,-50%) scale(3.2);
    opacity: 0;
  }
}

#fade {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s;
  z-index: 30;
}
