:root {
  --bg: #000000;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.55);
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-strong: rgba(255, 255, 255, 0.18);

  --glass: rgba(30, 30, 30, 0.42);
  --glass-2: rgba(30, 30, 30, 0.30);
  --glass-blur: 40px;

  --accent: rgba(255, 255, 255, 0.92);
  --danger: #fb7185;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  overflow-x: hidden;
}

/* Login page: animated GIF background */
body.login-page {
  background: url("/back.gif") center / cover no-repeat fixed, #000;
}
body.login-page .bg { display: none; }
body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* Darken + add subtle vignette to keep glass readable */
  background:
    radial-gradient(circle at 50% 10%, rgba(0,0,0,0.15), rgba(0,0,0,0.80) 70%),
    linear-gradient(180deg, rgba(0,0,0,0.40), rgba(0,0,0,0.70));
}
.fg { position: relative; z-index: 1; }

.corner-photo {
  position: fixed;
  top: 14px;
  right: 14px;
  width: min(170px, 30vw);
  height: auto;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 18px 45px rgba(0, 0, 0, 0.55));
  opacity: 0.95;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(120px);
  mix-blend-mode: screen;
  opacity: 0.9;
}
@keyframes float {
  0% { transform: translate(0px, 0px) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0px, 0px) scale(1); }
}
.orb-a {
  top: -10%;
  left: -10%;
  width: 40rem;
  height: 40rem;
  background: rgba(37, 99, 235, 0.22);
  animation: float 15s infinite ease-in-out;
}
.orb-b {
  bottom: -10%;
  right: -10%;
  width: 35rem;
  height: 35rem;
  background: rgba(147, 51, 234, 0.22);
  animation: float 10s infinite ease-in-out reverse;
}
.glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.03), transparent 70%);
}

.wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 44px 18px 28px;
}

.head { text-align: center; }
.head h1 {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 550;
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }
.head p { margin: 0; }

.card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--glass), var(--glass-2));
  border-radius: 22px;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.60);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.22), transparent);
  opacity: 0.75;
}

.label { display: block; margin-bottom: 8px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row-between { justify-content: space-between; }

.row-login {
  align-items: stretch;
}
.row-login .input {
  transition: flex 260ms ease, max-width 260ms ease, transform 260ms ease;
}
.row-login .btn {
  transition: transform 200ms ease, opacity 200ms ease, width 260ms ease, border-radius 260ms ease, background 200ms ease;
}

.input {
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
}
.input::placeholder { color: rgba(255, 255, 255, 0.28); }
.input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.30);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.btn {
  height: 44px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.btn:hover { background: rgba(0, 0, 0, 0.30); border-color: var(--stroke-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}
.btn-primary:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.01);
}
.btn-primary:active { transform: scale(0.99); }

.btn-ghost {
  border-color: var(--stroke);
  background: transparent;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--stroke-strong); }

.btn-icon {
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.80);
}
.btn-icon .ico {
  width: 20px;
  height: 20px;
}
.btn-icon:hover { color: rgba(255,255,255,0.92); }

.btn-go {
  gap: 10px;
  padding: 0 18px;
  white-space: nowrap;
}
.btn-go .btn-go-ico {
  display: none;
}
.btn-go .ico {
  width: 18px;
  height: 18px;
}

/* "Ready" state: hide paste, expand input, morph button into round arrow */
.row-login.is-valid #paste {
  width: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
  border-width: 0;
  pointer-events: none;
}
.row-login.is-valid .input {
  flex: 1 1 auto;
}
.row-login.is-valid .btn-go {
  width: 44px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
}
.row-login.is-valid .btn-go .btn-go-text {
  display: none;
}
.row-login.is-valid .btn-go .btn-go-ico {
  display: inline-flex;
}

@keyframes pastePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.row-login.pasted #paste {
  animation: pastePop 260ms ease;
}

.msg { margin-top: 10px; min-height: 18px; color: var(--muted); }
.msg.err { color: var(--danger); }

.h2 { margin: 0; font-size: 16px; color: rgba(255, 255, 255, 0.86); }
.list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.16);
}
.li > div:first-child { min-width: 0; }
.li code {
  color: rgba(255, 255, 255, 0.86);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.li .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.li .actions .btn { white-space: nowrap; }
.small { height: 34px; padding: 0 10px; border-radius: 14px; }

.foot { margin-top: 18px; font-size: 13px; }

@media (max-width: 520px) {
  .wrap { padding-top: 32px; }
  .row { flex-wrap: wrap; }
  .input { flex: 1 1 100%; }
  .btn { flex: 1 1 auto; }
  .btn-icon { width: 100%; }
  .row-login.is-valid #paste { display: none; }
  .row-login.is-valid .btn-go { width: 100%; border-radius: 18px; padding: 0 18px; }
  .row-login.is-valid .btn-go .btn-go-text { display: inline; }
  .row-login.is-valid .btn-go .btn-go-ico { display: none; }

  .li {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .li .actions { justify-content: flex-start; }

  .corner-photo {
    width: min(120px, 28vw);
    top: 10px;
    right: 10px;
    opacity: 0.85;
  }
}

@media (max-width: 420px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .head h1 { font-size: 28px; }
  .card { padding: 14px; border-radius: 20px; }
  .input { height: 42px; }
  .btn { height: 42px; }
  .small { height: 32px; }
}

@media (max-width: 360px) {
  .corner-photo { display: none; }
}
