:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #111419;
  --panel-soft: #171b21;
  --text: #eef2f7;
  --muted: #9aa4b2;
  --line: #27303b;
  --green: #28e879;
  --blue: #5cb7ff;
  --amber: #f5bd4f;
  --red: #ff6b6b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

html {
  overflow-x: clip;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  overflow-x: clip;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #041108;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate {
  width: min(440px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mark {
  margin-bottom: 22px;
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.gate label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.secret-row {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
}

.secret-row input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d10;
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.secret-row input:focus {
  border-color: var(--blue);
}

.error-line,
.status-line {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--red);
}

.app-shell {
  --topbar-offset: 0px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 11, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar > div {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.github-link {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  background: #0b0d10;
}

.github-link:hover,
.ghost-button:hover {
  border-color: var(--blue);
}

.ghost-button {
  min-width: 72px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 42px) 44px;
  flex: 1;
  min-width: 0;
}

.upload-band {
  display: grid;
  gap: 10px;
  margin: 0 auto 18px;
  width: min(1040px, 100%);
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
  align-items: stretch;
}

.drop-zone {
  min-height: 132px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 22px 24px;
  border: 1px dashed #506070;
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
  min-width: 0;
}

.drop-zone.is-dragging,
.upload-band.is-dragging .drop-zone {
  border-color: var(--green);
  background: #102018;
  box-shadow: 0 0 0 3px rgba(40, 232, 121, 0.11);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title {
  font-size: 20px;
  font-weight: 800;
}

.drop-file {
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}

.status-line {
  color: var(--muted);
}

.status-line.is-processing {
  min-width: 88px;
  position: relative;
}

.status-cycle-item {
  animation: processingStatusFade 4s ease-in-out infinite;
  display: inline-block;
}

.status-cycle-item-2 {
  animation-delay: -2s;
  left: 0;
  position: absolute;
  top: 0;
}

.status-line.is-error {
  color: var(--red);
}

@keyframes processingStatusFade {
  0%,
  40% {
    opacity: 1;
  }

  50%,
  90% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.result-view {
  display: grid;
  gap: 16px;
  width: min(1180px, 100%);
  margin: 0 auto;
  min-width: 0;
  scroll-margin-top: 96px;
}

.image-stage {
  width: 100%;
  min-height: 320px;
  max-height: min(68vh, 820px);
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020304;
}

.image-stage img {
  display: block;
  max-width: 100%;
  max-height: min(68vh, 820px);
  object-fit: contain;
}

.result-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 20, 25, 0.96);
  min-width: 0;
}

.score-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.score-block {
  display: grid;
  gap: 3px;
}

.score-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-value {
  color: var(--green);
  font-size: 42px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.score-unit {
  color: var(--green);
  font-weight: 800;
}

.meta-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.meta-block strong {
  word-break: break-word;
}

.meta-block span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.summary-text {
  margin: 16px 0 12px;
  font-size: 17px;
  line-height: 1.6;
}

.dimension-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dimension-chip {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(40, 232, 121, 0.45);
  background: rgba(40, 232, 121, 0.12);
  color: var(--green);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dimension-chip.mid {
  border-color: rgba(245, 189, 79, 0.45);
  background: rgba(245, 189, 79, 0.12);
  color: var(--amber);
}

.dimension-chip.low {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.12);
  color: var(--red);
}

.dimension-chip.resolution {
  border-color: rgba(92, 183, 255, 0.5);
  background: rgba(92, 183, 255, 0.14);
  color: var(--blue);
}

.reasoning-text {
  margin: 16px 0 0;
  color: #d7dde7;
  line-height: 1.75;
}

.disclaimer {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 42px) 22px;
  color: rgba(154, 164, 178, 0.62);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 720px) {
  .lock-screen {
    min-height: 100svh;
    padding: 16px;
  }

  .gate {
    padding: 22px;
  }

  .mark {
    font-size: 28px;
  }

  button,
  .github-link {
    min-height: 46px;
  }

  .secret-row input {
    min-height: 52px;
    font-size: 16px;
    padding: 0 16px;
  }

  .topbar {
    position: fixed;
    left: 0;
    right: 0;
    min-height: 0;
    padding: 12px 14px;
    align-items: flex-start;
    flex-direction: row;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
    transition:
      padding 140ms ease,
      min-height 140ms ease;
  }

  .app-shell {
    padding-top: var(--topbar-offset);
  }

  .topbar > div {
    flex: 1 1 auto;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .top-actions {
    width: 86px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .github-link,
  .ghost-button {
    width: 100%;
    min-width: 0;
    padding: 0 10px;
    font-size: 13px;
  }

  .topbar.is-compact {
    align-items: center;
    padding: 10px 14px;
  }

  .topbar.is-compact p,
  .topbar.is-compact .top-actions {
    display: none;
  }

  .topbar.is-compact h1 {
    font-size: 20px;
  }

  .workspace {
    padding: 16px 12px 28px;
  }

  .secret-row,
  .upload-form {
    grid-template-columns: 1fr;
  }

  .upload-form button {
    width: 100%;
  }

  .drop-zone {
    min-height: 116px;
    padding: 18px;
  }

  .drop-title {
    font-size: 18px;
  }

  .drop-file,
  .status-line,
  .meta-block span {
    font-size: 13px;
  }

  .image-stage {
    min-height: 260px;
    max-height: 58vh;
    aspect-ratio: 4 / 3;
  }

  .image-stage img {
    max-height: 58vh;
  }

  .result-panel {
    padding: 14px;
  }

  .result-view {
    scroll-margin-top: 62px;
  }

  .score-row {
    gap: 12px;
  }

  .score-value {
    font-size: 34px;
  }

  .summary-text {
    font-size: 16px;
  }

  .dimension-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dimension-chip {
    width: 100%;
  }

  .disclaimer {
    padding: 0 12px 18px;
    text-align: left;
  }
}

@media (max-width: 420px) {
  .secret-row {
    gap: 8px;
  }

  .gate {
    padding: 18px;
  }

  .topbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar p {
    font-size: 12px;
  }

  .top-actions {
    width: 78px;
  }

  .workspace {
    padding-inline: 10px;
  }

  .drop-zone {
    min-height: 108px;
    padding: 16px;
  }

  .image-stage {
    min-height: 220px;
  }

  .score-block {
    width: 100%;
  }

  .score-value {
    font-size: 32px;
  }

  .reasoning-text {
    line-height: 1.65;
  }
}

@media (min-width: 721px) and (max-width: 980px) {
  .topbar {
    align-items: flex-start;
  }

  .workspace {
    padding-inline: 20px;
  }

  .image-stage {
    max-height: 62vh;
  }

  .image-stage img {
    max-height: 62vh;
  }
}
