/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --c-primary:       #1e40af;
  --c-primary-h:     #1d4ed8;
  --c-primary-dark:  #1e3a8a;
  --c-accent:        #f59e0b;
  --c-accent-h:      #d97706;
  --c-bg:            #f1f5f9;
  --c-surface:       #ffffff;
  --c-text:          #0f172a;
  --c-text-2:        #475569;
  --c-text-3:        #94a3b8;
  --c-border:        #e2e8f0;
  --c-border-2:      #cbd5e1;
  --c-success:       #16a34a;
  --c-success-bg:    #dcfce7;
  --c-danger:        #dc2626;
  --c-danger-bg:     #fee2e2;
  --c-warn:          #d97706;
  --c-warn-bg:       #fef3c7;
  --c-blue-light:    #dbeafe;
  --radius:          12px;
  --radius-sm:       8px;
  --radius-xs:       6px;
  --shadow-sm:       0 1px 2px rgba(0,0,0,.06);
  --shadow:          0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:       0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg:       0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --nav-h:           64px;
  --transition:      0.18s ease;
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { text-decoration: none; color: inherit; }

img { vertical-align: middle; max-width: 100%; }

/* ─── Navbar ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-logo img { height: 40px; }

.nav-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-primary-dark);
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-user {
  font-size: 13px;
  color: var(--c-text-2);
  font-weight: 500;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-2);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--c-bg);
  color: var(--c-primary);
}

/* ─── Page Layout ────────────────────────────────────────────── */
.page {
  padding: calc(var(--nav-h) + 32px) 24px 48px;
  max-width: 960px;
  margin: 0 auto;
}

.page-wide {
  padding: calc(var(--nav-h) + 32px) 24px 48px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.4px;
}

/* ─── Back Button ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-primary);
  margin-bottom: 20px;
  transition: opacity var(--transition);
}

.back-link::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 10px;
  background: url("data:image/svg+xml,%3Csvg width='6' height='10' viewBox='0 0 6 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 1.0125L4.99063 0L0 5L4.99062 10L6 8.9875L2.02187 5L6 1.0125Z' fill='%231d4ed8'/%3E%3C/svg%3E") no-repeat center;
}

.back-link:hover { opacity: 0.75; }

/* ─── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-body { padding: 20px; }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

/* ─── List Items ─────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 8px; }

.item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.item:hover {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.item-content { flex: 1; min-width: 0; }

.item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 13px;
  color: var(--c-text-2);
  margin-top: 2px;
}

.item-arrow {
  color: var(--c-text-3);
  font-size: 18px;
  margin-left: 12px;
  flex-shrink: 0;
}

/* ─── Toolbar (search + action) ──────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 180px;
  position: relative;
}

.search-box::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='6.5' cy='6.5' r='5' stroke='%2394a3b8' stroke-width='1.5'/%3E%3Cpath d='m10 10 3.5 3.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder { color: var(--c-text-3); }

.search-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--c-primary-h); box-shadow: var(--shadow-md); }

.btn-accent {
  background: var(--c-accent);
  color: #fff;
}
.btn-accent:hover { background: var(--c-accent-h); box-shadow: var(--shadow-md); }

.btn-success {
  background: var(--c-success);
  color: #fff;
}
.btn-success:hover { opacity: 0.88; }

.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--c-text-2);
  border: 1px solid var(--c-border-2);
}
.btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }

.btn-outline-primary {
  background: transparent;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-outline-primary:hover { background: var(--c-blue-light); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Forms ──────────────────────────────────────────────────── */
.form-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}

.form-textarea { resize: vertical; min-height: 90px; }

.form-hint {
  font-size: 12px;
  color: var(--c-text-3);
  margin-top: 4px;
}

.form-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 24px 0;
}

