/* Viewer de props visuais — catálogo Dewbuse. */

:root {
  --pv-bg: #071018;
  --pv-panel: rgba(10, 18, 28, 0.94);
  --pv-panel-border: rgba(148, 163, 184, 0.2);
  --pv-card: #0c1520;
  --pv-text: #e2e8f0;
  --pv-text-dim: #94a3b8;
  --pv-accent: #5eead4;
  --pv-accent-soft: rgba(94, 234, 212, 0.14);
  --pv-warn: #fbbf24;
  --pv-ok: #34d399;
  --pv-violet: #c4b5fd;
  --pv-grass-a: #b7d48a;
  --pv-grass-b: #87b45a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 212, 191, 0.12), transparent),
    var(--pv-bg);
  color: var(--pv-text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

.pv-app {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  padding: 12px;
}

.pv-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 16px;
  background: var(--pv-panel);
  border: 1px solid var(--pv-panel-border);
  border-radius: 12px;
  position: sticky;
  top: 8px;
  z-index: 5;
  backdrop-filter: blur(8px);
}

.pv-header__meta {
  min-width: 0;
}

.pv-header__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pv-header__subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--pv-text-dim);
}

.pv-header__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-left: auto;
}

.pv-status {
  font-size: 12px;
  color: var(--pv-text-dim);
}

.pv-chip {
  font-size: 11px;
  font-weight: 650;
  color: var(--pv-accent);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pv-accent-soft);
  border: 1px solid rgba(94, 234, 212, 0.28);
}

.pv-chip[hidden] {
  display: none;
}

.pv-dirty {
  font-size: 11px;
  font-weight: 650;
  color: var(--pv-warn);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.28);
}

.pv-dirty[hidden] {
  display: none;
}

.pv-api {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--pv-panel-border);
  color: var(--pv-text-dim);
}

.pv-api.is-online {
  color: var(--pv-ok);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}

.pv-api.is-offline {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.pv-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pv-input {
  min-width: 220px;
  background: #0a121c;
  border: 1px solid var(--pv-panel-border);
  border-radius: 8px;
  color: var(--pv-text);
  padding: 7px 10px;
  font: inherit;
}

.pv-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pv-text-dim);
  user-select: none;
  cursor: pointer;
}

.pv-check input {
  accent-color: var(--pv-accent);
}

.pv-zoom {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--pv-panel-border);
  border-radius: 8px;
  background: #0a121c;
}

.pv-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--pv-panel);
  border: 1px solid var(--pv-panel-border);
  border-radius: 12px;
  position: sticky;
  top: 88px;
  z-index: 4;
  backdrop-filter: blur(8px);
}

.pv-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--pv-text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pv-tab:hover {
  color: var(--pv-text);
  background: rgba(148, 163, 184, 0.08);
}

.pv-tab.is-active {
  color: var(--pv-accent);
  background: var(--pv-accent-soft);
  border-color: rgba(94, 234, 212, 0.35);
}

.pv-tab__count {
  min-width: 1.4em;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  color: inherit;
  background: rgba(148, 163, 184, 0.14);
}

.pv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 7px 12px;
  border: 1px solid var(--pv-panel-border);
  border-radius: 8px;
  background: #0a121c;
  color: var(--pv-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.pv-btn:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.45);
  background: #101a28;
}

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

.pv-btn--primary {
  background: rgba(94, 234, 212, 0.16);
  border-color: rgba(94, 234, 212, 0.4);
  color: var(--pv-accent);
}

.pv-btn--ghost {
  background: transparent;
}

.pv-btn--ghost.is-active {
  color: var(--pv-accent);
  background: var(--pv-accent-soft);
  border-color: rgba(94, 234, 212, 0.35);
}

.pv-btn--link {
  background: transparent;
  color: var(--pv-text-dim);
}

.pv-body {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 360px);
  gap: 12px;
  align-items: start;
}

.pv-body.is-solo {
  grid-template-columns: 1fr;
}

.pv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding-bottom: 24px;
  content-visibility: auto;
}

.pv-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--pv-card);
  border: 1px solid var(--pv-panel-border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  contain: content;
}

.pv-card[hidden] {
  display: none;
}

.pv-card:hover {
  border-color: rgba(94, 234, 212, 0.35);
}

.pv-card.is-selected {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.18);
}

.pv-card__preview {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 148px;
  padding: 12px 8px 8px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 15px,
      rgba(22, 70, 40, 0.1) 15px,
      rgba(22, 70, 40, 0.1) 16px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 15px,
      rgba(22, 70, 40, 0.1) 15px,
      rgba(22, 70, 40, 0.1) 16px
    ),
    linear-gradient(180deg, var(--pv-grass-a) 0%, #9bc46a 55%, var(--pv-grass-b) 100%);
  border-radius: 8px;
  border: 1px solid rgba(55, 90, 40, 0.28);
  overflow: hidden;
}

