/* Base reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f5f5f5;
  color: #111;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
}

main {
  display: block;
}

.container {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 16px;
}

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

.page-main {
  flex: 1 0 auto;
  padding: 20px 0 40px;
}

.page-footer {
  flex-shrink: 0;
  padding: 16px;
  font-size: 13px;
  text-align: center;
  color: #555;
}

.page-footer a {
  text-decoration: underline;
}

/* Header / navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  max-width: 1024px;
  margin: 0 auto;
}

.site-logo {
  display: inline-flex;
  align-items: center;
}

.site-logo img {
  display: block;
  height: 32px;
}

.nav-desktop {
  display: none;
}

.nav-link {
  padding: 6px 4px;
  border-bottom: 2px solid transparent;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.nav-link.active {
  border-bottom-color: #111;
}

.nav-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid #111;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.nav-toggle-bar {
  width: 16px;
  height: 2px;
  background: #111;
  border-radius: 999px;
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: #111;
  border-radius: 999px;
}

.nav-toggle-bar::before {
  top: -5px;
}

.nav-toggle-bar::after {
  top: 5px;
}

.nav-mobile {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  z-index: 19;
}

.nav-mobile.open {
  display: block;
}

.nav-mobile-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 75%;
  max-width: 320px;
  height: 100%;
  background: #ffffff;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.nav-mobile-close {
  align-self: flex-end;
  margin-bottom: 32px;
  border: none;
  background: none;
  cursor: pointer;
}

.nav-mobile-close span {
  display: block;
  width: 18px;
  height: 2px;
  background: #111;
  transform-origin: center;
}

.nav-mobile-close span:first-child {
  transform: rotate(45deg);
}

.nav-mobile-close span:last-child {
  transform: rotate(-45deg);
  margin-top: -2px;
}

.nav-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-mobile-link {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14px;
}

.nav-mobile-link.active {
  font-weight: 600;
}

/* Home: hero */
.hero {
  padding: 0;
}

.hero-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 16px;
}

.hero-card {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.hero-image {
  width: 100%;
  display: block;
}

.hero-overlay {
  position: absolute;
  top: 64px;
  left: 48px;
  right: 48px;
  color: #ffffff;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
}

.hero-title {
  margin: 0 0 10px;
  font-size: 46px;
  line-height: 1.05;
  font-weight: 700;
  color: #ffffff;
}

.hero-tagline {
  margin: 0 0 22px;
  font-size: 17px;
  line-height: 1.4;
  color: #f5f5f5;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-store-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  line-height: 0;
}

.hero-store-badge img {
  height: 44px;
}

@media (max-width: 880px) {
  .page.home .page-main {
    padding-top: 16px;
  }

  .hero {
    padding-top: 12px;
  }

  .hero-overlay {
    top: 40px;
    left: 24px;
    right: 24px;
    max-width: 70%;
  }

  .hero-title {
    font-size: 34px;
  }

  .hero-tagline {
    font-size: 15px;
    margin-bottom: 16px;
  }

  .hero-store-badge img {
    height: 41px;
  }
}

@media (max-width: 640px) {
  .page.home .page-main {
    padding-top: 12px;
  }

  .hero-inner {
    padding: 0 12px;
  }

  .hero-card {
    border-radius: 20px;
    height: 340px;
  }

  .hero-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
  }

  .hero-overlay {
    top: 26px;
    left: 18px;
    right: 18px;
    max-width: 78%;
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-tagline {
    font-size: 13px;
  }

  .hero-buttons {
    gap: 10px;
  }

  .hero-store-badge img {
    height: 38px;
  }
}

/* Home: link grid */
.link-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.link-card {
  position: relative;
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  min-height: 340px;
  color: #ffffff;
}

.link-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform-origin: center;
  transition: transform 0.2s ease-out;
}

.link-card-inner {
  position: relative;
  z-index: 1;
  min-height: 100%;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7),
    rgba(0, 0, 0, 0.05) 60%,
    rgba(0, 0, 0, 0)
  );
}