/* ─── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error   { background: var(--c-danger-bg);  color: var(--c-danger);  border: 1px solid #fca5a5; }
.alert-success { background: var(--c-success-bg); color: var(--c-success); border: 1px solid #86efac; }
.alert-warn    { background: var(--c-warn-bg);    color: var(--c-warn);    border: 1px solid #fcd34d; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-warn    { background: var(--c-warn-bg);    color: var(--c-warn);    }
.badge-primary { background: var(--c-blue-light); color: var(--c-primary); }
.badge-muted   { background: var(--c-bg);         color: var(--c-text-2);  }

/* ─── Divider ────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--c-border); margin: 20px 0; }

/* ─── Modal (CSS :target) ────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop:target {
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
}

.modal-box {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  position: relative;
  padding: 28px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--c-text);
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 20px;
  color: var(--c-text-3);
  line-height: 1;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--c-bg); color: var(--c-text); }

/* ─── Medal Preview (add_event) ──────────────────────────────── */
.medal-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border: 2px dashed var(--c-border-2);
  border-radius: var(--radius-sm);
  min-height: 80px;
  align-items: center;
  background: var(--c-bg);
  transition: border-color var(--transition);
}

.medal-preview:has(input:focus) { border-color: var(--c-primary); }

.medal-preview img { height: 70px; border-radius: 6px; object-fit: cover; }

.add-medal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70px; height: 70px;
  border: 2px dashed var(--c-border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--c-surface);
  transition: border-color var(--transition), background var(--transition);
}

.add-medal-btn:hover {
  border-color: var(--c-primary);
  background: var(--c-blue-light);
}

.add-medal-btn img { width: 28px; height: 28px; opacity: 0.5; }

/* ─── Medal-video card (event view) ─────────────────────────── */
.medal-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}

.medal-card + .medal-card { margin-top: 12px; }

.medal-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  flex-shrink: 0;
}

.medal-card-info { flex: 1; }

.medal-stat {
  font-size: 13px;
  color: var(--c-text-2);
  margin-bottom: 4px;
}

.medal-stat b { color: var(--c-text); }

/* ─── Media files page ───────────────────────────────────────── */
.media-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text);
  margin: 20px 0 12px;
}

.video-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.video-card {
  padding: 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  min-width: 200px;
  max-width: 280px;
  position: relative;
}

.video-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 10px;
  word-break: break-word;
}

.video-card-actions { display: flex; gap: 8px; }

.video-status {
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.4;
}
.video-status--pending {
  color: var(--c-warn);
}
.video-status--error {
  color: var(--c-danger);
  font-weight: 500;
}

/* ─── Gallery (photos) ───────────────────────────────────────── */
.gallery-wrapper {
  margin-top: 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #0f172a;
}

/* Main image area */
.gallery-main {
  position: relative;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.gallery-main img#full-img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
}

.gallery-num {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  pointer-events: none;
}

/* Стрелки главного изображения */
.gallery-prev, .gallery-next {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  padding: 14px 12px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  z-index: 2;
  border: none;
  line-height: 1;
}
.gallery-prev { left: 0;  border-radius: 0 4px 4px 0; }
.gallery-next { right: 0; border-radius: 4px 0 0 4px; }
.gallery-prev:hover, .gallery-next:hover { background: rgba(0,0,0,.8); }

.gallery-delete-btn {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 10;
}

