* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d0e10;
  --surface: #16181d;
  --surface-2: #1f2228;
  --border: #2a2e36;
  --text: #e8eaed;
  --text-dim: #9aa0a6;
  --accent: #1f7aec;
  --accent-h: #1668d4;
  --success: #1f9d55;
  --danger: #d23f31;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
.center { display: flex; align-items: center; justify-content: center; padding: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
h1 { font-size: 22px; font-weight: 600; text-align: center; }
h2 { font-size: 16px; font-weight: 500; color: var(--text-dim); }
input[type="number"], input[type="password"], input[type="text"], textarea {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
button, .btn {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover { background: var(--accent-h); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-link {
  background: transparent;
  color: var(--text-dim);
  border: none;
  font-size: 12px;
  padding: 4px 8px;
  width: auto;
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.6;
}
.btn-link:hover { opacity: 1; color: var(--danger); }
.err { color: var(--danger); font-size: 14px; text-align: center; min-height: 20px; }
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 14px 24px;
  background: var(--success);
  color: white;
  border-radius: 12px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

/* Upload page */
.app-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 16px 0;
}
.preview {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  overflow: hidden;
  position: relative;
}
.preview img { width: 100%; height: 100%; object-fit: contain; }
.preview .placeholder { font-size: 14px; padding: 16px; text-align: center; }
.cam-icon { font-size: 48px; opacity: 0.5; }
.hidden-input { display: none; }
.recent {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.recent h2 { margin-bottom: 12px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.recent-item:last-child { border-bottom: none; }
.recent-item .order { font-weight: 600; min-width: 60px; }
.recent-item .ts { color: var(--text-dim); flex: 1; font-size: 12px; }
.recent-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

/* Admin */
.admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.admin-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.admin-item img { width: 100%; height: 200px; object-fit: cover; cursor: pointer; }
.admin-item .meta { padding: 10px; font-size: 13px; }
.admin-item .meta .order { font-weight: 600; font-size: 16px; }
.admin-item .meta .ts { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.admin-item .del-btn {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px;
  background: rgba(0,0,0,0.6);
  border: none; color: white; border-radius: 50%;
  cursor: pointer; padding: 0;
  font-size: 16px; line-height: 28px;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 999;
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 95%; max-height: 95%; object-fit: contain; }

@media (max-width: 480px) {
  .admin-list { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .admin-item img { height: 140px; }
}