.link-card:hover,
.link-card:focus-visible {
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.link-card:hover::before,
.link-card:focus-visible::before {
  transform: scale(1.03);
}

.link-card-title {
  font-weight: 600;
  font-size: 16px;
}

.link-card-subtitle {
  font-size: 13px;
  color: #f2f2f2;
}

@media (min-width: 640px) {
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 880px) {
  .link-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Home card images (from original live site) */
.link-card--settings::before {
  background-image: url("/assets/home-settings.webp");
}

.link-card--community::before {
  background-image: url("/assets/home-community.png");
}

.link-card--map::before {
  background-image: url("/assets/home-map.png");
}

.link-card--facebook::before {
  background-image: url("/assets/home-facebook.png");
}

.link-card--official::before {
  background-image: url("/assets/home-official.jpg");
}

.link-card--discord::before {
  background-image: url("/assets/home-discord.png");
}

/* Home: latest community topics */
.home-community-topics {
  margin-top: 32px;
}

.home-community-topics-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.home-community-topics-title {
  margin: 0;
  font-size: 18px;
}

.home-community-topics-link {
  font-size: 13px;
  color: #2962ff;
  text-decoration: underline;
  white-space: nowrap;
}

.home-community-topics-link:hover,
.home-community-topics-link:focus-visible {
  text-decoration: none;
}

.community-topics {
  font-size: 14px;
}

.community-topics-loading,
.community-topics-error,
.community-topics-empty {
  color: #555;
}

.community-topics-error {
  color: #c62828;
}

.community-topics-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.community-topic-item {
  padding: 12px 14px;
  border-radius: 15px;
  background-color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  border: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.community-topic-category {
  align-self: flex-start;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background-color: #eeeeee;
  color: #333333;
}

.community-topic-link {
  display: inline-block;
  font-weight: 500;
}

.community-topic-link:hover,
.community-topic-link:focus-visible {
  text-decoration: underline;
}

.community-topic-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #777;
}

@media (min-width: 640px) {
  .community-topics-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .community-topics-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Generic page titles */
.page-title {
  margin: 0 0 16px;
  font-size: 24px;
}

.page-intro {
  font-size: 14px;
  color: #444;
  margin-bottom: 24px;
}

/* Settings page */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h2 {
  font-size: 20px;
  margin: 24px 0 10px;
}

.settings-section h3 {
  font-size: 16px;
  margin: 18px 0 6px;
}

.settings-section p {
  margin: 0 0 8px;
  font-size: 14px;
}

.settings-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.settings-list li {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.settings-hero {
  max-width: 1024px;
  margin: 0 auto 20px;
  padding: 0 16px;
}

.settings-hero-inner {
  background: #fa604f;
  color: #000000;
  border-radius: 15px;
  padding: 16px 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  font-size: 14px;
}

.settings-hero-title {
  margin: 0 0 10px;
  font-size: 18px;
}

.settings-hero-inner p {
  margin: 0 0 8px;
}

.settings-row {
  max-width: 1024px;
  margin: 0 auto 20px;
  padding: 0 16px;
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.settings-pillar {
  flex: 0 0 270px;
  border-radius: 15px;
  padding: 16px 24px;
  color: #111;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.settings-pillar h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.settings-pillar p {
  margin: 0;
}

.settings-pillar--orange {
  background: #fa854f;
}

.settings-pillar--blue {
  background: #4fb5fa;
}

.settings-pillar--green {
  background: #4ffa9a;
}

.settings-cards {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-card {
  background: #ffffff;
  border-radius: 15px;
  border: 1px solid #dddddd;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.settings-card-title {
  flex: 0 0 140px;
  font-weight: 600;
  font-size: 14px;
}

.settings-card-text {
  flex: 1 1 0;
  font-size: 13px;
  color: #333;
}

.settings-card-text p {
  margin: 0 0 4px;
}

@media (max-width: 768px) {
  .settings-row {
    flex-direction: column;
  }

  .settings-pillar {
    flex-basis: auto;
  }

  .settings-card {
    border-radius: 15px;
  }
}

/* Channels page */
.channel-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.channel-desc {
  font-size: 14px;
  margin-bottom: 8px;
}

.channel-secret-label {
  font-size: 13px;
  color: #555;
}

.channel-secret-value {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  word-break: break-all;
}

.channels-inline-link {
  text-decoration: underline;
}

@media (min-width: 640px) {
  .channel-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
}

.channel-settings-card {
  /* Override generic flex layout for a strict 3-column grid */
  display: grid;
  grid-template-columns: auto 1fr 190px;
  column-gap: 24px;
  row-gap: 0;
  align-items: center;
}

.channel-card-qr img {
  width: 110px;
  height: 110px;
  object-fit: cover;
}

.channel-card-main {
  min-width: 0;
}

.channel-card-secret {
  text-align: right;
  font-size: 12px;
}

@media (max-width: 640px) {
  .channel-settings-card {
    /* Stack QR, content and secret vertically on small screens */
    grid-template-columns: 1fr;
    row-gap: 10px;
    align-items: flex-start;
  }

  .channel-card-qr {
    justify-self: center;
  }

  .channel-card-secret {
    text-align: left;
  }
}

/* Channel page specific pillar colors */
.channels-pillar-general {
  background: #4ffaf0;
}

.channels-pillar-regional {
  background: #f4e336;
}

/* Map page */
.map-frame-wrapper {
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.map-frame {
  width: 100%;
  min-height: 480px;
  border: 0;
}

/* Full-viewport map page */
.page--map .page-main {
  padding: 0;
  display: flex;
  flex: 1 1 auto;
}

.map-full-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  display: block;
  min-height: 0;
}

/* Devices page (embed auto device list) */
.page--devices .page-main {
  display: flex;
  flex: 1 0 auto;
  padding: 20px 0 20px;
}

.page--devices .page-main .container {
  flex: 1 1 auto;
  display: flex;
  border-radius: 15px;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
  padding: 0 16px;
}

.devices-frame-wrapper {
  flex: 1 1 auto;
  border-radius: 0;
  overflow: hidden;
  background-color: transparent;
}

.devices-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  min-height: 0;
}

/* Contact page */
.contact-wrapper {
  max-width: 480px;
}

.form-field {
  margin-bottom: 16px;
  font-size: 14px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.form-label-required {
  color: #e53935;
}

.form-input,
.form-textarea {
  width: 100%;
  border-radius: 15px;
  border: 1px solid #ccc;
  padding: 10px 12px;
  font: inherit;
}

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

.form-submit {
  border-radius: 999px;
  border: none;
  padding: 10px 20px;
  background: #111;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.form-submit:hover,
.form-submit:focus-visible {
  background: #333;
}

.contact-toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: 999px;
  background-color: #2e7d32;
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.contact-toast-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.contact-toast--success {
  background-color: #2e7d32;
}

.contact-toast--error {
  background-color: #c62828;
}

.contact-toast-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* Privacy page */
.privacy-frame-wrapper {
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.privacy-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
}

.page--privacy .page-main {
  display: flex;
  flex: 1 0 auto;
  padding: 20px 0 20px;
}

.page--privacy .page-main .container {
  flex: 1 1 auto;
  display: flex;
}

.page--privacy .privacy-frame-wrapper {
  flex: 1 1 auto;
}
