:root {
  --app-top-height: 58px;
  --app-bottom-height: 64px;
  --app-ink: #152238;
  --app-accent: #b83d15;
  --app-line: #dce3ed;
}

.app-top, .app-bottom, .support-panel[hidden] { display: none; }
.app-top svg, .app-bottom svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.support-launcher, .support-panel {
  position: fixed;
  inset-inline-end: 20px;
  z-index: 1100;
}
.support-launcher, .support-compose button {
  border: 0;
  border-radius: 12px;
  background: var(--app-ink);
  color: #fff;
  padding: 10px 15px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.support-launcher { inset-block-end: 20px; box-shadow: 0 8px 24px #15223838; }
.support-panel {
  inset-block-end: 72px;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100% - 40px));
  max-height: calc(100dvh - 90px);
  overflow: auto;
  padding: 14px;
  color: var(--app-ink);
  background: #fff;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  box-shadow: 0 12px 36px #15223833;
}
.support-heading,.support-compose { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.support-heading h2 { margin: 0; font: inherit; font-weight: 800; }
.support-panel p, .support-form label { color: var(--app-ink); }
.support-panel button, .support-compose input { margin: 0; }
.support-heading button {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px;
  background: #edf1f7; color: var(--app-ink); font: 24px/1 system-ui; cursor: pointer;
}
.support-messages { display: grid; gap: 7px; max-height: min(260px, 38dvh); overflow: auto; }
.support-messages p { margin: 0; padding: 8px 10px; border-radius: 9px; background: #edf1f7; overflow-wrap: anywhere; }
.support-messages .support-visitor { background: #fae9e1; }
.support-form { margin: 0; }
.support-form label { font-size: .9rem; }
.support-compose input {
  min-width: 0; flex: 1; width: 100%; border-radius: 10px; border: 1px solid var(--app-line);
  padding: 8px; font: inherit; color: var(--app-ink); background: #fff;
}
.support-note, .support-human { margin: 0; font-size: .84rem; }
.support-human { color: #164686; text-decoration: underline; }
.wallet-labels { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet-labels span { color: var(--app-ink); background: #fff; border: 1px solid var(--app-line); border-radius: 7px; padding: 4px 10px; font-weight: 700; }

@media (max-width: 768px) {
  html { scroll-padding-top: calc(var(--app-top-height) + env(safe-area-inset-top) + 8px); }
  body.lang-ar, body.lang-en, body.portal {
    padding-block-start: calc(var(--app-top-height) + env(safe-area-inset-top));
    padding-block-end: calc(var(--app-bottom-height) + env(safe-area-inset-bottom));
  }
  .site-header, .site-announcement, .portal-header, .support-launcher { display: none; }
  .app-top, .app-bottom {
    position: fixed;
    inset-inline: 0;
    z-index: 1000;
    color: var(--app-ink);
    background: #fff;
  }
  .app-top {
    inset-block-start: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(var(--app-top-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 15px 0;
    border-block-end: 1px solid var(--app-line);
  }
  .app-top a, .app-bottom a { color: inherit; text-decoration: none; }
  .app-brand, .app-top-actions { display: flex; align-items: center; gap: 8px; }
  .app-brand { font: 800 20px/1 system-ui; }
  .app-language, .app-menu summary {
    display: grid; place-items: center; min-width: 44px; min-height: 44px;
    border-radius: 10px; font: 700 .9rem/1 system-ui; cursor: pointer;
  }
  .app-menu summary { list-style: none; }
  .app-menu summary::-webkit-details-marker { display: none; }
  .app-menu nav {
    position: absolute; inset-inline-end: 12px; inset-block-start: 100%; display: grid; gap: 1px;
    min-width: 175px; max-height: calc(100dvh - 80px); overflow-y: auto;
    padding: 6px; border-radius: 12px; background: #fff;
    border: 1px solid var(--app-line); box-shadow: 0 10px 24px #15223829;
  }
  .app-menu a { padding: 10px; }
  .app-bottom {
    inset-block-end: 0; display: grid; grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 2px;
    min-height: calc(var(--app-bottom-height) + env(safe-area-inset-bottom));
    padding: 4px 5px calc(4px + env(safe-area-inset-bottom));
    border-block-start: 1px solid var(--app-line);
  }
  .app-bottom a, .app-bottom button {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 0; min-height: 48px; gap: 3px; padding: 4px 1px; margin: 0;
    border: 0; border-radius: 10px; background: transparent; color: inherit;
    font: 700 .75rem/1.2 system-ui; text-align: center; cursor: pointer;
  }
  .app-bottom [aria-current="page"], .app-bottom [aria-expanded="true"] { color: var(--app-accent); background: #fff1e9; }
  .support-panel {
    inset-inline-end: 10px; inset-block-end: calc(var(--app-bottom-height) + env(safe-area-inset-bottom) + 8px);
    width: min(360px, calc(100% - 20px)); max-height: calc(100dvh - 155px);
  }
  .support-compose input { font-size: 16px; }
}

@media (min-width: 769px) and (max-width: 1200px) {
  .site-header .nav-links { flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-inline: 12px; }
}

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-block: 0 24px;
}
.gallery-tabs a {
  padding: 8px 14px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  color: var(--app-ink, #152238);
  background: #fff;
  font-weight: 700;
}
.gallery-tabs [aria-current="page"] {
  border-color: #ffbd9c;
  color: #9d330b;
  background: #fff1e9;
}
.gallery-empty, .gallery-card {
  border: 1px solid var(--app-line);
  border-radius: 16px;
  background: #fff;
}
.gallery-empty {
  max-width: 640px;
  margin-inline: auto;
  padding: 28px 18px;
  text-align: center;
}
.gallery-empty a { display: inline-block; margin-block-start: 8px; }
.gallery-filter { display: grid; gap: 6px; width: min(100%, 300px); margin-block-end: 16px; }
.gallery-filter select { padding: 8px; border: 1px solid var(--app-line); border-radius: 8px; font: inherit; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 18px; }
.gallery-card { overflow: hidden; align-self: start; }
.gallery-card[hidden] { display: none; }
.gallery-photo, .gallery-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #152238; }
.gallery-video { border: 0; }
.gallery-instagram { aspect-ratio: 4 / 5; max-height: 560px; background: #fff; }
.gallery-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery-caption { padding: 16px; overflow-wrap: anywhere; }
.gallery-caption h2 { font-size: 1.15rem; margin-block: 5px 0; }
.gallery-caption p { margin-block: 8px 0; }
.gallery-watch { display: inline-block; margin-block-start: 10px; font-weight: 700; }
.portal .gallery-publish { display: flex; align-items: center; gap: 8px; }
.portal .gallery-publish input { width: auto; margin: 0; }
.portal textarea[name^="description_"] {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 8px;
  border-radius: 8px;
  font: inherit;
}