.pv-card__preview canvas {
  image-rendering: pixelated;
  max-width: 100%;
  max-height: 220px;
}

.pv-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pv-card__id {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.pv-card__sub {
  font-size: 11px;
  color: var(--pv-text-dim);
}

.pv-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.pv-card__tag {
  display: inline-flex;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--pv-accent);
  background: var(--pv-accent-soft);
  border: 1px solid rgba(94, 234, 212, 0.28);
}

.pv-card__tag.is-world {
  color: var(--pv-ok);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
}

.pv-card__tag.is-free {
  color: var(--pv-text-dim);
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
}

.pv-card__tag.is-comp {
  color: var(--pv-violet);
  background: rgba(196, 181, 253, 0.12);
  border-color: rgba(196, 181, 253, 0.28);
}

.pv-empty {
  grid-column: 1 / -1;
  padding: 32px;
  text-align: center;
  color: var(--pv-text-dim);
  border: 1px dashed var(--pv-panel-border);
  border-radius: 12px;
}

.pv-inspect {
  position: sticky;
  top: 148px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--pv-panel);
  border: 1px solid var(--pv-panel-border);
  border-radius: 12px;
  max-height: calc(100vh - 164px);
  overflow: auto;
}

.pv-inspect[hidden] {
  display: none;
}

.pv-inspect__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.pv-inspect__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  word-break: break-word;
}

.pv-inspect__preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pv-inspect__preview {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 180px;
  padding: 12px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 15px,
      rgba(22, 70, 40, 0.1) 15px,
      rgba(22, 70, 40, 0.1) 16px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 15px,
      rgba(22, 70, 40, 0.1) 15px,
      rgba(22, 70, 40, 0.1) 16px
    ),
    linear-gradient(180deg, var(--pv-grass-a) 0%, #9bc46a 55%, var(--pv-grass-b) 100%);
  border-radius: 8px;
  border: 1px solid rgba(55, 90, 40, 0.28);
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.pv-inspect__preview.is-dragging {
  cursor: grabbing;
}

.pv-inspect__preview canvas {
  image-rendering: pixelated;
  max-width: 100%;
  max-height: none;
  pointer-events: none;
}

.pv-zoom--inspect {
  align-self: flex-end;
}

.pv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pv-field[hidden] {
  display: none;
}

.pv-field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 650;
  color: var(--pv-text-dim);
}

.pv-field__value {
  color: var(--pv-accent);
  font-variant-numeric: tabular-nums;
}

.pv-field input[type="range"] {
  width: 100%;
  accent-color: var(--pv-accent);
}

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

.pv-field__row input[type="number"] {
  width: 5.5rem;
  background: #0a121c;
  border: 1px solid var(--pv-panel-border);
  border-radius: 6px;
  color: var(--pv-text);
  padding: 5px 8px;
  font: inherit;
  font-size: 12px;
}

.pv-field__hint {
  font-size: 11px;
  color: var(--pv-text-dim);
}

.pv-inspect__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  font-size: 12px;
}

.pv-inspect__meta dt {
  margin: 0;
  color: var(--pv-text-dim);
}

.pv-inspect__meta dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.pv-inspect__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pv-inspect__foot {
  display: grid;
  gap: 1px;
  width: max-content;
  max-width: 100%;
  padding: 6px;
  background: #071018;
  border-radius: 8px;
  border: 1px solid var(--pv-panel-border);
}

.pv-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.18);
}

.pv-cell.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

.pv-cell.is-block {
  background: rgba(248, 113, 113, 0.7);
}

.pv-cell.is-walk {
  background: rgba(52, 211, 153, 0.45);
}

.pv-cell.is-above {
  box-shadow: inset 0 0 0 2px rgba(56, 189, 248, 0.9);
}

.pv-cell.is-base {
  background: rgba(251, 191, 36, 0.7);
}

.pv-cell.is-light {
  outline: 2px solid #fde68a;
  outline-offset: -2px;
}

.pv-inspect__actions {
  display: flex;
  gap: 8px;
}

.pv-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 8px;
  background: #0c1520;
  border: 1px solid rgba(94, 234, 212, 0.4);
  color: var(--pv-accent);
  font-size: 12px;
  font-weight: 650;
}

@media (max-width: 960px) {
  .pv-body,
  .pv-body.is-solo {
    grid-template-columns: 1fr;
  }

  .pv-inspect {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .pv-header__status {
    margin-left: 0;
  }

  .pv-input {
    min-width: 0;
    width: 100%;
  }

  .pv-tabs {
    top: auto;
    position: relative;
  }
}
