@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --surface: #161618;
  --line: #2c2c31;
  --text: #f3f1ee;
  --muted: #9a9590;
  --accent: #ff6a1a;
  --ink: #1a0c06;
  --radius: 20px;
  font-family: 'DM Sans', 'Manrope', system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 100% 0%, #ff6a1a14, transparent 36%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
.input-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; max-height: 220px; overflow: auto; }
.input-row label { display: flex; flex-direction: column; gap: 4px; min-width: 108px; flex: 1 1 108px; font-size: 12px; color: var(--muted); }
.input-row input[type="number"] { width: 100%; background: #101012; border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 8px 10px; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { cursor: not-allowed; opacity: .4; }
[hidden] { display: none !important; }

.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mark-link {
  display: inline-flex;
  color: var(--text);
  flex: none;
}
.mark-link:hover { color: var(--accent); }
.cross {
  color: var(--muted);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  color: var(--text);
}
.i-mark {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 11px;
  height: 20px;
  margin: 0 9px 1px 5px;
}
.i-mark i {
  display: block;
  width: 11px;
  height: 3.6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px #ff6a1a88;
}
.product {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text);
}
.version {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 20px 48px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.file-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 1px dashed #4a4038;
  background: linear-gradient(135deg, #1c1a18, #121214);
  border-radius: 14px;
  padding: 28px 16px 22px;
  cursor: pointer;
}
.file-zone:hover { border-color: var(--accent); background: #221c18; }
.file-symbol {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #ff6a1a22;
  color: var(--accent);
  font-size: 24px;
  line-height: 42px;
}
.file-zone strong { font-size: 15px; font-weight: 600; }
.file-zone input {
  width: 100%;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.file-zone input::file-selector-button {
  background: #2a241f;
  border: 1px solid #5a4636;
  color: #f3e6da;
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 10px;
  cursor: pointer;
}

.url-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.url-row input { min-width: 0; flex: 1 1 180px; }
.source-preview {
  display: block;
  width: 100%;
  max-height: 420px;
  margin-top: 14px;
  object-fit: contain;
  background:
    radial-gradient(ellipse at 50% 100%, #ff6a1a18, transparent 60%),
    #101012;
  border-radius: 12px;
  border: 1px solid var(--line);
}
input[type="url"], textarea {
  width: 100%;
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  padding: 14px;
  font-size: 15px;
}
input[type="url"]::placeholder, textarea::placeholder { color: #6e6a66; }
input[type="url"]:focus, textarea:focus { border-color: #ff6a1a; outline: none; }
textarea { display: block; resize: vertical; min-height: 112px; line-height: 1.55; }

.contract {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}
.contract li {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #101012;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.assumptions {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.assumptions li {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #c8c4be;
}
.field-note {
  margin: -2px 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}
.source-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.meta-group { display: inline-flex; align-items: baseline; gap: 8px; }
.meta-label { color: var(--muted); }
#layer-count, #source-size, #source-mode, #source-name, #source-bytes { color: var(--accent); font-weight: 600; }
#source-name { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.button-secondary {
  background: #242220;
  border-color: #4a4038;
  color: #f3e6da;
  white-space: nowrap;
}
.button-primary {
  width: 100%;
  margin-top: 14px;
  background: var(--accent);
  color: var(--ink);
  gap: 10px;
}
.button-primary kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 7px;
  background: #1a0c0618;
  border: 1px solid #1a0c062e;
}
.button-primary:hover:not(:disabled) { background: #ff8540; }
.pass-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.pass-list li {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--muted);
}
.pass-list li span {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #101012;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}
.pass-list li strong { display: block; color: var(--text); font-size: 13px; font-weight: 650; }
.pass-list li small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.pass-list li[data-state="active"] { border-color: #ff6a1a; background: #24180f; }
.pass-list li[data-state="done"] span { background: var(--accent); color: var(--ink); border-color: transparent; }
.pass-list li[data-state="bad"] { border-color: #6a3a34; }
.pass-list li[data-state="bad"] span { background: #5b2e25; color: #fff; border-color: transparent; }
.pass-list li[data-state="bad"] small { color: #e7b2a8; }
.pass-list li a.pass-page {
  margin-left: auto;
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #141416;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.pass-list li a.pass-page:hover {
  border-color: var(--accent);
  background: #24180f;
}
.button-download {
  width: 100%;
  margin-top: 14px;
  background: #2a1c14;
  border-color: #6a4630;
  color: #ffb088;
}
.catalog-link {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.status {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.status[data-state="error"] { color: #ffa39c; }

.result-card { grid-column: 1 / -1; padding: 16px; }
/* Definite height is required. A percentage height collapses against the
   auto-sized card, and Spine Player then inflates the canvas bitmap up to
   the WebGL limit (about 32767px). */
.player-stage {
  position: relative;
  height: min(68vh, 560px);
  min-height: 320px;
  max-height: 560px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 100%, #ff6a1a22, transparent 58%),
    #101012;
}
#player.player-stage {
  height: min(68vh, 560px);
  max-height: 560px;
}
#player .spine-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
#player canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}
.clip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.clip-list:empty { display: none; }
.clip-list button {
  background: #1c1c1f;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
}
.clip-list button:hover,
.clip-list button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #2a1c14;
  color: #ffd2b8;
}

.layer-names {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-height: 96px;
  overflow: auto;
}
.layer-names li {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.layer-names li[data-hidden="true"] {
  color: #6e6a66;
  border-style: dashed;
}
.layer-names li[data-missing="true"] {
  color: #c8b8a4;
  border-style: dotted;
}
.source-notes {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  max-height: 120px;
  overflow: auto;
}
.source-notes li {
  font-size: 12px;
  line-height: 1.4;
  color: #c8b8a4;
  overflow-wrap: anywhere;
}
body.page-drop main {
  outline: 2px dashed var(--accent);
  outline-offset: 8px;
  border-radius: 24px;
}
.noscript {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  background: #5b2e25;
  color: white;
  text-align: center;
}

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
  .result-card { grid-column: auto; }
}
@media (max-width: 640px) {
  .topbar, main { padding-left: 14px; padding-right: 14px; }
  .card { padding: 16px; }
  .player-stage, #player.player-stage { min-height: 280px; height: min(62vh, 560px); max-height: 560px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Compact file control: same dimensions as its neighbouring Open button. */
.compact-file {position:relative;min-width:88px;max-width:88px;flex:0 0 88px;padding:10px 14px;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;overflow:hidden;}
.compact-file input {position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;}
#load-url {min-width:88px;max-width:88px;flex:0 0 88px;}
.compact-file.drag-over {border-color:var(--accent);background:#ff6a1a16;}
.sr-only {position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.url-row {align-items:stretch;}
@media(max-width:480px){.url-row{display:flex;gap:6px;}.compact-file{min-width:76px;max-width:84px;flex-basis:84px;padding:9px 8px;}}

.url-row {flex-wrap:nowrap;margin-top:0;}
.compact-file {height:auto;min-height:46px;border-radius:12px;}
