/* =========================================================
   Leitura · TuxoLab — terracota + cimento
   ========================================================= */

:root {
  --terracota: #c0603a;
  --terracota-claro: #d9805c;
  --terracota-escuro: #97462a;

  --cimento-950: #191715;
  --cimento-900: #201e1c;
  --cimento-850: #262321;
  --cimento-800: #2e2a27;
  --cimento-700: #3a3532;
  --cimento-600: #4b4541;
  --cimento-400: #8b847d;
  --cimento-300: #a8a19a;
  --cimento-100: #e9e4dd;

  --erro: #d1584f;
  --ok: #6f9e63;

  --raio: 10px;
  --raio-sm: 7px;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.28);

  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(192, 96, 58, 0.14), transparent 60%),
    var(--cimento-950);
  color: var(--cimento-100);
  font-family: var(--fonte);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- topo ---------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cimento-700);
  background: rgba(32, 30, 28, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--terracota-claro), var(--terracota-escuro));
  position: relative;
  flex: none;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 6px 8px;
  border-radius: 2px;
  background: var(--cimento-100);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.2px;
}

.brand-text small {
  font-size: 11px;
  color: var(--cimento-400);
}

.tabs-main {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--cimento-850);
  border: 1px solid var(--cimento-700);
  border-radius: var(--raio);
}

.tab-main {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--cimento-300);
  font: inherit;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--raio-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-main:hover {
  color: var(--cimento-100);
}

.tab-main.is-active {
  background: var(--terracota);
  color: #fff;
}

.topbar-note {
  margin-left: auto;
  font-size: 12px;
  color: var(--cimento-400);
}

/* ---------------- layout ---------------- */

.main {
  padding: 18px;
}

.view-wallpaper {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(320px, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.col--stage {
  align-items: center;
  position: sticky;
  top: 78px;
}

@media (max-width: 1180px) {
  .view-wallpaper {
    grid-template-columns: 1fr 1fr;
  }
  .col--stage {
    grid-column: 1 / -1;
    order: -1;
    position: static;
  }
}

@media (max-width: 720px) {
  .view-wallpaper {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 12px;
  }
  .topbar-note {
    display: none;
  }
}

/* ---------------- cartões ---------------- */

.card {
  background: var(--cimento-900);
  border: 1px solid var(--cimento-700);
  border-radius: var(--raio);
  padding: 16px;
  box-shadow: var(--sombra);
}

.card--wide {
  max-width: 780px;
  margin: 0 auto;
}

.card--tabs {
  padding-top: 10px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--terracota-claro);
}

.card-sub {
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--cimento-300);
}

/* ---------------- campos ---------------- */

.field {
  margin-bottom: 13px;
  min-width: 0;
}

.field > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cimento-300);
  margin-bottom: 5px;
}

.val {
  font-variant-numeric: tabular-nums;
  color: var(--terracota-claro);
  font-weight: 700;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select,
textarea,
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--cimento-850);
  color: var(--cimento-100);
  border: 1px solid var(--cimento-600);
  border-radius: var(--raio-sm);
  font: inherit;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 62px;
}

select:focus-visible,
textarea:focus-visible,
input:focus-visible,
button:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--terracota-claro);
  outline-offset: 2px;
}

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--cimento-700);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--terracota);
  border: 2px solid var(--cimento-100);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--cimento-700);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--terracota);
  border: 2px solid var(--cimento-100);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--cimento-100);
  margin-bottom: 12px;
  cursor: pointer;
}

.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--terracota);
  cursor: pointer;
}

.field-hint {
  margin: -4px 0 12px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--cimento-400);
}

.field-hint strong {
  color: var(--cimento-300);
}

/* ---------------- botões ---------------- */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  border-radius: var(--raio-sm);
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid var(--cimento-600);
  background: var(--cimento-800);
  color: var(--cimento-100);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  background: var(--cimento-700);
  border-color: var(--cimento-400);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--terracota);
  border-color: var(--terracota);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--terracota-claro);
  border-color: var(--terracota-claro);
}

.btn--ghost {
  background: transparent;
}

.btn--mini {
  padding: 4px 10px;
  font-size: 12px;
}

.btn--block {
  width: 100%;
  margin-top: 4px;
}

/* ---------------- dropzone ---------------- */

.dropzone {
  display: block;
  text-align: center;
  padding: 20px 14px;
  border: 1.5px dashed var(--cimento-600);
  border-radius: var(--raio);
  background: var(--cimento-850);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 14px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--terracota);
  background: rgba(192, 96, 58, 0.09);
}

.dropzone-main {
  margin: 0 0 4px;
  font-weight: 600;
}

.dropzone-hint {
  margin: 0 0 10px;
  font-size: 11.5px;
  color: var(--cimento-400);
}

.file-input--hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ---------------- fila ---------------- */

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.queue-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--cimento-400);
}

.queue-actions {
  display: flex;
  gap: 6px;
}

.thumb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.thumb-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thumb {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  background: var(--cimento-850);
  border: 1px solid var(--cimento-700);
  border-radius: var(--raio-sm);
  color: var(--cimento-300);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.thumb:hover {
  border-color: var(--cimento-400);
}

.thumb.active {
  border-color: var(--terracota);
  background: rgba(192, 96, 58, 0.13);
  color: var(--cimento-100);
}

.thumb img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--cimento-700);
  flex: none;
}

.thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-order {
  flex: none;
  font-size: 10px;
  font-weight: 700;
  color: var(--cimento-400);
  min-width: 14px;
}

.thumb-remove {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--raio-sm);
  border: 1px solid var(--cimento-700);
  background: transparent;
  color: var(--cimento-400);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.thumb-remove:hover {
  color: var(--erro);
  border-color: var(--erro);
}

/* ---------------- abas internas ---------------- */

.tabs-sub {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--cimento-700);
  margin: 0 -16px 14px;
  padding: 0 10px;
}

.tab-sub {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--cimento-400);
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  padding: 8px 12px;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab-sub:hover {
  color: var(--cimento-100);
}

.tab-sub.is-active {
  color: var(--terracota-claro);
  border-bottom-color: var(--terracota);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

/* ---------------- grade de posição ---------------- */

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 132px;
}

.pos-grid button {
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid var(--cimento-600);
  background: var(--cimento-850);
  cursor: pointer;
  position: relative;
}

.pos-grid button::after {
  content: "";
  position: absolute;
  inset: 35%;
  border-radius: 50%;
  background: var(--cimento-600);
}

.pos-grid button:hover {
  border-color: var(--cimento-400);
}

.pos-grid button.is-active {
  border-color: var(--terracota);
  background: rgba(192, 96, 58, 0.16);
}

.pos-grid button.is-active::after {
  background: var(--terracota-claro);
}

/* ---------------- palco / aparelho ---------------- */

.device {
  position: relative;
  padding: 16px 14px 20px;
  border-radius: 26px;
  background: linear-gradient(160deg, var(--cimento-700), var(--cimento-850));
  border: 1px solid var(--cimento-600);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.device-notch {
  width: 46px;
  height: 4px;
  border-radius: 3px;
  background: var(--cimento-600);
  margin: 0 auto 12px;
}

.device-bezel {
  width: min(66vh, 330px);
  aspect-ratio: 480 / 800;
  background: var(--cimento-950);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.device-bezel--landscape {
  width: min(88vw, 520px);
  aspect-ratio: 800 / 480;
}

.device-screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.preview-pannable {
  cursor: grab;
}

.preview-dragging {
  cursor: grabbing;
}

.spec-pill {
  margin: 14px 0 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cimento-850);
  border: 1px solid var(--cimento-700);
  font-size: 11.5px;
  color: var(--cimento-400);
}

.empty-stage {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--cimento-400);
}

.stage-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.stage-actions--left {
  justify-content: flex-start;
  margin-bottom: 6px;
}

.stage-note {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--cimento-400);
  text-align: center;
  max-width: 320px;
}

/* ---------------- alertas ---------------- */

.alert {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: var(--raio-sm);
  font-size: 12.5px;
  border: 1px solid;
}

.alert--erro {
  color: #f0b6b1;
  background: rgba(209, 88, 79, 0.12);
  border-color: rgba(209, 88, 79, 0.45);
}

.alert--info {
  color: var(--cimento-300);
  background: var(--cimento-850);
  border-color: var(--cimento-700);
}

.alert--ok {
  color: #bcd8b2;
  background: rgba(111, 158, 99, 0.12);
  border-color: rgba(111, 158, 99, 0.45);
}

.alert a {
  color: var(--terracota-claro);
  font-weight: 600;
}

/* ---------------- lista do conversor ---------------- */

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--cimento-850);
  border: 1px solid var(--cimento-700);
  border-radius: var(--raio-sm);
}

.conv-item__info {
  flex: 1;
  min-width: 0;
}

.conv-item__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item__meta {
  font-size: 11.5px;
  color: var(--cimento-400);
}

.conv-item__meta--erro {
  color: #f0b6b1;
}

.conv-item__meta--ok {
  color: #bcd8b2;
}

.conv-item--fila {
  border-left: 3px solid var(--cimento-600);
}

.conv-item--rodando {
  border-left: 3px solid var(--terracota);
}

.conv-item--ok {
  border-left: 3px solid var(--ok);
}

.conv-item--erro {
  border-left: 3px solid var(--erro);
}

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--cimento-600);
  border-top-color: var(--terracota-claro);
  animation: girar 0.8s linear infinite;
  flex: none;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

/* rolagem discreta */
.thumb-list::-webkit-scrollbar {
  width: 8px;
}

.thumb-list::-webkit-scrollbar-thumb {
  background: var(--cimento-700);
  border-radius: 4px;
}

/* ---------------- 19/09/2026: link para /xtc/ e ajustes finos do conversor ---------------- */
.tab-link {
  color: var(--cimento-300);
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--raio-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.tab-link:hover { color: var(--cimento-100); background: var(--cimento-800); }

.conv-ajustes {
  margin: 14px 0;
  padding: 10px 14px;
  border: 1px solid var(--cimento-700);
  border-radius: var(--raio-sm);
  background: var(--cimento-850);
}
.conv-ajustes > summary { cursor: pointer; font-weight: 600; color: var(--cimento-100); }
.conv-ajustes[open] > summary { margin-bottom: 10px; }
.checks { display: grid; gap: 6px; margin-bottom: 12px; }