/* Подпись */
.gallery-caption {
  text-align: center;
  background: #1e293b;
  padding: 6px 16px;
  color: #94a3b8;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Thumbnail strip ────────────────────────────────────────── */
.thumb-strip {
  display: flex;
  align-items: center;
  background: #1e293b;
  padding: 8px 6px;
  gap: 4px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* Кнопки прокрутки стрипа */
.thumb-strip-btn {
  flex-shrink: 0;
  width: 30px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  user-select: none;
  line-height: 1;
}
.thumb-strip-btn:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.thumb-strip-btn:disabled { opacity: 0.2; cursor: default; }

/* Viewport — скрывает миниатюры, которые вне текущей страницы */
.thumb-viewport {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow: hidden;   /* JS управляет видимостью через .thumb-hidden */
  min-width: 0;
}

/* Одна миниатюра */
.thumb-item {
  flex-shrink: 0;
  width: 80px;
  height: 58px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  border: 2px solid transparent;
  transition: opacity var(--transition), border-color var(--transition);
}
.thumb-item:hover   { opacity: 0.85; }
.thumb-item.active  { opacity: 1; border-color: #3b82f6; }
.thumb-item.thumb-hidden { display: none; }

/* Счётчик страниц стрипа */
.thumb-page-info {
  flex-shrink: 0;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  padding: 0 4px;
  align-self: center;
}

/* ─── Video player ───────────────────────────────────────────── */
.vp-main {
  position: relative;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.vp-main video {
  display: block;
  width: 100%;
  max-height: 520px;
  background: #000;
}

/* Счётчик и стрелки переиспользуют .gallery-num, .gallery-prev, .gallery-next */

/* Полоса плейлиста */
.vp-strip { background: #1e293b; }

.vp-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  min-height: 64px;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
  border: 2px solid transparent;
  padding: 6px 4px;
  background: rgba(255,255,255,.05);
  transition: background var(--transition), border-color var(--transition);
  gap: 4px;
}
.vp-thumb-item:hover { background: rgba(255,255,255,.12); }
.vp-thumb-item.active {
  border-color: var(--c-primary);
  background: rgba(30,64,175,.25);
}

.vp-thumb-icon {
  font-size: 20px;
  color: rgba(255,255,255,.55);
  line-height: 1;
}
.vp-thumb-item.active .vp-thumb-icon { color: #fff; }

.vp-thumb-name {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80px;
}
.vp-thumb-item.active .vp-thumb-name { color: rgba(255,255,255,.9); }

/* Панель удаления (страницы администрирования) */
.vp-delete-bar {
  padding: 8px 12px;
  background: #1e293b;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* ─── Info grid ──────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .info-grid { grid-template-columns: 1fr; }
}

.info-item {
  padding: 14px 16px;
  background: var(--c-bg);
  border-radius: var(--radius-sm);
}

.info-item-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-3);
  margin-bottom: 4px;
}

.info-item-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--c-text);
  word-break: break-word;
}

/* ─── Auth page ──────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-logo img { height: 52px; }

.auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-2);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state-text {
  font-size: 15px;
  font-weight: 500;
}

/* ─── HTMX loading indicator ─────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator  { display: inline-block; }

/* ─── Spinner ────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ─── Functional classes (used by JS) ────────────────────────── */
.hide_object { display: none !important; }
.inst { display: block; }    /* search target wrapper */
.chosen_medal { outline: 3px solid var(--c-primary); border-radius: var(--radius-sm); }

/* ─── Responsive (admin/organizer) ──────────────────────────── */
@media (max-width: 640px) {
  .page, .page-wide { padding: calc(var(--nav-h) + 20px) 16px 32px; }
  .form-card { padding: 20px 18px; }
  .auth-card { padding: 28px 20px; }
  .nav { padding: 0 16px; }
  .nav-logo-text { display: none; }
  .nav-user { display: none; }
  .modal-box { padding: 20px 18px; }
  .medal-card { flex-direction: column; }
  .medal-card img { width: 80px; height: 80px; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════
   PUBLIC PAGES
   ═══════════════════════════════════════════════════════════════ */

/* ─── Banner slideshow ───────────────────────────────────────── */
.pub-banner {
  position: relative;
  width: 100%;
  height: 420px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 28px;
  background: #0f172a;
  user-select: none;
}

.banner-track { position: relative; width: 100%; height: 100%; }

.banner-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity .7s ease;
}
.banner-slide.active { opacity: 1; }

.banner-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 60px 28px 20px;
  background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 100%);
  color: #fff;
  pointer-events: none;
}
.banner-org {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  opacity: .75;
  margin-bottom: 5px;
}
.banner-event {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
}

.banner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.banner-arrow:hover { background: rgba(0,0,0,.6); }
.banner-prev { left: 16px; }
.banner-next { right: 16px; }

.banner-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 10;
}
.banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), transform var(--transition);
}
.banner-dot.active {
  background: #fff;
  transform: scale(1.35);
}

.banner-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.15);
  z-index: 10;
}
.banner-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
}

@media (max-width: 680px) {
  .pub-banner { height: 240px; border-radius: var(--radius-sm); }
  .banner-event { font-size: 17px; }
  .banner-arrow { width: 34px; height: 34px; font-size: 14px; }
  .banner-caption { padding: 40px 16px 14px; }
}
@media (max-width: 420px) {
  .pub-banner { height: 200px; }
  .banner-event { font-size: 14px; }
}

/* ─── Header ─────────────────────────────────────────────────── */
.pub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.pub-logo { display: flex; align-items: center; }
.pub-logo img { height: 36px; }

/* ─── Main wrapper ───────────────────────────────────────────── */
.pub-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* ─── Two-column layout ──────────────────────────────────────── */
.pub-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.pub-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 73px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.pub-sidebar-head {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-3);
  padding: 16px 16px 6px;
}

