/* Editor de offsets por frame PMD — página dedicada. */

:root {
  --foe-bg: #060a14;
  --foe-panel: rgba(9, 15, 28, 0.92);
  --foe-panel-border: rgba(148, 163, 184, 0.22);
  --foe-text: #e2e8f0;
  --foe-text-dim: #94a3b8;
  --foe-accent: #a78bfa;
  --foe-accent-soft: rgba(167, 139, 250, 0.16);
  --foe-onion: rgba(167, 139, 250, 0.35);
  --foe-warn: #fde047;
  --foe-ok: #4ade80;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--foe-bg);
  color: var(--foe-text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

.foe-app {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header header"
    "roster preview sidebar";
  gap: 10px;
  height: 100vh;
  padding: 10px;
}

.foe-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--foe-panel);
  border: 1px solid var(--foe-panel-border);
  border-radius: 12px;
}

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

.foe-header__title {
  margin: 0;
  font-size: 17px;
}

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

.foe-header__status {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

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

.foe-dirty {
  font-size: 11px;
  color: var(--foe-warn);
}

.foe-api.is-offline {
  color: #f87171;
}

.foe-api:not(.is-offline) {
  color: var(--foe-ok);
  font-size: 11px;
}

.foe-header__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.foe-btn {
  appearance: none;
  border: 1px solid var(--foe-panel-border);
  background: rgba(15, 23, 42, 0.75);
  color: var(--foe-text);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.foe-btn:hover:not(:disabled) {
  border-color: var(--foe-accent);
  background: var(--foe-accent-soft);
}

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

.foe-btn--primary {
  border-color: rgba(167, 139, 250, 0.45);
  background: var(--foe-accent-soft);
  color: #ede9fe;
}

.foe-btn--ghost {
  color: var(--foe-text-dim);
}

.foe-btn--link {
  color: var(--foe-accent);
}

.foe-btn.is-active {
  border-color: var(--foe-accent);
  background: var(--foe-accent-soft);
  color: #ede9fe;
}

.foe-roster {
  grid-area: roster;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--foe-panel);
  border: 1px solid var(--foe-panel-border);
  border-radius: 12px;
  min-height: 0;
}

.foe-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--foe-panel-border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--foe-text);
  font: inherit;
}

.foe-gen-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.foe-gen-tabs button {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  font-size: 11px;
}

.foe-roster__list {
  flex: 1 1 auto;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.foe-roster__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--foe-text);
  font: inherit;
  cursor: pointer;
}

.foe-roster__item:hover {
  background: rgba(148, 163, 184, 0.08);
}

.foe-roster__item.is-active {
  border-color: rgba(167, 139, 250, 0.35);
  background: var(--foe-accent-soft);
}

.foe-roster__dex {
  font-size: 11px;
  color: var(--foe-text-dim);
  min-width: 2.5rem;
}

.foe-roster__badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(253, 224, 71, 0.15);
  color: var(--foe-warn);
}

.foe-preview {
  grid-area: preview;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.foe-canvas {
  flex: 1 1 auto;
  width: 100%;
  min-height: 200px;
  background: var(--foe-panel);
  border: 1px solid var(--foe-panel-border);
  border-radius: 12px;
  cursor: grab;
}

.foe-canvas.is-dragging {
  cursor: grabbing;
}

.foe-preview__toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.foe-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--foe-text-dim);
}

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

.foe-frame-strip {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--foe-panel);
  border: 1px solid var(--foe-panel-border);
  border-radius: 12px;
  overflow-x: auto;
  min-height: 72px;
}

.foe-frame-strip:empty {
  display: none;
}

.foe-frame-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--foe-panel-border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  position: relative;
}

.foe-frame-thumb:hover {
  border-color: var(--foe-accent);
}

.foe-frame-thumb.is-active {
  border-color: var(--foe-accent);
  box-shadow: 0 0 0 1px var(--foe-accent);
}

.foe-frame-thumb.is-edited::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foe-warn);
}

.foe-frame-thumb canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.foe-sidebar {
  grid-area: sidebar;
  padding: 12px;
  background: var(--foe-panel);
  border: 1px solid var(--foe-panel-border);
  border-radius: 12px;
  overflow: auto;
  min-height: 0;
}

.foe-section {
  margin-bottom: 14px;
}

.foe-section__title {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--foe-text-dim);
}

.foe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.foe-row label {
  flex: 0 0 72px;
  font-size: 12px;
  color: var(--foe-text-dim);
}

.foe-row input[type="number"],
.foe-row input[type="range"],
.foe-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.foe-row input[type="number"] {
  padding: 6px 8px;
  border: 1px solid var(--foe-panel-border);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--foe-text);
  font: inherit;
  width: 100%;
}

.foe-dir-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.foe-dir-grid button {
  padding: 6px 4px;
  font-size: 11px;
}

.foe-anim-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.foe-anim-tabs button {
  flex: 1 1 auto;
}

.foe-stat {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.foe-stat__label {
  color: var(--foe-text-dim);
}

.foe-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

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

@media (max-width: 1100px) {
  .foe-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "header"
      "roster"
      "preview"
      "sidebar";
    height: auto;
    min-height: 100vh;
  }

  .foe-roster__list {
    max-height: 180px;
  }
}
