:root {
  --bg: #f3eee6;
  --ink: #2b261f;
  --muted: #6d6458;
  --card: #fffdf8;
  --line: #ddd4c6;
  --green: #c7d9c6;
  --green-ink: #2f4a32;
  --green-bd: #8aaa88;
  --red: #e6d0cb;
  --red-ink: #5a3330;
  --red-bd: #c49690;
  --accent: #6d8a6c;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Liberation Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.app-body { min-height: 100vh; }
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: #fffaf3;
  border-bottom: 1px solid var(--line);
}
.top.sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(70,50,20,.06);
}
.top .year {
  display: inline-block;
  background: #efe6d6;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 1rem;
  font-weight: 600;
  margin-right: 8px;
  vertical-align: middle;
}
.top h1 { flex: 1; margin: 0; font-size: 1.7rem; font-weight: 650; }
.logout-form { margin: 0; }
.linkish {
  background: none; border: 0; color: var(--muted);
  font-size: 0.95rem; cursor: pointer; text-decoration: underline;
}
.back-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 1.15rem;
  font-weight: 650;
}
.year-inline { color: var(--muted); font-weight: 500; }
.empty { text-align: center; font-size: 1.3rem; padding: 4rem 1rem; color: var(--muted); }

/* Login */
.login-body, .scene { height: 100vh; overflow: hidden; }
.scene { position: relative; }
.scene .bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 62%;
}
.scene .color { opacity: 0; transition: opacity 2.4s ease; }
.scene.ok .color { opacity: 1; }
.login-panel {
  position: absolute;
  left: 50%;
  top: 11%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 2;
}
.login-hint {
  display: inline-block;
  margin: 0 0 18px;
  padding: 8px 22px;
  color: #efe8dc;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  background: #3c3833;
  border-radius: 8px;
}
.boxes { display: flex; gap: 20px; justify-content: center; }
.box {
  width: 184px; height: 208px;
  font-size: 5rem;
  text-align: center;
  text-transform: uppercase;
  border: 3px solid #2b261f;
  border-radius: 16px;
  background: rgba(255,250,242,0.92);
  color: #6e2a32;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.box:focus { outline: 3px solid #6d8a6c; }
.scene.bad { animation: drzyj 0.55s ease; }
@keyframes drzyj {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-14px); }
  40% { transform: translateX(14px); }
  60% { transform: translateX(-9px); }
  80% { transform: translateX(9px); }
}
.scene.ok .login-panel { opacity: 0; transition: opacity .6s ease .2s; pointer-events: none; }

/* Album grid */
.album-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  padding: 28px;
}
.album-card {
  display: block;
  width: 500px;
  max-width: calc(100% - 24px);
  flex: 0 1 500px;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 18px rgba(70,50,20,.08);
  border: 1px solid var(--line);
  transition: transform .25s ease, box-shadow .25s ease;
}
.album-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(70,50,20,.16); }
.album-cover { height: 210px; overflow: hidden; background: #e6dfd3; }
.album-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s ease;
}
.album-card:hover .album-cover img { transform: scale(1.12); }
.cover-placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.2rem;
}
.album-meta { padding: 14px 16px 16px; }
.album-meta .year {
  display: inline-block;
  background: #efe6d6;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: .95rem;
  margin-bottom: 6px;
}
.album-meta strong { display: block; font-size: 1.25rem; line-height: 1.25; }
.album-meta .more { display: block; margin-top: 6px; color: var(--accent); font-size: .98rem; }

