:root{
  --bg:#f6f5f1;
  --surface:#ffffff;
  --ink:#1a1a1a;
  --muted:#6b6b6b;
  --line:#e6e3dc;
  --accent:#1f6feb;
  --accent-ink:#ffffff;
  --err:#b3261e;
  --radius:14px;
  --shadow:0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
[hidden]{display:none !important}
body{
  font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
}

/* ---------- Gate ---------- */
.gate{
  min-height:100dvh;
  display:grid;
  place-items:center;
  padding:24px;
}
.gate__card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:32px;
  width:100%;
  max-width:380px;
  text-align:center;
}
.gate__title{
  font-size:32px;
  margin:0 0 4px;
  letter-spacing:-.02em;
}
.gate__sub{
  margin:0 0 20px;
  color:var(--muted);
  font-size:14px;
}
.gate__input{
  width:100%;
  padding:12px 14px;
  font-size:16px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fafaf7;
  outline:none;
  transition:border-color .15s, background .15s;
}
.gate__input:focus{
  border-color:var(--accent);
  background:#fff;
}
.gate__btn{
  margin-top:12px;
  width:100%;
  padding:12px 16px;
  font-size:16px;
  font-weight:600;
  border:0;
  border-radius:10px;
  background:var(--accent);
  color:var(--accent-ink);
  cursor:pointer;
  transition:filter .15s;
}
.gate__btn:hover{filter:brightness(1.05)}
.gate__btn:active{filter:brightness(.95)}
.gate__err{
  margin:12px 0 0;
  color:var(--err);
  font-size:14px;
}

/* ---------- App ---------- */
.app{
  max-width:1040px;
  margin:0 auto;
  padding:32px 20px 48px;
}
.app__head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:24px;
}
.app__title{
  margin:0;
  font-size:28px;
  letter-spacing:-.02em;
}
.app__sub{
  margin:2px 0 0;
  color:var(--muted);
  font-size:14px;
}

.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px 22px;
  margin-bottom:20px;
}
.card__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.card__h{
  margin:0 0 2px;
  font-size:18px;
}
.card__p{
  margin:0;
  color:var(--muted);
  font-size:14px;
}

.btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:10px 14px;
  font-size:14px;
  font-weight:600;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  color:var(--ink);
  cursor:pointer;
  text-decoration:none;
  transition:background .15s, border-color .15s, filter .15s;
}
.btn:hover{background:#fafaf7}
.btn:disabled{opacity:.6;cursor:progress}
.btn--primary{
  background:var(--accent);
  color:var(--accent-ink);
  border-color:var(--accent);
}
.btn--primary:hover{filter:brightness(1.05); background:var(--accent)}

/* ---------- Grid ---------- */
.grid{
  margin-top:18px;
  display:grid;
  gap:12px;
  grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
}
.tile{
  position:relative;
  aspect-ratio:1/1;
  border-radius:10px;
  overflow:hidden;
  background:#0a0a0a;
  border:1px solid var(--line);
  cursor:zoom-in;
}
.tile img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transition:transform .25s ease;
}
.tile:hover img{transform:scale(1.03)}
.tile__label{
  position:absolute;
  left:8px;
  bottom:8px;
  font-size:11px;
  font-weight:600;
  color:#fff;
  background:rgba(0,0,0,.55);
  padding:3px 7px;
  border-radius:6px;
  letter-spacing:.02em;
}

/* ---------- Lightbox ---------- */
.lb{
  position:fixed;
  inset:0;
  background:rgba(10,10,10,.92);
  display:grid;
  place-items:center;
  z-index:50;
  padding:24px;
}
.lb__img{
  max-width:100%;
  max-height:calc(100dvh - 120px);
  border-radius:8px;
  box-shadow:0 20px 60px rgba(0,0,0,.4);
}
.lb__close{
  position:absolute;
  top:16px;
  right:16px;
  width:40px;
  height:40px;
  font-size:28px;
  line-height:1;
  background:rgba(255,255,255,.1);
  color:#fff;
  border:0;
  border-radius:999px;
  cursor:pointer;
  transition:background .15s;
}
.lb__close:hover{background:rgba(255,255,255,.2)}
.lb__dl{
  position:absolute;
  top:18px;
  left:16px;
  padding:8px 14px;
  font-size:14px;
  font-weight:600;
  background:#fff;
  color:var(--ink);
  border-radius:8px;
  text-decoration:none;
}
.lb__dl:hover{filter:brightness(.95)}
.lb__caption{
  position:absolute;
  bottom:20px;
  color:#ddd;
  font-size:13px;
  letter-spacing:.04em;
}

.foot{
  margin-top:32px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
}

/* ---------- Mobile ---------- */
@media (max-width:520px){
  .app{padding:20px 14px 40px}
  .card{padding:16px}
  .card__row{flex-direction:column;align-items:flex-start}
  .grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px}
}
