:root {
  color-scheme: dark;
  --bg: #050402;
  --panel: rgba(255, 247, 225, 0.065);
  --panel-strong: rgba(214, 174, 88, 0.14);
  --line: rgba(214, 174, 88, 0.22);
  --line-strong: rgba(246, 214, 143, 0.42);
  --text: #fff8e8;
  --muted: #b9ad92;
  --soft: #151109;
  --accent: #d6ae58;
  --accent-strong: #f6d68f;
  --gold-deep: #9d7327;
  --gold-soft: #fff0b7;
  --ok: #e8c979;
  --warn: #caa95d;
  --radius: 24px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(246, 214, 143, 0.09), transparent 30%),
    linear-gradient(135deg, #050402 0%, #130f08 45%, #030302 100%);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

button {
  color: inherit;
  -webkit-user-select: none;
  user-select: none;
}

a,
img,
svg {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px 34px;
}

.topbar {
  min-height: calc(72px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(5, 4, 2, 0.96), rgba(5, 4, 2, 0.76));
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(246, 214, 143, 0.36);
  background: #050402;
}

.brand span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app {
  padding: 12px 0 36px;
}

.hero {
  min-height: auto;
  display: grid;
  align-content: start;
  gap: clamp(14px, 3vw, 22px);
  padding: clamp(12px, 3vw, 28px) 0 34px;
}

.hero-logo {
  width: min(170px, 44vw);
  display: block;
  margin: 0 auto;
  border: 1px solid rgba(246, 214, 143, 0.34);
  border-radius: 28px;
  background: #050402;
}

.headline {
  margin: 0 0 10px;
  font-size: clamp(38px, 10vw, 78px);
  line-height: 0.96;
  letter-spacing: 0;
  text-align: center;
  color: var(--gold-soft);
  background: linear-gradient(110deg, #fff8e8 0%, #f4ce76 45%, #a77a28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lead {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
}

.choice-grid,
.admin-grid,
.stats-grid,
.photo-grid,
.event-grid,
.staff-grid {
  display: grid;
  gap: 14px;
}

.choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 6px;
}

.entry-panel {
  width: min(100%, 520px);
  margin: 4px auto 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.08), rgba(214, 174, 88, 0.035)),
    var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 20px;
}

.admin-entry {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-entry .ghost {
  width: 100%;
}

.admin-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.45fr);
  align-items: start;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(246, 214, 143, 0.13), rgba(255, 248, 232, 0.035)),
    var(--panel);
}

.admin-mini {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(214, 174, 88, 0.08);
  padding: 14px 16px;
}

.admin-mini span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-mini strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 16px;
}

.admin-shell {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(214, 174, 88, 0.045);
  padding: 12px;
}

.admin-content {
  margin-top: 12px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.event-grid,
.staff-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.panel,
.card,
.stat,
.photo-card,
.selection-card {
  box-shadow: none;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 248, 232, 0.065), rgba(214, 174, 88, 0.025)),
    var(--panel);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.panel {
  padding: 20px;
}

.card {
  min-height: 220px;
  padding: 22px;
}

.card h2,
.panel h2,
.section-title {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.1;
}

.card p,
.panel p,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.muted {
  margin: 0;
}

