/* FotoSoutěž — "Katalog" design system */
@import url('./fonts/fonts.css');

:root {
  --paper: #f6f4ef;
  --paper-2: #edeae2;
  --card: #fdfcf8;
  --ink: #16150f;
  --ink-2: #6b675c;
  --line: #d9d4c7;
  --line-soft: #e7e3d8;
  --accent: #d4380f;
  --ok: #1f7a3d;
  --warn: #9a6700;
  --bad: #c22f1e;
  --heart: #d4380f;
  --radius: 6px;
  --radius-sm: 4px;
  --tabbar-h: 60px;
  --topbar-h: 58px;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.hidden { display: none !important; }

#app { position: relative; z-index: 1; min-height: 100dvh; }
#view {
  max-width: 620px;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 18px) 18px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#view > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
#view > *:nth-child(2) { animation-delay: .05s; }
#view > *:nth-child(3) { animation-delay: .1s; }
#view > *:nth-child(4) { animation-delay: .15s; }
#view > *:nth-child(5) { animation-delay: .2s; }
#view > *:nth-child(n+6) { animation-delay: .25s; }

#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-tag {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  color: var(--accent); margin-left: 4px; letter-spacing: 0;
}
#topbar .who {
  flex: 1; min-width: 0; margin: 0 8px;
  font-size: 11.5px; color: var(--ink-2); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#topbar .who b { color: var(--ink); font-weight: 600; }
.icon-btn { width: 38px; height: 38px; padding: 0; }
.menu-open { background: var(--paper-2); }
.menu-overlay {
  position: fixed; inset: 0; z-index: 60; background: transparent;
}
.menu-anchor { position: absolute; top: 0; right: 0; width: 100%; height: 100%; }
.menu-panel {
  position: absolute; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 4px); right: 12px;
  width: 230px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 44px rgba(0,0,0,.28);
  overflow: hidden; animation: rise .16s ease;
  z-index: 61;
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 13px 16px; background: transparent; border: none;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 500; color: var(--ink);
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.menu-item:last-child { border-bottom: none; }
.menu-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.menu-item.danger { color: var(--bad); }
.menu-item:active { background: var(--paper-2); }
.menu-btn { position: relative; z-index: 62; }
.menu-btn svg { width: 20px; height: 20px; }

#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); position: relative;
  -webkit-tap-highlight-color: transparent;
  padding-top: 2px;
}
#tabbar a svg { width: 21px; height: 21px; stroke-width: 1.6; }
#tabbar a.active { color: var(--ink); }
#tabbar a.active::after {
  content: ''; position: absolute; bottom: 9px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
#tabbar .badge {
  position: absolute; top: 6px; right: calc(50% - 22px);
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--paper);
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
  letter-spacing: 0;
}

h1.page-title {
  font-family: var(--serif);
  font-size: 27px; font-weight: 600; letter-spacing: -.01em;
  margin: 4px 0 6px;
}
.subtle { color: var(--ink-2); font-size: 13px; }
.section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-2); margin: 26px 1px 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  border-radius: 999px;
  padding: 10px 18px; font-weight: 600; font-size: 14px; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease, background .15s ease, color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.ghost { border-color: var(--line); color: var(--ink-2); }
.btn.small { padding: 6px 13px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-2); margin-bottom: 6px;
}
.input, select.input, textarea.input {
  width: 100%;
  background: transparent;
  border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 2px;
  font-size: 16px;
  outline: none;
  transition: border-color .2s ease;
}
.input:focus { border-bottom-color: var(--ink); }
textarea.input { resize: vertical; min-height: 64px; }
select.input, input[type="file"].input, input[type="datetime-local"].input {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--card);
}
input[type="file"].input { font-size: 13.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor;
  background: transparent;
}
.chip.pending { color: var(--warn); }
.chip.approved { color: var(--ok); }
.chip.rejected { color: var(--bad); }
.chip.neutral { color: var(--ink-2); border-color: var(--line); }

.banner {
  border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 20px;
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.banner .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.banner.open { border-color: var(--ink); }
.banner.open .dot { background: var(--ok); animation: pulse 1.8s infinite; }
.banner.closed { border-style: dashed; color: var(--ink-2); }
.banner.closed .dot { background: var(--line); }
@keyframes pulse { 50% { opacity: .35; } }

.cat-card { padding: 0; overflow: hidden; }
.cat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
}
.cat-head h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.cat-body { padding: 12px 16px 16px; }
.photo-preview {
  width: 100%; border-radius: 2px; margin-bottom: 12px;
  max-height: 280px; object-fit: cover; background: var(--paper-2);
  border: 1px solid var(--line-soft);
}
.title-line { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.title-line b { color: var(--ink); font-weight: 600; font-family: var(--serif); }

.seg {
  display: flex; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px; margin-bottom: 18px; gap: 2px; background: var(--card);
}
.seg button {
  flex: 1; border: none; background: transparent; color: var(--ink-2);
  padding: 8px 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  border-radius: 999px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, color .15s ease;
}
.seg button.active { background: var(--ink); color: var(--paper); }

.admin-panel .seg { border-radius: 6px; }
.admin-panel .seg button { border-radius: 4px; }
.admin-panel .card { border-radius: 4px; }

.feed-card { padding: 0; overflow: hidden; }
.feed-wrap { position: relative; background: var(--card); padding: 10px 10px 0; }
.feed-img { width: 100%; max-height: 460px; object-fit: contain; background: var(--paper-2); }
.rank-no {
  position: absolute; top: 18px; left: 18px; z-index: 2;
  font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 15px;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px;
}
.feed-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink); color: var(--paper);
  font-family: var(--serif); font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.feed-head .meta { min-width: 0; }
