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

body {
  font-family: system-ui, sans-serif;
  background: #f5f5f0;
  color: #1a1a18;
  padding: 1.5rem;
}

h1 { font-size: 20px; font-weight: 500; margin-bottom: 1.25rem; }

.tabs { display: flex; gap: 6px; margin-bottom: 1.25rem; flex-wrap: wrap; }

.tab {
  padding: 6px 14px;
  border-radius: 8px;
  border: 0.5px solid #bbb;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}

.tab.active { background: #e8e8e0; color: #1a1a18; border-color: #888; }

.panel { display: none; }
.panel.active { display: block; }

.vis-area { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 1rem; }

.lanes { flex: 1; display: flex; flex-direction: column; gap: 8px; }

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

.lane-label {
  width: 64px;
  font-size: 12px;
  color: #666;
  flex-shrink: 0;
  text-align: right;
}

.lane-track {
  flex: 1;
  height: 32px;
  background: #e8e8e0;
  border-radius: 6px;
  position: relative;
  border: 0.5px solid #ccc;
  overflow: hidden;
}

.thread-block {
  position: absolute;
  height: 100%;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  transition: left .35s cubic-bezier(.4,0,.2,1), width .35s, background .3s, opacity .3s;
}

.t1-color { background: #B5D4F4; color: #0C447C; }
.t2-color { background: #9FE1CB; color: #085041; }
.t3-color { background: #F5C4B3; color: #712B13; }

.waiting-stripe {
  background: repeating-linear-gradient(
    45deg,
    #D3D1C7 0px, #D3D1C7 4px,
    #F1EFE8 4px, #F1EFE8 8px
  ) !important;
  color: #444 !important;
}

.resource-box {
  width: 120px;
  border: 0.5px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  flex-shrink: 0;
}

.res-title { font-size: 11px; color: #666; margin-bottom: 6px; }
.res-val { font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.res-bar { height: 4px; border-radius: 2px; background: #ddd; overflow: hidden; }
.res-fill { height: 100%; border-radius: 2px; transition: width .4s, background .3s; }

.lock-icon { font-size: 22px; text-align: center; margin-bottom: 4px; line-height: 1; }

.timeline {
  position: relative;
  height: 8px;
  background: #e8e8e0;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 0.5px solid #ccc;
}

.timeline-head {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 12px;
  background: #888;
  border-radius: 2px;
  transition: left .35s linear;
}

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 1rem; }

.btn {
  padding: 5px 14px;
  border-radius: 8px;
  border: 0.5px solid #bbb;
  background: transparent;
  color: #1a1a18;
  cursor: pointer;
  font-size: 12px;
  transition: background .15s;
}

.btn:hover { background: #e8e8e0; }
.btn.primary { background: #e8e8e0; border-color: #888; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #666; }
.leg-swatch { width: 12px; height: 12px; border-radius: 3px; }

.log {
  background: #e8e8e0;
  border-radius: 8px;
  border: 0.5px solid #ccc;
  padding: 8px 10px;
  height: 90px;
  overflow-y: auto;
  font-size: 11px;
  font-family: monospace;
  color: #666;
  line-height: 1.6;
}

.log-entry { animation: fadeIn .2s ease; }
.log-entry.t1 { color: #185FA5; }
.log-entry.t2 { color: #0F6E56; }
.log-entry.t3 { color: #993C1D; }
.log-entry.sys { color: #999; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.info-box {
  background: #e8e8e0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #555;
  line-height: 1.6;
  border-left: 2px solid #bbb;
  margin-bottom: 12px;
}

.speed-wrap { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #666; }

/* Buffer slots (Monitor panel) */
.buf-slot {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 0.5px solid #ccc;
  background: #e8e8e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .3s;
}

.monitor-conds { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

.cond-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cond-queue { display: flex; gap: 3px; }

.cond-thread {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body { background: #1a1a18; color: #e0dfd8; }
  .tab { border-color: #444; color: #aaa; }
  .tab.active { background: #2a2a28; color: #e0dfd8; border-color: #666; }
  .lane-track, .timeline, .log { background: #2a2a28; border-color: #444; }
  .resource-box { background: #222220; border-color: #444; }
  .info-box { background: #2a2a28; border-color: #555; color: #aaa; }
  .btn { border-color: #444; color: #e0dfd8; }
  .btn:hover, .btn.primary { background: #2a2a28; }
  .res-bar { background: #444; }
  .buf-slot { background: #2a2a28; border-color: #444; }
}