.pub-org-search { padding: 0 12px 10px; }

.pub-org-list {
  list-style: none;
  padding: 0 0 10px;
}

.pub-org-item a {
  display: block;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--c-text);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
  line-height: 1.3;
}
.pub-org-item a:hover { background: var(--c-bg); }
.pub-org-item.active a {
  background: var(--c-blue-light);
  border-left-color: var(--c-primary);
  color: var(--c-primary);
  font-weight: 600;
}

/* ─── Events area ────────────────────────────────────────────── */
.pub-content { flex: 1; min-width: 0; }

.pub-events-toolbar { margin-bottom: 20px; }

.pub-event-search { width: 100%; }

/* ─── Event card grid ────────────────────────────────────────── */
.pub-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.pub-event-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  overflow: hidden;
  text-decoration: none;
  color: var(--c-text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.pub-event-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.pub-event-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--c-bg);
}

.pub-event-card-img-ph {
  width: 100%;
  height: 160px;
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.pub-event-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pub-event-card-org {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-primary);
}

.pub-event-card-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}

.pub-event-card-desc {
  font-size: 13px;
  color: var(--c-text-2);
  line-height: 1.45;
}

/* ─── Pagination ─────────────────────────────────────────────── */
.pub-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pub-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.pub-page-btn:hover { background: var(--c-bg); border-color: var(--c-primary); color: var(--c-primary); }
.pub-page-btn.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); cursor: default; }

/* ─── Event detail ───────────────────────────────────────────── */
.pub-event-detail { max-width: 960px; margin: 0 auto; }

.pub-event-hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin: 20px 0 36px;
  flex-wrap: wrap;
}

.pub-medals-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.pub-medal-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  padding: 8px;
}

.pub-event-info { flex: 1; min-width: 220px; }

.pub-event-org {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-primary);
  margin-bottom: 6px;
}

.pub-event-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 14px;
}

.pub-event-desc {
  font-size: 15px;
  color: var(--c-text-2);
  line-height: 1.7;
  white-space: pre-line;
}

.pub-section-title {
  font-size: 17px;
  font-weight: 600;
  margin: 36px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--c-border);
}

/* ─── Video cards (public) ───────────────────────────────────── */
.pub-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.pub-video-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.pub-video-card-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Auth switch link ───────────────────────────────────────── */
.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--c-text-2);
}
.auth-switch a { color: var(--c-primary); font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ─── form-input-sm ──────────────────────────────────────────── */
.form-input-sm {
  padding: 7px 12px;
  font-size: 13px;
}

/* ─── Public responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  .pub-sidebar { width: 220px; }
  .pub-event-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 680px) {
  .pub-layout { flex-direction: column; }

  .pub-sidebar {
    width: 100%;
    position: static;
    max-height: none;
    border-radius: var(--radius);
  }

  .pub-sidebar-head { display: none; }

  .pub-org-list {
    display: flex;
    overflow-x: auto;
    padding: 0 10px 10px;
    gap: 6px;
    scrollbar-width: thin;
  }
  .pub-org-list::-webkit-scrollbar { height: 4px; }

  .pub-org-item { flex-shrink: 0; }

  .pub-org-item a {
    white-space: nowrap;
    border-left: none;
    border-radius: var(--radius-xs);
    padding: 6px 14px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
  }
  .pub-org-item.active a {
    background: var(--c-blue-light);
    border-color: var(--c-primary);
    color: var(--c-primary);
  }

  .pub-event-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .pub-event-card-img, .pub-event-card-img-ph { height: 120px; }
  .pub-event-title { font-size: 20px; }
}

@media (max-width: 420px) {
  .pub-header { padding: 10px 14px; }
  .pub-main   { padding: 16px 12px 40px; }
  .pub-event-grid { grid-template-columns: 1fr; }
  .pub-medal-img { width: 80px; height: 80px; }
}

/* ─── Footer ─────────────────────────────────────────────────── */
.pub-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 18px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--c-text-2);
}

.pub-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pub-footer-link {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition);
}
.pub-footer-link:hover { opacity: 0.75; text-decoration: underline; }

.pub-footer-sep {
  color: var(--c-text-3);
  font-size: 15px;
}

.pub-footer-brand {
  color: var(--c-text-2);
}
