:root{
  --bg:#0b1220;
  --card:#101a30;
  --text:#e7ecff;
  --muted:#aab4e6;
  --line: rgba(255,255,255,.10);
  --accent:#7aa7ff;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(122,167,255,.22), transparent 60%),
    radial-gradient(900px 500px at 100% 20%, rgba(122,255,199,.10), transparent 55%),
    var(--bg);
}

.wrap{ width:min(1180px, 92%); margin:0 auto; }

.top{
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

h1{ margin:0; font-size: clamp(22px, 3vw, 34px); letter-spacing: .2px; }

.actions{ display:flex; gap:10px; }
button{
  border: 1px solid var(--line);
  background: rgba(16,26,48,.75);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
button:hover{
  transform: translateY(-1px);
  border-color: rgba(122,167,255,.35);
  background: rgba(16,26,48,.95);
}
button.ghost{
  background: rgba(255,255,255,.06);
}

.controls{
  margin-top: 12px;
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

input{
  flex: 1 1 280px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(16,26,48,.65);
  color: var(--text);
  outline: none;
}

.meta{ color: var(--muted); font-size: 13px; }
.hint{ margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.grid{
  padding: 18px 0 34px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

/* Flip card */
.card{
  perspective: 1200px;
}

.card button{
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 18px;
}

.card-inner{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.15;
  border-radius: 18px;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow);
  outline: 1px solid var(--line);
  background: rgba(16,26,48,.75);
}

.card.is-flipped .card-inner{
  transform: rotateY(180deg);
}

.face{
  position:absolute;
  inset:0;
  border-radius: 18px;
  overflow:hidden;
  backface-visibility: hidden;
}

.front{
  display:flex;
  flex-direction:column;
}

.photo{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
  filter: saturate(1.02) contrast(1.02);
}

.front-overlay{
  position:absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8,12,22,.55);
  border: 1px solid rgba(255,255,255,.10);
}

.front-overlay span{
  font-size: 12px;
  color: rgba(231,236,255,.90);
}

.back{
  transform: rotateY(180deg);
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding: 16px;
  background:
    radial-gradient(500px 300px at 30% 0%, rgba(122,167,255,.18), transparent 60%),
    rgba(16,26,48,.92);
}

.name{
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .2px;
  line-height: 1.15;
}

.subname{
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.card button:focus-visible .card-inner{
  outline: 2px solid rgba(122,167,255,.65);
  outline-offset: 2px;
}

.error{
  color: #ffd5d5;
  background: rgba(255,0,0,.08);
  border: 1px solid rgba(255,0,0,.18);
  padding: 12px 14px;
  border-radius: 14px;
}

.footer{
  padding: 12px 0 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
