:root{
  --bg:#0b1020;
  --text:#e7ecff;
  --muted:#a9b4da;
  --accent:#5ea1ff;
  --accent2:#7c5cff;
  --danger:#ff5e7a;
  --ok:#4fe3a6;
  --tile:#121d3f;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 700px at 20% 0%, #18285a 0%, var(--bg) 60%);
  color:var(--text);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background: rgba(10,15,32,.7);
  backdrop-filter: blur(8px);
  position:sticky;
  top:0;
  z-index:10;
}
.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:40px; height:40px; border-radius:12px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-weight:800;
}
.title{font-weight:700}
.subtitle{color:var(--muted); font-size:12px}

.actions{display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.sep{width:1px; height:22px; background:rgba(255,255,255,.12); margin:0 6px}

.btn{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:8px 10px;
  border-radius:12px;
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.1)}
.btn.primary{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border:0;
}
.btn.ghost{background:transparent}

.layout{
  display:grid;
  grid-template-columns: 260px 1fr 360px;
  gap:12px;
  padding:12px;
  height: calc(100vh - 72px);
}

.panel{
  background: rgba(15,23,48,.7);
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:12px;
  overflow:auto;
}
.panel h2{margin:6px 0 10px 0; font-size:14px; color:var(--muted); text-transform:uppercase; letter-spacing:.08em}
.panel h3{margin:0 0 8px 0; font-size:14px}

.palette{display:grid; gap:8px}
.tile{
  background: var(--tile);
  border:1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  color: var(--text);
  padding:10px;
  cursor:pointer;
  text-align:left;
}
.tile:hover{border-color: rgba(94,161,255,.7)}
.tips{color:var(--muted); font-size:13px; padding-left:18px}

.status{
  margin-top:12px;
  font-size:12px;
  color:var(--muted);
  padding:10px;
  border-radius:12px;
  background: rgba(0,0,0,.2);
  border:1px solid rgba(255,255,255,.06);
}

.canvasWrap{
  background: rgba(10,15,32,.35);
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.canvas{
  width:100%;
  height:100%;
  display:block;
  outline:none;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  touch-action: none;
}

.card{
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding:10px;
  margin-bottom:12px;
}

.row{display:flex; justify-content:space-between; gap:12px; padding:6px 0; align-items:center}
.label{color:var(--muted); font-size:12px}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size:12px}
.hint{color:var(--muted); font-size:12px; margin-bottom:8px}

.tableWrap{overflow:auto; max-height: 300px; border-radius:12px}
table{width:100%; border-collapse: collapse; font-size:12px}
th, td{border-bottom:1px solid rgba(255,255,255,.08); padding:6px 8px; text-align:center}
th{position:sticky; top:0; background: rgba(15,23,48,.9)}

.props .field{margin:8px 0}
.props label{display:block; font-size:12px; color:var(--muted); margin-bottom:4px}
.props input[type="text"], .props input[type="number"], .props select{
  width:100%;
  padding:8px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.props input[type="range"]{width:100%}
.props .small{font-size:12px; color:var(--muted)}

.tabs{display:flex; gap:6px; margin-bottom:10px}
.tab{
  flex:1;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color:var(--text);
  padding:8px;
  border-radius:12px;
  cursor:pointer;
  font-size:12px;
}
.tab.active{border-color: rgba(94,161,255,.7)}
.tabPanel.hidden{display:none}

.num{
  width:120px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:var(--text);
}

.timingWrap{
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  overflow:auto;
  max-height:320px;
  background: rgba(0,0,0,.12);
}

.kopWrap{
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  overflow:auto;
  max-height:320px;
  background: rgba(0,0,0,.12);
  padding:8px;
}

@media (max-width: 980px){
  .layout{
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: calc(100vh - 72px);
  }

  .panel.left{ order: 2; }
  .canvasWrap{ order: 1; min-height: 52vh; }
  .panel.right{ order: 3; }

  .actions{ gap:6px; }
  .sep{ display:none; }

  .btn{ padding:10px 12px; border-radius:14px; }
  .tile{ padding:12px; border-radius:14px; font-size:14px; }

  .tableWrap, .timingWrap, .kopWrap{ max-height: 44vh; }
  .panel{ padding:10px; }
}