.feed-head .meta .name { font-weight: 600; font-size: 14.5px; }
.feed-head .meta .team {
  font-size: 10.5px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .1em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-head .cat-tag {
  margin-left: auto; font-size: 10.5px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .1em; white-space: nowrap;
}
.feed-foot {
  display: flex; align-items: center; padding: 10px 16px 14px; gap: 10px;
}
.feed-foot .ftitle {
  font-family: var(--serif); font-size: 15.5px; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.like-btn {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: transparent;
  border-radius: 999px; padding: 6px 13px;
  font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .08s ease, border-color .15s, color .15s;
  flex-shrink: 0;
}
.like-btn:active { transform: scale(1.1); }
.like-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.like-btn.liked { color: var(--heart); border-color: var(--heart); }
.like-btn.liked svg { fill: var(--heart); stroke: var(--heart); }
.like-btn.locked { opacity: .35; }
.like-pop { animation: pop .25s ease; }
@keyframes pop { 40% { transform: scale(1.3); } }

.score-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
  font-size: 13.5px; font-weight: 700; color: var(--ink);
}
.score-stars { color: var(--accent); }
.score-count { color: var(--ink-2); font-weight: 500; font-size: 12px; }
.score-pill.no-score { color: var(--ink-2); font-weight: 500; font-size: 12px; }

.stars { display: flex; gap: 6px; }
.star-btn {
  background: transparent; border: none; padding: 4px; cursor: pointer;
  color: var(--ink-2); -webkit-tap-highlight-color: transparent;
}
.star-btn svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.star-btn.on { color: var(--accent); }
.star-btn.on svg { fill: currentColor; stroke: var(--accent); }

.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.member-row:last-child { border-bottom: none; }
.member-info { flex: 1; min-width: 0; }
.member-info .nm {
  font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center;
}
.count-pill { font-size: 12px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.thumb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px; padding: 12px 2px 16px;
}
.thumb-grid figure { position: relative; margin: 0; }
.thumb-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 2px;
  border: 1px solid var(--line-soft);
}
.thumb-grid .chip {
  position: absolute; top: 6px; left: 6px; font-size: 9.5px; padding: 2px 7px;
  background: color-mix(in srgb, var(--card) 85%, transparent);
}

.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 2px; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: none; }
.list-main { flex: 1; min-width: 0; }
.list-main .t1 { font-weight: 600; font-size: 15px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.list-main .t2 { font-size: 12.5px; color: var(--ink-2); }

.user-row { flex-wrap: wrap; row-gap: 10px; }
.user-row .list-main { flex: 1 1 100%; }
.user-controls {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  width: 100%;
}
.user-controls select.input { flex: 1 1 auto; max-width: 170px; }

.mod-photo {
  width: 100%; max-height: 340px; object-fit: contain; background: var(--paper-2);
  border: 1px solid var(--line-soft); border-radius: 2px; margin: 12px 0;
}

.empty {
  text-align: center; color: var(--ink-2); padding: 52px 20px;
  font-family: var(--serif); font-style: italic; font-size: 16.5px;
}
.empty .big { display: none; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(22, 21, 15, .45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadein .15s ease;
}
.modal {
  width: 100%; max-width: 620px;
  background: var(--paper);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 14px 14px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto;
  animation: slideup .22s cubic-bezier(.2,.7,.2,1);
}
.modal h2 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 16px; }
@media (min-width: 500px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 10px; border-bottom: 1px solid var(--line); max-width: 460px; }
}
@keyframes fadein { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(26px); opacity: .6; } }

#toasts {
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px);
  left: 0; right: 0; z-index: 99;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--paper);
  font-size: 13.5px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px;
  animation: slideup .2s ease;
  max-width: 90%;
}
.toast.err { background: var(--bad); }

.code-box {
  font-family: var(--serif); font-size: 28px; letter-spacing: 10px;
  text-align: center; font-weight: 600;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 16px; margin: 14px 0;
  color: var(--ink);
}

.spinner {
  width: 24px; height: 24px; margin: 34px auto;
  border: 1.5px solid var(--line); border-top-color: var(--ink);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

body.login-page #view {
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.login-wrap {
  max-width: 360px; margin: 0 auto; padding: 0 20px;
  flex: 1; display: flex; flex-direction: column; justify-content: center;
}
.login-wrap form { display: flex; flex-direction: column; }
.logo {
  text-align: center;
  font-family: var(--serif); font-weight: 700; font-size: 24px; letter-spacing: -.015em;
  line-height: 1.3; margin-bottom: 22px; padding: 0 8px;
}
.login-sub {
  text-align: center; color: var(--ink-2); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .16em; margin-bottom: 34px;
}

[data-theme="dark"] {
  --paper: #131210;
  --paper-2: #1d1b17;
  --card: #1a1813;
  --ink: #ece9e1;
  --ink-2: #948f81;
  --line: #2c2a23;
  --line-soft: #383529;
  --accent: #ff6a45;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --heart: #ff5a36;
}
