:root {
  --bg: #10131a;
  --panel: #171b24;
  --panel-border: #2a3242;
  --text: #f1f5ff;
  --muted: #a8b3cc;
  --accent: #6b9cff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top right, #1a2233, var(--bg) 40%);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 14, 0.82);
  display: grid;
  place-items: center;
  z-index: 50;
}
.overlay-card {
  width: min(420px, 92vw);
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #141a29;
  display: grid;
  gap: 0.5rem;
}

.app-header {
  padding: 1.5rem 1.5rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.app-header h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.2rem); }
.app-header p { margin-top: 0.35rem; color: var(--muted); }
.coffee-btn {
  text-decoration: none;
  background: #2a3a61;
  color: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
  font-weight: 600;
  transition: transform 120ms ease, filter 150ms ease;
}

.coffee-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.layout { display: grid; grid-template-columns: 360px 1fr; gap: 1rem; padding: 1rem 1.5rem 1.5rem; }
.panel { background: linear-gradient(180deg, #1b2130, var(--panel)); border: 1px solid var(--panel-border); border-radius: 14px; padding: 1rem; }
.controls { display: flex; flex-direction: column; gap: 0.55rem; }
.controls label { margin-top: 0.35rem; color: var(--muted); font-size: 0.9rem; }
.controls h3 { margin: 0.45rem 0 0; font-size: 0.95rem; color: var(--muted); }

input, button, select {
  border-radius: 10px;
  border: 1px solid #3b4761;
  background: #111728;
  color: var(--text);
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}
button { cursor: pointer; border: 0; background: var(--accent); font-weight: 600; transition: transform 120ms ease, filter 150ms ease, box-shadow 150ms ease; }
button.secondary { background: #2d3550; }
button.danger { background: #5a2734; }
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 6px 14px rgba(9, 13, 24, 0.35);
}
.toolbar-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.25rem; }
.upload-meta { color: var(--muted); font-size: 0.82rem; margin: 0.1rem 0 0.35rem; }

.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; max-height: 170px; overflow: auto; }
.item-list li { background: #141a2a; border: 1px solid #2f3a51; border-radius: 10px; padding: 0.45rem 0.55rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; }
.item-actions { display: flex; gap: 0.35rem; }
.item-actions button { padding: 0.3rem 0.45rem; font-size: 0.78rem; }
.empty-item { color: var(--muted); }

.admin-login-row { display: grid; grid-template-columns: 1fr auto auto; gap: 0.4rem; }
.admin-panel form { display: grid; gap: 0.45rem; padding: 0.55rem; border: 1px solid #2f3a51; border-radius: 10px; background: #101525; }

.board-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.8rem; }
.board-header h2 { margin: 0; }
#boardMeta { color: var(--muted); font-size: 0.9rem; }
.board { width: 100%; min-height: 65vh; border-radius: 12px; padding: 0.5rem; background: rgba(10, 14, 24, 0.55); }
.board-wrapper { overflow-x: auto; }
.board { width: max-content; min-width: 100%; }
.board-masonry { display: flex; gap: 0.65rem; align-items: stretch; }
.masonry-column { display: flex; flex-direction: column; gap: 0.65rem; justify-content: flex-start; }
.tile { position: relative; border-radius: 11px; overflow: hidden; border: 1px solid #2f3a51; background: #161d31; }
.tile img { display: block; width: 100%; height: auto; }
.tile-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: rgba(18, 22, 35, 0.85);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}
.tile:hover .tile-delete { opacity: 1; pointer-events: auto; }
.masonry-filler { border-radius: 11px; background: transparent; flex: 0 0 auto; }

@media (max-width: 1020px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .toolbar-row { grid-template-columns: 1fr; }
  .app-header { flex-direction: column; }
}
