* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
  color: #1e2430;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(252, 159, 91, 0.3), transparent 35%),
    radial-gradient(circle at 80% 0, rgba(58, 140, 255, 0.2), transparent 30%),
    #f8f9ff;
}

.card {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid #e8ebf5;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 45px rgba(28, 35, 58, 0.08);
}

.landing > .card {
  margin: auto 0 12px;
}

.public-rooms {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid #e8ebf5;
}

.room-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-button {
  min-width: 84px;
  padding: 9px 12px;
  font-size: 14px;
}

h1,
h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.brand-title {
  margin: 0 0 12px;
  display: flex;
  justify-content: center;
}

.brand-link {
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
}

.site-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.site-logo-main {
  max-width: 360px;
  width: 100%;
}

.site-logo-header {
  height: 46px;
  width: auto;
}

.site-logo-chat {
  height: 68px;
}

.panel-title {
  text-align: center;
}

.muted {
  color: #5e6780;
}

.small {
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.birth-date-fields {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
}

.birth-date-field {
  display: grid;
  gap: 6px;
}

.small-label {
  font-size: 13px;
  font-weight: 700;
  color: #46516d;
}

.birth-date-main-label {
  font-weight: 600;
}

.birth-date-field input {
  width: 100%;
}

.birth-date-field-year input {
  font-variant-numeric: tabular-nums;
}

.birth-date-hint {
  margin: -2px 0 0;
}

.resend-form {
  margin-top: 8px;
}

label {
  font-weight: 600;
}

input,
textarea,
button,
.button-link {
  border-radius: 12px;
  border: 1px solid #d4d9e7;
  font: inherit;
  padding: 11px 12px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #2f7cff;
  box-shadow: 0 0 0 3px rgba(47, 124, 255, 0.2);
}

button,
.button-link {
  cursor: pointer;
  background: #2f7cff;
  border-color: #2f7cff;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.is-loading,
.button-link.is-loading {
  position: relative;
  pointer-events: none;
}

button.is-loading::after,
.button-link.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
  vertical-align: -2px;
  animation: buttonSpin 0.8s linear infinite;
}

@keyframes buttonSpin {
  to {
    transform: rotate(360deg);
  }
}

.button-link.secondary {
  background: #eef3ff;
  color: #1e2430;
  border-color: #d9e2ff;
}

.notice {
  border-radius: 12px;
  border: 1px solid #e6e7ed;
  padding: 10px 12px;
  margin: 14px 0;
  background: #f8f9fd;
}

.notice.ok {
  border-color: #b6e1c4;
  background: #ecfff2;
}

.notice.warn {
  border-color: #f2ca8a;
  background: #fff8e9;
}

.notice.error {
  border-color: #f3b0b0;
  background: #fff0f0;
}

.notice.highlight {
  border-color: #ffbe7a;
  background: #fff5e9;
}

.hidden {
  display: none;
}

.chat-page {
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f2f5ff 0%, #fafbff 50%, #ffffff 100%);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid #e1e6f3;
  background: #ffffffcc;
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar > :first-child {
  grid-column: 2;
  justify-self: center;
}

.topbar > :last-child {
  grid-column: 3;
  justify-self: end;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.topbar-spacer {
  width: 1px;
  height: 1px;
}

.topbar.topbar-chat-auth {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.topbar.topbar-chat-auth > :first-child,
.topbar.topbar-chat-auth > :last-child {
  grid-column: auto;
  justify-self: auto;
}

.topbar-chat-left {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

.topbar-chat-center {
  grid-column: 2;
  justify-self: center;
}

.topbar-chat-right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  text-align: right;
}

.topbar-chat-room {
  display: inline-block;
  font-size: 24px;
  font-weight: 800;
  color: #1d2740;
  line-height: 1.15;
}

.topbar-chat-greeting {
  color: #2e3952;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-chat-auth .site-logo-chat-main {
  height: 86px;
}

.topbar-chat-auth .logout-inline {
  margin-top: 0;
}

.ghost {
  background: #fff;
  color: #22304a;
  border: 1px solid #d5dcef;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  padding: 18px;
  flex: 1;
  min-height: 0;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.chat-panel,
.sidebar {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e5e9f5;
  box-shadow: 0 10px 26px rgba(32, 46, 72, 0.07);
  padding: 14px;
  min-height: 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar {
  overflow-y: auto;
}

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}

.jump-latest-btn {
  position: absolute;
  right: 20px;
  z-index: 4;
  border-radius: 999px;
  border: 1px solid #2f7cff;
  background: #2f7cff;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 14px;
  box-shadow: 0 8px 18px rgba(24, 54, 108, 0.25);
}

.jump-latest-btn.hidden {
  display: none;
}

.message {
  border: 1px solid #edf0fa;
  border-radius: 12px;
  padding: 9px 10px;
  background: #fafcff;
}

.message.message-user-colored {
  border-color: var(--message-user-border, #edf0fa);
  background: var(--message-user-bg, #fafcff);
}

.message.message-user-colored .message-head strong {
  color: var(--message-user-accent, #1e2430);
}

.message.message-focus {
  box-shadow: 0 0 0 3px rgba(47, 124, 255, 0.24);
  border-color: #9dc0ff;
}

.message.message-mention-target {
  border-color: #bfd5ff;
  background: #eef4ff;
}

.message-head {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 13px;
}

.message-head time {
  margin-left: auto;
  color: #5d6782;
}

.message-report {
  border-radius: 999px;
  border: 1px solid #d6deef;
  background: #fff;
  color: #31425f;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
}

.message-report:hover {
  background: #f4f7ff;
}

.mention-badge {
  border-radius: 999px;
  border: 1px solid #bfd5ff;
  background: #e4eeff;
  color: #1e4fa6;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
}

.message-admin-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #7a5a16;
  background: #fff7e6;
  border: 1px solid #f2d7a1;
  border-radius: 8px;
  padding: 6px 8px;
}

.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.poll-card {
  margin-top: 2px;
  border: 1px solid #dfe5f7;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
}

.poll-question {
  margin: 0 0 8px;
  font-weight: 700;
  color: #24314f;
}

.poll-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.poll-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.poll-option-btn {
  text-align: left;
  background: #f5f8ff;
  border: 1px solid #d8e2fb;
  color: #22385f;
  font-weight: 600;
  border-radius: 9px;
  padding: 7px 10px;
}

.poll-option-btn:hover:not(:disabled) {
  background: #eaf0ff;
}

.poll-option-btn.is-selected {
  border-color: #9fc0ff;
  background: #e6efff;
}

.poll-option-btn:disabled {
  cursor: default;
  opacity: 0.96;
}

.poll-votes {
  font-size: 12px;
  color: #4f5f82;
  white-space: nowrap;
}

.poll-total {
  margin: 8px 0 0;
}

.poll-delete-btn {
  margin-top: 8px;
  width: 100%;
}

.message-thumb {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #d7e2fb;
  box-shadow: 0 3px 10px rgba(44, 71, 122, 0.12);
  cursor: zoom-in;
}

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

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mention-menu {
  list-style: none;
  margin: 0;
  padding: 4px;
  border: 1px solid #d6deef;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(24, 39, 64, 0.08);
  max-height: 180px;
  overflow-y: auto;
}

.mention-menu li {
  margin: 0;
}

.mention-option {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: #22304a;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 600;
}

.mention-option:hover,
.mention-option.active {
  background: #eff4ff;
  border-color: #ccd9fa;
}

.composer button {
  justify-self: end;
  min-width: 120px;
}

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(19, 27, 41, 0.45);
  padding: 16px;
}

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

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 17, 30, 0.8);
}

.image-lightbox.hidden {
  display: none;
}

.lightbox-image {
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.45);
  background: #fff;
}

.report-dialog {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid #dde4f4;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(19, 27, 41, 0.25);
  padding: 16px;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.report-actions .button-link,
.report-actions button {
  min-width: 170px;
}

.online-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.online-list li {
  border-radius: 10px;
  padding: 8px 10px;
  background: #f4f7ff;
  border: 1px solid #dde6ff;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-list li {
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8f9fd;
  border: 1px solid #e6e9f3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.history-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date {
  color: #5d6782;
  font-size: 13px;
  min-width: 86px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sidebar-participate {
  margin-top: 12px;
}

.sidebar-divider {
  margin: 12px 0;
  border-top: 1px solid #e6e9f3;
}

.poll-links-block {
  margin-top: 4px;
}

.poll-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  max-height: 170px;
  overflow-y: auto;
  padding-right: 4px;
}

.poll-links-list li {
  display: grid;
  gap: 2px;
  line-height: 1.3;
}

.poll-link {
  color: #2b4f97;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.poll-link:hover {
  text-decoration: underline;
}

.poll-link-meta {
  color: #5d6782;
  font-size: 12px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.on-this-day {
  margin-top: 0;
  padding-top: 0;
}

.on-this-day-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.on-this-day-list li {
  padding: 0;
  border: 0;
  background: transparent;
  display: block;
}

.on-this-day-link {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid #eee6d8;
  border-radius: 10px;
  background: #fffaf0;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

.on-this-day-link:hover .on-this-day-text {
  text-decoration: underline;
}

.on-this-day-year {
  font-weight: 700;
  color: #6a4b09;
  font-variant-numeric: tabular-nums;
}

.on-this-day-text {
  color: #2d3342;
  font-size: 13px;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}

.famous-birthdays {
  margin-top: 0;
}

.famous-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.famous-list li {
  padding: 0;
  border: 0;
  background: transparent;
}

.famous-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.famous-name {
  color: #1f2f4a;
  flex: 1;
}

.famous-card-link {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #dfe7f6;
  border-radius: 10px;
  background: #f8fbff;
  color: inherit;
  text-decoration: none;
}

.famous-card-link:hover .famous-name {
  text-decoration: underline;
}

.famous-year {
  color: #5d6782;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.famous-meta {
  margin-top: 4px;
  color: #3e4b68;
  font-size: 12px;
  line-height: 1.3;
}

.rotating-list {
  transition: opacity 0.45s ease;
}

.rotating-list.is-fading {
  opacity: 0;
}

.rotating-list li {
  display: none;
}

.on-this-day-list.rotating-list:not(.has-active-item) li:first-child,
.on-this-day-list.rotating-list li.is-active {
  display: grid;
}

.famous-list.rotating-list:not(.has-active-item) li:first-child,
.famous-list.rotating-list li.is-active {
  display: block;
}

.logout-inline {
  margin-top: 6px;
}

.admin-layout {
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-panel {
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.admin-message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.admin-message {
  border: 1px solid #e3e8f6;
  border-radius: 12px;
  background: #fbfcff;
  padding: 10px;
}

.admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #4c5874;
}

.admin-meta strong {
  color: #22304a;
}

.admin-meta time {
  margin-left: auto;
}

.admin-edit-input {
  width: 100%;
  resize: vertical;
  min-height: 84px;
}

.admin-message-preview {
  margin: 8px 0;
}

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

.admin-actions .button-link,
.admin-actions button {
  min-width: 140px;
}

.admin-feedback {
  margin-top: 8px;
}

.room-link {
  display: block;
  margin-top: 4px;
  text-decoration: none;
}

.site-footer {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #e1e6f3;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  color: #4f5d7d;
  font-size: 14px;
}

.site-footer a {
  color: #2c4f9c;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer-sep {
  color: #8a95ad;
  white-space: nowrap;
}

.legal-page .card {
  width: min(900px, 100%);
}

.legal-content h2 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.legal-content p {
  margin: 0 0 10px;
  line-height: 1.55;
}

.legal-content ul {
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

@media (max-width: 920px) {
  .landing-home {
    padding-top: 12px;
  }

  .landing-home > .card {
    margin: 8px 0 12px;
  }

  .chat-page {
    height: auto;
    overflow: auto;
  }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .topbar > :last-child {
    justify-self: auto;
    align-self: flex-end;
  }

  .topbar.topbar-chat-auth {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .topbar.topbar-chat-auth .topbar-chat-left,
  .topbar.topbar-chat-auth .topbar-chat-center,
  .topbar.topbar-chat-auth .topbar-chat-right {
    grid-column: 1;
    justify-self: center;
    text-align: center;
  }

  .topbar.topbar-chat-auth .topbar-chat-right {
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .topbar.topbar-chat-auth .topbar-chat-room {
    font-size: 20px;
  }

  .topbar.topbar-chat-auth .site-logo-chat-main {
    height: 72px;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    flex: none;
    min-height: auto;
  }

  .message-list {
    min-height: 320px;
  }

  .jump-latest-btn {
    right: 14px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .site-footer {
    width: calc(100% - 24px);
    font-size: 13px;
    gap: 8px;
    flex-wrap: wrap;
    row-gap: 6px;
    padding: 11px 14px;
  }

  .site-footer-sep {
    display: none;
  }

  .site-logo-main {
    max-width: 320px;
  }

  .birth-date-fields {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .birth-date-field-year {
    grid-column: 1 / -1;
  }

  .site-logo-header {
    height: 42px;
  }

  .site-logo-chat {
    height: 56px;
  }
}
