:root {
  --app-radius: 1rem;
  --app-radius-sm: 0.75rem;
  --app-radius-lg: 1.25rem;
  --app-shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.12);
  --app-shadow-md: 0 16px 40px rgba(0, 0, 0, 0.18);
  --app-border-color: rgba(255, 255, 255, 0.08);
  --app-surface: rgba(255, 255, 255, 0.03);
  --app-surface-strong: rgba(255, 255, 255, 0.05);
  --app-max-width: 1120px;
}

html,
body {
  min-height: 100%;
}

body.app-body {
  background:
    radial-gradient(circle at top, rgba(13, 110, 253, 0.12), transparent 35%),
    var(--bs-body-bg);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
}

.app-container {
  max-width: var(--app-max-width);
}

.app-card {
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-sm);
  background: var(--bs-body-bg);
}

.app-card-soft {
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius);
  background: var(--app-surface);
}

.app-hero {
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.app-section-header {
  margin-bottom: 1.75rem;
}

.app-section-header__title {
  margin-bottom: 0.35rem;
}

.app-section-header__subtitle {
  color: var(--bs-secondary-color);
  margin-bottom: 0;
}

.app-filter-panel {
  border: 1px solid var(--app-border-color);
  border-radius: var(--app-radius);
  background: var(--app-surface);
}

.app-badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-badge {
  border-radius: 999px;
  font-weight: 500;
}

.app-meta {
  color: var(--bs-secondary-color);
  font-size: 0.95rem;
}

.app-empty-state {
  border: 1px dashed var(--app-border-color);
  border-radius: var(--app-radius);
  background: var(--app-surface);
}

.app-rich-text p:last-child {
  margin-bottom: 0;
}

.navbar.app-navbar {
  border-bottom: 1px solid var(--app-border-color);
  background: rgba(20, 20, 20, 0.75) !important;
  backdrop-filter: blur(12px);
}

.app-footer {
  border-top: 1px solid var(--app-border-color);
}

.table > :not(caption) > * > * {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.card-header {
  border-bottom: 1px solid var(--app-border-color);
  background: rgba(255, 255, 255, 0.025);
  font-weight: 600;
}

dl.row dt {
  color: var(--bs-secondary-color);
  font-weight: 600;
}

.table thead th {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}

.navbar .nav-link.active {
  color: var(--bs-emphasis-color);
  font-weight: 600;
}

.app-field-invalid input,
.app-field-invalid select,
.app-field-invalid textarea {
  border-color: var(--bs-danger);
}

.app-field-invalid input:focus,
.app-field-invalid select:focus,
.app-field-invalid textarea:focus {
  border-color: var(--bs-danger);
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.invalid-feedback ul {
  margin-bottom: 0;
  padding-left: 1rem;
}

.app-card.border-warning,
.app-card.border-danger {
  border-width: 1px;
}

.link-secondary:hover {
  color: var(--bs-emphasis-color) !important;
}

.app-mode-card {
  max-width: 760px;
  margin-inline: auto;
}

a.app-badge:hover {
  opacity: 0.85;
  text-decoration: none;
}

.app-pre-line {
  white-space: pre-line;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 575.98px) {
  .app-actions > .btn,
  .app-actions > form,
  .app-actions > form > .btn {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .app-footer-links {
    flex-direction: column;
    gap: 0.5rem !important;
  }
}

.app-legal-text {
  line-height: 1.75;
}

.app-card,
.app-card-soft,
.app-rich-text,
.app-empty-state,
.table {
  overflow-wrap: anywhere;
}

code {
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .table > :not(caption) > * > * {
    padding: 0.65rem 0.75rem;
  }

  .table {
    font-size: 0.925rem;
  }
}

.navbar-logo {
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
}

.navbar.app-navbar {
  border-bottom: 1px solid var(--app-border-color);
  background: rgba(20, 20, 20, 0.75) !important;
  backdrop-filter: blur(12px);
}

.navbar-logo {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
}

.navbar-brand {
  min-width: 0;
}

.navbar-brand-text {
  max-width: min(52vw, 22rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-navbar-actions {
  margin-left: auto;
}

.app-navbar-form {
  margin: 0;
}

.app-navbar-button {
  white-space: nowrap;
}

.navbar .nav-link.active {
  color: var(--bs-emphasis-color);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .app-navbar-collapse {
    padding-top: 1rem;
  }

  .app-navbar-actions {
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch !important;
  }

  .app-navbar-actions .btn,
  .app-navbar-actions .app-navbar-form,
  .app-navbar-actions .app-navbar-form .btn,
  .app-user-menu,
  .app-user-menu > .btn {
    width: 100%;
  }

  .app-user-menu__menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 0.5rem;
  }

  .navbar-nav {
    gap: 0.25rem;
  }

  .navbar .nav-link {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-radius: var(--app-radius-sm);
  }

  .navbar .nav-link.active {
    background: var(--app-surface-strong);
  }
}

.joke-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.joke-detail-header__title {
  flex: 1 1 auto;
  min-width: 0;
}

.joke-share {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
  line-height: 1;
}

.joke-share__button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  color: var(--bs-secondary-color);
  cursor: pointer;
  line-height: 1;
}

.joke-share__button:hover {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  color: var(--bs-body-color);
}

.joke-share__button:active {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  transform: none;
}

.joke-share__button:focus {
  outline: none;
  box-shadow: none !important;
}

.joke-share__button:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.joke-share__icon {
  display: block;
  flex: 0 0 auto;
}

.joke-share__status {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  white-space: nowrap;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

@media (max-width: 575.98px) {
  .joke-detail-header {
    gap: 0.5rem;
  }

  .joke-share__icon {
    width: 18px;
    height: 18px;
  }

  .joke-share__status {
    font-size: 0.75rem;
  }
}

.joke-share__button,
.joke-share__button:hover,
.joke-share__button:active,
.joke-share__button:focus {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
