:root {
  color: #f4f4f4;
  background: #171717;
  font-family: Tahoma, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #171717; }
body { min-height: 100vh; margin: 0; background: #171717; }
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #3a3a3a;
  background: rgba(23, 23, 23, 0.94);
  padding: 0 24px;
  backdrop-filter: blur(12px);
}

.brand, .eyebrow, .panel-head, .section-title, .service-state, footer {
  font-family: Consolas, "Cascadia Mono", monospace;
  letter-spacing: .08em;
}

.brand { color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; letter-spacing: .18em; }
.service-state { color: #898989; font-size: 10px; }
.service-state span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #e8e8e8; }
.top-actions, .top-actions nav { display: flex; align-items: center; }
.top-actions { gap: 24px; }
.top-actions nav { gap: 4px; }
.top-actions nav a { border: 1px solid transparent; border-radius: 6px; padding: 7px 9px; color: #777; font: 9px Consolas, "Cascadia Mono", monospace; letter-spacing: .08em; text-decoration: none; }
.top-actions nav a:hover { color: #ddd; }
.top-actions nav a.active { border-color: #444; background: #242424; color: #eee; }

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 76px 0 90px; }
.intro { max-width: 680px; margin-bottom: 56px; }
.eyebrow { margin: 0 0 17px; color: #878787; font-size: 10px; }
h1 { margin: 0; font-size: clamp(38px, 7vw, 72px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 570px; margin: 24px 0 0; color: #a4a4a4; font-size: 15px; line-height: 1.8; }

.workspace, .results { border: 1px solid #3c3c3c; border-radius: 14px; background: #1d1d1d; }
.panel-head, .section-title { display: flex; justify-content: space-between; color: #868686; font-size: 9px; }
.text-link { color: #aaa; text-decoration: none; }
.text-link:hover { color: #fff; }
.panel-head { border-bottom: 1px solid #353535; padding: 14px 16px; }
.drop-zone { display: grid; width: calc(100% - 36px); min-height: 250px; place-items: center; align-content: center; gap: 11px; margin: 18px; border: 1px dashed #565656; border-radius: 10px; background: #202020; cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.is-over { border-color: #d6d6d6; background: #262626; }
.drop-zone:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.drop-zone strong { font-size: 14px; font-weight: 500; }
.drop-zone small { color: #777; font: 10px Consolas, "Cascadia Mono", monospace; }
.drop-mark { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: 10px; border: 1px solid #4a4a4a; border-radius: 50%; color: #bfbfbf; font: 25px/1 Consolas, monospace; }

.actions { display: flex; min-height: 49px; align-items: center; justify-content: space-between; border-top: 1px solid #353535; padding: 0 18px; color: #777; font-size: 10px; }
#status[data-state="error"] { color: #ff8c8c; }
#status[data-state="busy"] { color: #f0f0f0; }

.results { margin-top: 20px; padding: 18px; }
.section-title { margin-bottom: 14px; }
.result-list { display: grid; gap: 10px; }
.empty-state { display: grid; min-height: 116px; place-items: center; border: 1px solid #333; border-radius: 9px; color: #666; font-size: 12px; }
.result-item { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: center; gap: 14px; border: 1px solid #3a3a3a; border-radius: 9px; background: #222; padding: 10px; }
.result-item img { width: 86px; height: 62px; border-radius: 6px; background: #111; object-fit: cover; }
.result-info { min-width: 0; }
.result-url { overflow: hidden; margin-bottom: 8px; color: #eee; font: 11px Consolas, "Cascadia Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { color: #777; font: 9px Consolas, "Cascadia Mono", monospace; }
.copy-button { min-width: 76px; height: 36px; border: 1px solid #555; border-radius: 7px; background: #dedede; color: #171717; cursor: pointer; font-size: 11px; font-weight: 700; }
.copy-button:hover { background: #fff; }

.gallery-main { min-height: calc(100vh - 108px); }
.gallery-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 46px; border-bottom: 1px solid #393939; padding-bottom: 32px; }
.gallery-intro h1 { font-size: clamp(36px, 6vw, 64px); }
.gallery-count { display: grid; justify-items: end; }
.gallery-count strong { font: 500 42px/1 Consolas, "Cascadia Mono", monospace; }
.gallery-count span { margin-top: 7px; color: #777; font: 8px Consolas, "Cascadia Mono", monospace; letter-spacing: .14em; }
.gallery-status { display: grid; min-height: 240px; place-items: center; border: 1px dashed #414141; border-radius: 12px; color: #777; font-size: 12px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gallery-card { overflow: hidden; border: 1px solid #393939; border-radius: 10px; background: #1e1e1e; }
.gallery-card > a { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #111; }
.gallery-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.gallery-card:hover img { transform: scale(1.018); }
.gallery-details { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 9px; border-top: 1px solid #353535; padding: 10px; }
.gallery-identity { display: grid; min-width: 0; gap: 5px; }
.gallery-identity strong { font: 11px Consolas, "Cascadia Mono", monospace; }
.gallery-identity span { overflow: hidden; color: #727272; font: 8px Consolas, "Cascadia Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.gallery-details button { flex: none; height: 30px; border: 1px solid #4b4b4b; border-radius: 6px; background: #292929; color: #ccc; cursor: pointer; font: 8px Consolas, "Cascadia Mono", monospace; }
.gallery-details button:hover { border-color: #888; color: #fff; }
.load-more { display: block; width: 100%; height: 48px; margin-top: 16px; border: 1px solid #444; border-radius: 8px; background: #222; color: #ccc; cursor: pointer; font: 10px Consolas, "Cascadia Mono", monospace; letter-spacing: .12em; }
.load-more:hover { border-color: #888; background: #292929; color: #fff; }
.load-more:disabled { cursor: wait; opacity: .5; }

footer { display: flex; justify-content: space-between; border-top: 1px solid #333; padding: 18px 24px; color: #676767; font-size: 8px; }

@media (max-width: 620px) {
  .topbar { padding: 0 16px; }
  .service-state { display: none; }
  .top-actions { gap: 8px; }
  main { width: min(100% - 24px, 1040px); padding-top: 48px; }
  .intro { margin-bottom: 38px; }
  .drop-zone { min-height: 210px; text-align: center; padding: 24px; }
  .result-item { grid-template-columns: 64px minmax(0, 1fr); }
  .result-item img { width: 64px; height: 56px; }
  .copy-button { grid-column: 1 / -1; width: 100%; }
  footer { gap: 10px; flex-direction: column; }
  .gallery-intro { align-items: start; flex-direction: column; }
  .gallery-count { justify-items: start; }
  .gallery-grid { grid-template-columns: 1fr; }
}

@media (min-width: 621px) and (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
