:root {
  --board-bg-x: 50%;
  --board-bg-y: 38%;
  --polls-panel-width: min(920px, 94vw);
  /* Поднимаем блок результатов опросов выше */
  --polls-panel-margin-top: clamp(4px, 1.2vh, 8px);
  --bg: #1d1410;
  --panel: rgba(32, 21, 15, 0.88);
  --panel-border: rgba(220, 176, 98, 0.35);
  --text-main: #f7ead2;
  --text-soft: #dcc39d;
  --accent: #d8a757;
  --accent-2: #8f5c2f;
  --ok: #79c57d;
  --danger: #c56c6c;
  /* Текст опросов: светлый с тёмной тенью для контраста на доске */
  --poll-ink: #f8f3e8;
  --poll-ink-soft: #ece2d1;
  --poll-ink-shadow: 0 1px 0 rgba(0, 0, 0, 0.88), 0 0 8px rgba(0, 0, 0, 0.48),
    0 2px 4px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html {
  font-size: 112.5%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Caveat", cursive;
  font-size: 1.5rem;
  line-height: 1.35;
  font-weight: 500;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 22% 18%, rgba(143, 92, 47, 0.14), transparent 38%),
    radial-gradient(circle at 78% 8%, rgba(216, 167, 87, 0.08), transparent 32%),
    linear-gradient(160deg, rgba(18, 13, 10, 0.35) 0%, rgba(24, 18, 14, 0.28) 50%, rgba(12, 9, 7, 0.42) 100%),
    image-set(
      url("bg-bulletin-board.webp") type("image/webp"),
      url("bg-bulletin-board.png") type("image/png")
    );
  background-position:
    center center,
    center center,
    center center,
    var(--board-bg-x) var(--board-bg-y);
  background-size: auto, auto, auto, cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

.overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 31px,
      rgba(0, 0, 0, 0.1) 32px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 47px,
      rgba(0, 0, 0, 0.07) 48px
    );
  opacity: 0.18;
  will-change: transform;
  animation: overlayDrift 28s ease-in-out infinite alternate;
}

.layout {
  width: min(1180px, 96vw);
  margin: 0 auto;
  padding: 8px 12px 36px;
}

.hero h1,
.polls-panel h2 {
  margin: 0;
  font-family: "Caveat", cursive;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero {
  width: 100%;
  margin: 0;
  padding: 6px 10px 7px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(216, 167, 87, 0.12), transparent 40%),
    var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.hero h1 {
  text-align: left;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.05;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.hero-auth {
  min-width: auto;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.hero-auth-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.hero-auth-actions button {
  padding: 4px 8px;
  font-size: 0.92rem;
  line-height: 1;
  border-radius: 6px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
  padding: 10px;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal__content {
  position: relative;
  width: min(460px, 95vw);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  padding: 14px;
}

.auth-modal__content h3 {
  margin: 0 0 10px;
  font-size: 1.7rem;
}

.auth-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  padding: 0;
}

.auth-form--modal {
  grid-template-columns: 1fr;
}

.auth-form input {
  width: 100%;
  border: 1px solid rgba(216, 167, 87, 0.5);
  border-radius: 8px;
  background: rgba(23, 16, 12, 0.82);
  color: var(--text-main);
  padding: 8px 10px;
  font: inherit;
}

.register-status {
  margin-top: 4px;
  color: var(--text-soft);
  min-height: 1.2em;
}

.auth-userbar {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-soft);
  min-height: 1.1em;
}

.auth-hint {
  margin: 4px 0 0;
  text-align: right;
  font-size: 0.86rem;
  color: var(--text-soft);
  opacity: 0.9;
}

/* Блок опросов: без фоновой картинки, прозрачный, шире, по центру */
.polls-panel {
  width: 100%;
  max-width: var(--polls-panel-width);
  margin: var(--polls-panel-margin-top) auto 0;
  padding: 16px 8px 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-weight: 600;
}

.polls-panel h2 {
  color: var(--poll-ink);
  text-shadow: var(--poll-ink-shadow);
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  font-weight: 700;
}

.polls-panel .status {
  color: var(--poll-ink);
  text-shadow: var(--poll-ink-shadow);
  font-size: 1.42rem;
  font-weight: 700;
}

.polls-panel .poll {
  border: 1px solid rgba(40, 32, 24, 0.55);
  background: rgba(32, 22, 16, 0.48);
  backdrop-filter: blur(2px);
  color: var(--poll-ink);
  font-weight: 600;
}

.polls-panel .poll h3 {
  color: var(--poll-ink);
  text-shadow: var(--poll-ink-shadow);
  font-size: 1.65rem;
  font-weight: 700;
}

.polls-panel .option-row {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--poll-ink);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.88),
    0 0 8px rgba(0, 0, 0, 0.48),
    0 2px 3px rgba(0, 0, 0, 0.45);
}

