:root {
  color-scheme: dark;
  --bg: #07110f;
  --bg-2: #101417;
  --panel: rgba(18, 25, 27, 0.88);
  --panel-strong: #171e22;
  --line: rgba(231, 241, 238, 0.13);
  --line-strong: rgba(231, 241, 238, 0.24);
  --text: #f4f8f6;
  --muted: #9da8a4;
  --soft: #c8d0cd;
  --teal: #24d6a5;
  --teal-dark: #176f61;
  --blue: #77a9ff;
  --amber: #e1b764;
  --red: #f06d72;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(130deg, rgba(119, 169, 255, 0.08), transparent 28rem),
    repeating-radial-gradient(circle at 78% 42%, rgba(157, 168, 164, 0.11) 0 1px, transparent 1px 26px),
    linear-gradient(160deg, var(--bg), var(--bg-2) 58%, #0c1116);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar,
.workspace,
.scanner-pane {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
  padding: 18px 22px;
  border-radius: 8px 8px 0 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
  font-weight: 750;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

h2 {
  font-size: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  max-width: 280px;
  padding: 8px 12px;
  border: 1px solid rgba(36, 214, 165, 0.42);
  border-radius: 8px;
  color: var(--teal);
  background: rgba(36, 214, 165, 0.08);
  font-size: 0.9rem;
  font-weight: 760;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  border-top: 0;
}

.screenshot-pane,
.input-pane,
.scanner-pane {
  min-width: 0;
  padding: 22px;
}

.screenshot-pane,
.input-pane {
  display: flex;
  flex-direction: column;
}

.screenshot-pane {
  border-right: 1px solid var(--line);
}

.pane-heading,
.button-row {
  display: flex;
  align-items: center;
}

.pane-heading {
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  margin-bottom: 16px;
}

.button-row {
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.primary-button {
  padding: 0 14px;
  background: linear-gradient(180deg, var(--teal), #13a983);
  color: #031310;
  font-weight: 780;
}

.secondary-button {
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.icon-button {
  width: 40px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.primary-button svg,
.secondary-button svg,
.icon-button svg,
.drop-empty svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.dropzone {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  overflow: hidden;
  min-height: 380px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(36, 214, 165, 0.08), transparent),
    rgba(5, 11, 12, 0.44);
  cursor: pointer;
}

.dropzone.dragging {
  border-color: var(--teal);
  background: rgba(36, 214, 165, 0.1);
}

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

#previewImage {
  display: none;
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #020706;
}

.dropzone.has-image #previewImage {
  display: block;
}

.dropzone.has-image .drop-empty {
  display: none;
}

.drop-empty {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--soft);
  font-weight: 700;
}

.form-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(3, 8, 9, 0.62);
  outline: 0;
}

input:focus,
select:focus {
  border-color: rgba(36, 214, 165, 0.82);
  box-shadow: 0 0 0 3px rgba(36, 214, 165, 0.12);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.metrics div {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metrics div:nth-child(2n) {
  border-right: 0;
}

.metrics div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metrics dt {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

.metrics dd {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

input,
select {
  height: 46px;
  padding: 0 12px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--soft) 50%),
    linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 12px) 19px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.scanner-pane {
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.scanner-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.7fr) minmax(170px, 0.7fr);
  gap: 14px;
}

.scanner-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
}

.scanner-message {
  margin: 12px 0 16px;
  color: var(--soft);
  font-size: 0.9rem;
}

.scanner-message.warning,
.chain-verdict-warning {
  color: var(--amber);
}

.scanner-message.error,
.chain-verdict-error {
  color: var(--red);
}

.scanner-message.good,
.chain-verdict-good {
  color: var(--teal);
}

.chain-summary {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
}

.chain-metrics div {
  border-bottom: 0;
}

.chain-table-wrap {
  margin-top: 0;
}

.chain-table-wrap table {
  min-width: 1300px;
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 8, 9, 0.42);
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 780;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 0.92rem;
}

tr:last-child td {
  border-bottom: 0;
}

.side-long {
  color: var(--teal);
  font-weight: 800;
}

.side-short {
  color: var(--red);
  font-weight: 800;
}

.match-good {
  color: var(--teal);
}

.match-ok {
  color: var(--amber);
}

.match-low {
  color: var(--red);
}

.status-live {
  color: var(--teal);
  font-weight: 800;
}

.status-historical {
  color: var(--amber);
  font-weight: 800;
}

.muted-cell {
  color: var(--muted);
}

.account-link {
  color: var(--text);
  font-weight: 760;
  text-decoration: none;
}

.account-link:hover,
.account-link:focus-visible {
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-list {
  margin: 0;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 720px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .screenshot-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dropzone {
    min-height: 260px;
  }

  .scanner-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .screenshot-pane,
  .input-pane,
  .scanner-pane,
  .topbar {
    padding: 16px;
  }

  .pane-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics div {
    border-right: 0;
  }

  .metrics div:nth-last-child(2) {
    border-bottom: 1px solid var(--line);
  }
}