.kicker {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.actions,
.row,
.tabs,
.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.actions {
  margin-top: 18px;
}

.tabs {
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
}

.btn,
.ghost,
.danger,
.tab {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 232, 0.06);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.btn {
  color: #110c04;
  background: linear-gradient(135deg, #fff4c8 0%, #d6ae58 52%, #9d7327 100%);
  border-color: rgba(255, 240, 183, 0.7);
}

.ghost {
  color: var(--text);
  border-color: rgba(246, 214, 143, 0.24);
}

.danger {
  color: #fff8e8;
  background: rgba(157, 115, 39, 0.08);
  border-color: rgba(214, 174, 88, 0.26);
}

.small {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
}

.tab.active {
  background: rgba(214, 174, 88, 0.22);
  border-color: rgba(246, 214, 143, 0.48);
  color: #fff8e8;
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 248, 232, 0.075);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(246, 214, 143, 0.7);
}

.field select option {
  background: #151109;
}

.notice {
  border: 1px solid rgba(246, 214, 143, 0.28);
  background: rgba(214, 174, 88, 0.095);
  color: #fff8e8;
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}

.divider {
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 18px 0;
}

.workflow {
  display: grid;
  gap: 8px;
  margin: 14px 0 16px;
}

.workflow div {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(214, 174, 88, 0.055);
  padding: 12px;
}

.workflow span {
  grid-row: span 2;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f6d68f, #9d7327);
  color: #100c05;
  font-size: 12px;
  font-weight: 900;
}

.workflow strong {
  color: var(--text);
  font-size: 14px;
}

.workflow p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.success {
  border-color: rgba(246, 214, 143, 0.34);
  background: rgba(214, 174, 88, 0.11);
  color: #fff8e8;
}

.stat {
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.event-card {
  padding: 16px;
}

.event-card.active {
  border-color: rgba(246, 214, 143, 0.45);
  background: rgba(214, 174, 88, 0.12);
}

.event-card h3,
.selection-card h3 {
  margin: 0 0 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.ok {
  border-color: rgba(246, 214, 143, 0.34);
  background: rgba(214, 174, 88, 0.13);
  color: #fff8e8;
}

.pill.off {
  border-color: rgba(214, 174, 88, 0.16);
  background: rgba(0, 0, 0, 0.22);
  color: #a99d83;
}

.photo-card {
  overflow: hidden;
  position: relative;
}

.photo-card button {
  width: 100%;
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  display: block;
  object-fit: cover;
  background: #100c05;
}

.photo-meta {
  padding: 10px 11px 12px;
}

.photo-meta strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.photo-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.photo-actions .ghost,
.photo-actions .danger {
  width: auto;
  min-width: 0;
  flex: 1 1 92px;
}

.photo-card.selected {
  border-color: rgba(255, 240, 183, 0.78);
}

.photo-card.selected::after {
  content: "Избрана";
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff4c8, #d6ae58);
  color: #100c05;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.protected-photo {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.privacy-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.privacy-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(5, 4, 2, 0.86);
  backdrop-filter: blur(18px);
}

.privacy-viewer {
  width: min(100%, 820px);
  max-height: calc(100svh - 36px);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(246, 214, 143, 0.12), rgba(5, 4, 2, 0.94)),
    rgba(12, 10, 6, 0.96);
  padding: 14px;
  overflow: auto;
}

.privacy-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.privacy-toolbar h2 {
  margin: 0;
  font-size: 20px;
}

.privacy-photo-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #050402;
}

.privacy-photo-wrap img {
  width: 100%;
  max-height: 68svh;
  display: block;
  object-fit: contain;
}

.admin-preview .privacy-photo-wrap {
  background: #0b0804;
}

.print-caption {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.print-caption strong {
  color: var(--text);
}

.print-mode {
  display: grid;
  gap: 16px;
}

.print-mode-sheet {
  min-height: min(72svh, 860px);
  display: grid;
  align-items: center;
}

.print-mode-sheet img {
  width: 100%;
  max-height: 68svh;
  object-fit: contain;
}

.watermark-grid {
  position: absolute;
  inset: -20%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: space-around;
  gap: 26px;
  transform: rotate(-22deg);
  pointer-events: none;
  opacity: 0.22;
}

.watermark-grid span {
  color: #fff4c8;
  font-size: clamp(16px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
  white-space: nowrap;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.privacy-flash::before {
  content: "Защитен преглед";
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(5, 4, 2, 0.9);
  color: #f6d68f;
  font-size: clamp(28px, 8vw, 72px);
  font-weight: 900;
  pointer-events: none;
}

.selection-card {
  padding: 16px;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 2px;
}

.thumb-btn {
  width: 112px;
  flex: 0 0 112px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(214, 174, 88, 0.055);
  padding: 7px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.thumb-btn img {
  width: 72px;
  height: 72px;
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.thumb-btn span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sticky-bar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  gap: 10px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px;
  background: rgba(5, 4, 2, 0.86);
  backdrop-filter: blur(18px);
}

.sticky-bar .btn,
.sticky-bar .ghost {
  flex: 1;
}

.empty {
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

@media (max-width: 860px) {
  .choice-grid,
  .admin-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

  .admin-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-mini {
    min-width: 0;
  }

  .tabs {
    border-radius: 22px;
  }
}

@media (max-width: 520px) {
  .shell {
    padding-inline: 14px;
  }

  .topbar {
    min-height: calc(62px + env(safe-area-inset-top));
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .brand span {
    max-width: 160px;
    font-size: 14px;
  }

  .hero {
    align-content: start;
    gap: 14px;
    padding-top: 10px;
  }

  .hero-logo {
    width: min(132px, 38vw);
    border-radius: 20px;
  }

  .headline {
    font-size: clamp(34px, 11vw, 48px);
    margin-bottom: 8px;
  }

  .lead {
    font-size: 14px;
    line-height: 1.4;
  }

  .entry-panel {
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .photo-meta {
    padding: 9px;
  }

  .privacy-lightbox {
    padding: 10px;
  }

  .privacy-viewer {
    max-height: calc(100svh - 20px);
    border-radius: 22px;
  }

  .privacy-toolbar {
    align-items: flex-start;
  }

  .thumb-btn {
    width: 98px;
    flex-basis: 98px;
  }

  .actions .btn,
  .actions .ghost,
  .actions .danger,
  .inline-form .btn,
  .inline-form .ghost {
    width: 100%;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .print-sheet,
  .print-sheet * {
    visibility: visible !important;
  }

  .print-sheet {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    overflow: hidden !important;
  }

  .print-sheet img {
    max-width: 100vw !important;
    max-height: 92vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  .print-caption {
    position: fixed;
    left: 18px;
    right: 18px;
    bottom: 12px;
    border: 0;
    color: #111;
    background: transparent;
  }

  .print-caption strong {
    color: #111;
  }
}