/* Album media */
.kategoria { padding: 8px 28px 24px; }
.kategoria-blok {
  margin-top: 10px;
  padding-top: 18px;
  border-top: 4px solid #cbbfaa;
}
.kategoria h2 {
  margin: 0 0 14px;
  font-size: 1.45rem;
  padding-left: 10px;
  border-left: 8px solid var(--accent);
}
.media-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.tile {
  position: relative;
  border: 0;
  padding: 0;
  background: #ddd;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  width: 400px;
  max-width: calc(100% - 8px);
  flex: 0 1 400px;
  aspect-ratio: 4/3;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .play {
  position: absolute; inset: 0; margin: auto;
  width: 70px; height: 70px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; padding-left: 6px;
}
.kind-label {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(40,30,20,.72); color: #fff;
  font-size: .85rem; padding: 3px 8px; border-radius: 8px;
}
.kind-label.photo { background: rgba(80,90,70,.7); }

.lightbox {
  position: fixed; inset: 0; background: rgba(20,16,12,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.lightbox[hidden] { display: none; }
.lb-frame {
  position: relative;
  max-width: min(1760px, 96vw);
  max-height: 86vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.lb-frame img, .lb-frame video {
  max-width: 94vw; max-height: 78vh;
  display: none; border-radius: 8px; background: #000;
}
.lb-frame.show-img img { display: block; }
.lb-frame.show-vid video { display: block; }
.lb-close, .lb-dl {
  font-size: 1.15rem; padding: 10px 18px; border-radius: 12px;
  text-decoration: none; border: 0; cursor: pointer;
}
.lb-close { position: fixed; top: 18px; right: 24px; background: #fff; color: #222; z-index: 60; }
.lb-dl { background: var(--accent); color: #fff; font-weight: 650; }

/* Admin */
.admin-help { margin: 16px 28px 8px; color: var(--muted); }
#tlum-info { font-style: italic; }
.admin-tools { display: flex; align-items: center; }
.admin-menu-cb { position: absolute; opacity: 0; pointer-events: none; }
.hamburger {
  display: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #efe6d6;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--ink); border-radius: 2px;
}
.admin-nav { display: flex; gap: 16px; align-items: center; }
.admin-nav a, .admin-nav .linkish { color: var(--accent); font-weight: 600; text-decoration: underline; }
.bulk { padding: 8px 28px 16px; display: flex; gap: 12px; }
.bulk button, .toggle button {
  border: 0; border-radius: 12px; padding: 10px 16px;
  font-size: 1rem; cursor: pointer;
}
.bulk button { background: #e8dfd0; }
.bulk button.danger { background: #e6d0cb; color: #5a3330; }
.admin-list { padding: 0 28px 40px; display: grid; gap: 12px; }
.admin-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 3px solid var(--red-bd);
  background: var(--red);
  color: var(--red-ink);
}
.admin-card.family {
  border-color: var(--green-bd);
  background: var(--green);
  color: var(--green-ink);
}
.admin-card.busy {
  outline: 2px dashed #5a5348;
  opacity: 0.92;
}
.wait-hint { font-weight: 650; margin-top: 6px; }
.admin-card img, .admin-ph {
  width: 120px; height: 80px; object-fit: cover; border-radius: 10px; background: #eee;
}
.admin-ph { display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.admin-card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.admin-card .rok { opacity: .8; margin-right: 8px; }
.toggle { display: flex; gap: 8px; }
.toggle .on { background: #b7cbb6; color: var(--green-ink); }
.toggle .off { background: #d9b6b1; color: var(--red-ink); }
.toggle .on.active, .toggle .off.active { outline: 3px solid #2b261f; }
.bar {
  height: 10px; background: rgba(255,255,255,.45); border-radius: 99px; overflow: hidden; margin-top: 8px;
}
.bar > span { display: block; height: 100%; background: #4d6b4c; width: 0; }
.done-mark { font-size: 1.3rem; margin-left: 6px; }
.meta-line { font-size: .92rem; margin-top: 4px; }

.log-table { width: calc(100% - 56px); margin: 20px 28px; border-collapse: collapse; font-size: .92rem; }
.log-table th, .log-table td { border-bottom: 1px solid var(--line); text-align: left; padding: 6px 8px; vertical-align: top; }

.settings {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(30,26,22,.55);
  display: flex; align-items: flex-start; justify-content: center;
  overflow: auto; padding: 24px 12px;
}
.settings[hidden] { display: none; }
.settings-box {
  width: min(560px, 100%);
  background: #fffaf3;
  border-radius: 16px;
  padding: 20px 22px 16px;
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.settings-box h2 { margin: 0 0 14px; }
.settings-box label {
  display: block; margin: 0 0 10px; font-size: .95rem; color: var(--muted);
}
.settings-box input, .settings-box select {
  display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 1rem; background: #fff;
}
.settings-actions { display: flex; gap: 10px; margin-top: 12px; }
.settings-actions button {
  border: 0; border-radius: 12px; padding: 10px 16px; font-size: 1rem; cursor: pointer;
}
.settings-actions button[type="submit"] { background: var(--accent); color: #fff; }
.settings-actions button[type="button"] { background: #e8dfd0; }
.settings-err { color: #8a3a34; margin: 8px 0 0; }

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #3c3833;
  color: #f3eee6;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 650;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  pointer-events: none;
}
html.podglad-open, body.podglad-open {
  overflow: hidden;
  height: 100%;
}
.podglad {
  position: fixed; inset: 0; z-index: 80;
  background: #2b261f;
  display: flex; flex-direction: column;
  overflow: hidden;
  height: 100dvh;
}
.podglad[hidden] { display: none; }
.podglad-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #3c3833; color: #efe8dc;
}
.podglad-bar button {
  background: var(--accent); color: #fff; border: 0;
  border-radius: 12px; padding: 10px 16px; font-size: 1rem; cursor: pointer;
}
.podglad iframe {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 0;
  background: var(--bg);
}

@media (max-width: 700px) {
  .login-panel { top: 6%; }
  .box { width: 72px; height: 82px; font-size: 2rem; }
  .admin-card { grid-template-columns: 1fr; }
  .admin-body .hamburger { display: flex; }
  .admin-body .admin-tools { position: relative; }
  .admin-body .admin-nav {
    display: none;
    position: absolute;
    right: 0; top: 48px;
    min-width: 220px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fffaf3;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(70,50,20,.14);
    z-index: 40;
    padding: 6px 0;
  }
  .admin-body .admin-menu-cb:checked ~ .admin-nav { display: flex; }
  .admin-body .admin-nav a,
  .admin-body .admin-nav .linkish,
  .admin-body .admin-nav .logout-form {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 18px;
    font-size: 1.1rem;
    text-decoration: none;
    border: 0;
    background: none;
  }
  .admin-body .admin-nav .logout-form { margin: 0; }
  .admin-body .admin-nav .logout-form .linkish { width: 100%; }
  .admin-body.podglad-open .hamburger { display: none; }
}