.polls-panel .option-row strong {
  font-weight: 700;
}

.polls-panel .meta {
  color: var(--poll-ink-soft);
  text-shadow: var(--poll-ink-shadow);
  font-size: 1.25rem;
  font-weight: 700;
}

.polls-panel .bar {
  background: rgba(39, 27, 18, 0.58);
  border: 1px solid rgba(16, 12, 9, 0.42);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.45),
    0 1px 1px rgba(255, 235, 195, 0.2);
}

.polls-panel .badge {
  font-weight: 700;
}

.polls-panel .badge.open {
  color: #0a4a22;
  border-color: rgba(10, 74, 34, 0.55);
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.9);
}

.polls-panel .badge.closed {
  color: #5c1010;
  border-color: rgba(92, 16, 16, 0.5);
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.9);
}

.panel-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.telegram-join {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: #fff;
  background: #229ed9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.telegram-join:hover {
  filter: brightness(1.08);
  transform: scale(1.06);
}

.telegram-join:focus-visible {
  outline: 2px solid #229ed9;
  outline-offset: 3px;
}

.telegram-join__icon {
  display: block;
  width: 1.55rem;
  height: 1.55rem;
}

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

.meeting-schedule {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.meeting-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.meeting-day {
  min-width: 118px;
  color: var(--poll-ink);
  text-shadow: var(--poll-ink-shadow);
  font-size: 1.02rem;
  font-weight: 700;
}

.meeting-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #241a12;
  background: linear-gradient(180deg, #f0d8a2 0%, #d8a757 100%);
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.meeting-link-btn:hover {
  filter: brightness(1.06);
}

button {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 16px;
  color: #241a12;
  background: linear-gradient(180deg, #e5bb72, #c18b42);
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.06);
}

.status {
  margin: 10px 0 0;
}

.polls {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.poll {
  padding: 14px 16px;
  border-radius: 12px;
}

.poll-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.poll h3 {
  margin: 0;
}

.badge {
  font-size: 1rem;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge.open {
  color: var(--ok);
  border-color: rgba(121, 197, 125, 0.45);
}

.badge.closed {
  color: var(--danger);
  border-color: rgba(197, 108, 108, 0.45);
}

.option {
  margin-top: 10px;
}

.option-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.18rem;
  margin-bottom: 6px;
  gap: 10px;
}

.option-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vote-btn {
  padding: 4px 8px;
  font-size: 0.9rem;
  line-height: 1;
  border-radius: 6px;
}

.bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background:
    linear-gradient(
      180deg,
      rgba(255, 239, 199, 0.32) 0%,
      rgba(255, 255, 255, 0.08) 36%,
      rgba(0, 0, 0, 0.16) 100%
    ),
    linear-gradient(90deg, #7b431f 0%, #be7a33 42%, #e6bc72 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 218, 0.2),
    0 0 10px rgba(185, 116, 46, 0.35);
}

.meta {
  margin-top: 12px;
  font-size: 1.08rem;
  color: var(--text-soft);
}

@keyframes overlayDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(8px, -6px, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .overlay {
    animation: none;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 1.38rem;
  }

  .layout {
    padding: 6px 10px 24px;
  }

  .hero {
    padding: 6px 8px 7px;
  }

  .hero-top {
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .hero h1 {
    width: 100%;
    text-align: center;
    font-size: clamp(1.08rem, 5.5vw, 1.3rem);
  }

  .hero-auth-actions {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .hero-auth-actions button {
    padding: 4px 8px;
    font-size: 0.88rem;
  }

  .auth-userbar {
    display: none;
  }

  .auth-hint {
    text-align: center;
    margin-top: 6px;
  }

  .polls-panel .poll h3 {
    font-size: 1.48rem;
  }

  .polls-panel .option-row {
    font-size: 1.32rem;
  }

  .meeting-schedule {
    margin-top: 10px;
  }

  .meeting-row {
    justify-content: space-between;
    gap: 8px;
  }

  .meeting-day {
    min-width: 100px;
    font-size: 0.95rem;
  }

  .meeting-link-btn {
    width: min(56%, 190px);
    min-width: 0;
    padding: 6px 10px;
    font-size: 0.84rem;
  }
}
