/* D64 Disk Transfer: app-specific styles (shared styles: /assets/css/site.css) */

:root {
  --c64-blue: #40318d;
  --c64-light: #7869c4;
  --map-bg: #1e1e1e;
  --ok: #56ac4d;
  --verified: #a9ff9f;
  --busy: #edf171;
  --error: #e0565b;
  --danger: #b3261e;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem 1.5rem;
  align-items: start;
}
.app-head, .banner { grid-column: 1 / -1; }
.app-head { max-width: 72ch; }
.app-head h1 { margin: 0 0 0.35rem; font-size: 2rem; color: var(--brand); }
.app-head p { margin: 0; color: var(--ink-soft); }

.banner {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #fdecea;
  border-left: 4px solid var(--danger);
  border-radius: 4px;
  color: #7a1c1c;
  font-weight: 700;
}

/* ---------- Buttons and fields ---------- */

.btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c5c8d4;
  border-radius: 5px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--c64-light); background: #f3f1fd; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { color: #fff; background: var(--c64-blue); border-color: var(--c64-blue); }
.btn-primary:hover:not(:disabled) { background: #35287a; border-color: #35287a; }
.btn-wide { width: 100%; }

.field { margin: 0 0 0.85rem; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { display: block; margin-bottom: 0.3rem; font-size: 0.875rem; font-weight: 700; padding: 0; }
.field select, .field input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #c5c8d4;
  border-radius: 5px;
}
.field select:disabled, .field input:disabled { color: var(--ink-soft); background: #f1f1f5; }
.field-row { display: grid; grid-template-columns: 1fr 6rem; gap: 0.75rem; }
.field-note { margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--ink-soft); }
fieldset.field .choice { display: inline-flex; margin-right: 1.25rem; }
.choice { display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.6rem; font-size: 0.9375rem; cursor: pointer; }
.petscii-input { text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Panels ---------- */

.work, .side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1.1rem;
  min-width: 0;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1.0625rem; color: var(--brand); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.panel-head h2 { margin: 0; }

/* ---------- Tabs ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 2px solid var(--line); margin: -0.25rem 0 1rem; }
.tabs [role="tab"] {
  font: inherit;
  font-weight: 700;
  color: var(--ink-soft);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--c64-blue); border-bottom-color: var(--c64-blue); }
.tabs [role="tab"]:hover { color: var(--ink); }
.pane-intro { margin: 0 0 1rem; color: var(--ink-soft); }
.task-btn { margin-top: 0.4rem; }

.drop {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px dashed #b9bccb;
  border-radius: var(--radius);
  cursor: pointer;
}
.drop:hover, .drop.dragging { border-color: var(--c64-light); background: #f3f1fd; }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop span { font-size: 0.9375rem; color: var(--ink-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ---------- Progress ---------- */

.activity { margin: 0 0 0.4rem; font-weight: 700; }
.activity.error { color: var(--danger); }
.stats { min-height: 1.4em; margin-bottom: 0.75rem; font-size: 0.9375rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.map-scroll { overflow-x: auto; background: var(--map-bg); border-radius: 6px; padding: 0.6rem; }
.disk-map {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: auto repeat(21, auto);
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  min-width: 520px;
}
.map-track { font-size: 0.625rem; color: #8a8a8a; text-align: center; line-height: 1.4; }
.cell { display: block; aspect-ratio: 1; min-width: 8px; border-radius: 1px; background: #4c4c4c; }
.cell.none { background: transparent; }
.cell.skip { background: #2a2a2a; outline: 1px solid #333; outline-offset: -1px; }
.cell.busy { background: var(--busy); }
.cell.ok { background: var(--ok); }
.cell.verified { background: var(--verified); }
.cell.error { background: var(--error); }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; list-style: none; margin: 0.75rem 0 0; padding: 0; font-size: 0.875rem; color: var(--ink-soft); }
.map-legend li { display: flex; align-items: center; gap: 0.4rem; }
.map-legend .cell { width: 12px; }

/* ---------- Result and directory ---------- */

.c64 {
  container-type: inline-size;
  background: var(--c64-blue);
  border: clamp(10px, 3vw, 20px) solid var(--c64-light);
  padding: 0.6rem 0;
  margin: 1rem 0;
  max-height: 420px;
  overflow: auto;
  font-family: "Press Start 2P", monospace;
  color: var(--c64-light);
}
.c64-line {
  padding: 0.2em 0.6em;
  font-size: clamp(8px, 3.2cqi, 14px);
  line-height: 1.4;
  white-space: pre;
}
.c64 .reverse { background: var(--c64-light); color: var(--c64-blue); }
.result .c64 { margin-top: 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Adapter, drive, log ---------- */

.conn { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.85rem; font-weight: 700; }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: #b9bccb; flex: none; }
.conn.connected .dot { background: var(--ok); }
.conn.busy .dot { background: var(--busy); }
.drive-info { margin: 0 0 0.85rem; font-size: 0.9375rem; }
.drive-info small { display: block; color: var(--ink-soft); }

.log { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; font-size: 0.8125rem; }
.log li { padding: 0.2rem 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 0.4rem; }
.log li.error { color: var(--danger); }
.log:empty::before { content: "Nothing yet."; color: var(--ink-soft); }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  /* connect first, then work, log last */
  .side { display: contents; }
  .app-head, .banner { order: -2; }
  .side .panel { order: -1; }
  .side .panel.log-panel { order: 1; }
  .app-head h1 { font-size: 1.6rem; }
}
