:root {
  --bg: #0d0f0c;
  --panel: #16211a;
  --panel-2: #1d2c22;
  --border: #2f4a38;
  --green: #4dff7c;
  --green-dim: #2a8a44;
  --amber: #ffb347;
  --text: #cfe8d4;
  --text-dim: #7fae8c;
  --beige: #c9c0a8;
  --beige-dark: #8a8266;
}

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

body {
  background:
    radial-gradient(ellipse at top, #14201a 0%, #0a0d09 70%),
    var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  min-height: 100vh;
  padding: 16px;
}

.coco-shell { max-width: 1200px; margin: 0 auto; }

/* Header */
.coco-header {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, #d8cfb4 0%, #b3aa8c 100%);
  border: 3px solid #6e6650;
  border-radius: 14px 14px 4px 4px;
  padding: 14px 22px;
  box-shadow: inset 0 2px 6px rgba(255,255,255,.4), 0 6px 20px rgba(0,0,0,.5);
  margin-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.berry { font-size: 34px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.coco-header h1 {
  font-family: 'VT323', monospace; font-size: 30px; letter-spacing: 1px;
  color: #2a2618; line-height: 1;
}
.coco-header p { font-size: 11px; color: #5a5340; margin-top: 3px; letter-spacing: .5px; }
.tandy-badge {
  font-family: 'VT323', monospace; font-size: 26px; font-weight: bold;
  color: #7a0f0f; background: #e8e0c8;
  border: 2px solid #7a0f0f; border-radius: 6px; padding: 2px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Body grid */
.coco-body { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
@media (max-width: 900px) { .coco-body { grid-template-columns: 1fr; } }

.col-main, .col-side { display: flex; flex-direction: column; gap: 14px; }

/* CRT */
.crt-frame {
  position: relative;
  background: #05070a;
  border: 14px solid #2a2820;
  border-radius: 22px;
  padding: 10px;
  box-shadow:
    inset 0 0 40px rgba(0,0,0,.9),
    0 8px 30px rgba(0,0,0,.6);
}
.crt-canvas {
  width: 100%; height: auto; display: block;
  border-radius: 8px;
  image-rendering: pixelated;
  box-shadow: 0 0 30px rgba(77,255,124,.25), inset 0 0 60px rgba(0,0,0,.7);
  filter: saturate(1.1) contrast(1.05);
}
.crt-scanlines {
  position: absolute; inset: 10px;
  border-radius: 8px; pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(0,0,0,.16) 0px, rgba(0,0,0,.16) 1px, transparent 2px, transparent 4px);
  mix-blend-mode: multiply;
}

/* LED strip */
.led-strip {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  background: #0a120d; border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 12px;
}
.led { font-weight: 700; color: var(--text-dim); font-family: 'VT323', monospace; font-size: 18px; }
.led.on { color: var(--green); text-shadow: 0 0 8px var(--green); }
.led-info { color: var(--text-dim); font-size: 11px; letter-spacing: .5px; }

/* Panels */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.panel h3 {
  font-family: 'VT323', monospace; font-size: 20px; color: var(--green);
  letter-spacing: 1px; margin-bottom: 10px;
  border-bottom: 1px dashed var(--border); padding-bottom: 6px;
}
.hint { font-size: 11px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.4; }

/* Buttons */
.coco-btn {
  font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 12px;
  background: #21332a; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; cursor: pointer; letter-spacing: .5px;
  transition: all .12s;
}
.coco-btn:hover { background: #2b4436; transform: translateY(-1px); }
.coco-btn:active { transform: translateY(1px); }
.coco-btn.go { background: #1c4a2c; border-color: var(--green-dim); color: var(--green); }
.coco-btn.go:hover { background: #256238; box-shadow: 0 0 10px rgba(77,255,124,.3); }
.coco-btn.accent { background: #4a1c1c; border-color: #a33; color: #ff9b9b; }
.coco-btn.accent:hover { background: #5e2323; }
.coco-btn.small { padding: 5px 9px; font-size: 11px; }
.coco-btn.full { width: 100%; margin-top: 10px; }

.controls-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sel-lbl { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.coco-sel {
  background: #0a120d; color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 5px 8px; font-family: inherit; font-size: 12px;
}

/* Registers */
.reg-panel { }
.reg-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.reg {
  background: #0a120d; border: 1px solid var(--border); border-radius: 5px;
  padding: 6px 10px; display: flex; flex-direction: column; align-items: center; min-width: 54px;
}
.reg.wide { min-width: 120px; }
.rn { font-size: 10px; color: var(--text-dim); letter-spacing: 1px; }
.rv { font-family: 'VT323', monospace; font-size: 20px; color: var(--amber); text-shadow: 0 0 6px rgba(255,179,71,.4); }

/* File loader */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 18px; text-align: center; font-size: 12px; color: var(--text-dim);
  transition: all .15s; margin-bottom: 8px;
}
.drop-zone.drag { border-color: var(--green); background: rgba(77,255,124,.08); color: var(--green); }
.file-link { color: var(--green); cursor: pointer; text-decoration: underline; }
.file-link.block { display: inline-block; padding: 8px 14px; background: #1c4a2c; border-radius: 6px; text-decoration: none; }
.file-suggest { font-size: 10px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.5; opacity: .8; }
.empty { font-size: 11px; color: var(--text-dim); font-style: italic; }

.file-row {
  background: #0a120d; border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 8px;
}
.file-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fname { font-size: 12px; color: var(--text); font-weight: 600; word-break: break-all; }
.fsize { font-size: 10px; color: var(--text-dim); }
.loaded-tag { color: var(--green); font-weight: 700; margin-left: auto; }
.file-ctrls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dollar { color: var(--amber); font-weight: 700; }
.addr-in {
  width: 60px; background: #060a07; border: 1px solid var(--border);
  color: var(--amber); font-family: 'VT323', monospace; font-size: 18px;
  padding: 2px 6px; border-radius: 4px; text-align: center; text-transform: uppercase;
}
.rom-chk { font-size: 10px; color: var(--text-dim); display: flex; align-items: center; gap: 3px; }

/* Cassette */
.cassette { border-color: #4a3a1c; }
.cassette h3 { color: var(--amber); }
.cass-info { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--text); }

/* Inspector */
.inspect-row { display: flex; align-items: center; gap: 8px; }
.hexdump {
  margin-top: 10px; background: #060a07; border: 1px solid var(--border);
  border-radius: 6px; padding: 10px; font-size: 11px; color: var(--green-dim);
  overflow-x: auto; white-space: pre; line-height: 1.5;
}

/* I/O ref */
.io-ref table { width: 100%; border-collapse: collapse; font-size: 11px; }
.io-ref td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.io-ref td:first-child { color: var(--amber); font-family: 'VT323', monospace; font-size: 15px; white-space: nowrap; }
.io-ref td:last-child { color: var(--text-dim); }

/* Footer */
.coco-footer {
  margin-top: 20px; display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--text-dim);
  border-top: 1px solid var(--border); padding-top: 14px;
}
.coco-footer a { color: var(--green); text-decoration: none; font-weight: 600; }
.coco-footer a:hover { text-decoration: underline; text-shadow: 0 0 6px var(--green); }