html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font: 16px/1.6 system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 20px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.home-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  gap: 4px;
}

.home-link a {
  text-decoration: none;
  color: inherit;
}

.submenu-toggle {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
}

.submenu-toggle:hover {
  background: var(--nav-hover-bg);
}

.submenu-toggle[aria-expanded="true"] span {
  transform: rotate(180deg);
  display: inline-block;
}

.home-link:hover {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 100;
}

.home-link.active .nav-dropdown,
.home-link:hover .nav-dropdown,
.home-link:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-radius: 6px;
  margin: 4px;
}

.nav-dropdown a:hover {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

.nav-dropdown a:first-child {
  margin-top: 8px;
}

.nav-dropdown a:last-child {
  margin-bottom: 8px;
}

.nav-dropdown img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

/* Nested submenu styling */
.nav-dropdown .nav-category {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 6px;
  margin: 4px;
  gap: 8px;
}

.nav-category img {
  flex-shrink: 0;
}

.nav-category:hover {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

.nav-category::after {
  content: "›";
  font-size: 18px;
  transition: transform 0.2s;
  opacity: 0.6;
  margin-left: auto;
}

.nav-category:hover::after {
  opacity: 1;
}

.nav-submenu {
  position: absolute;
  left: calc(100% + 8px);
  top: -4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  z-index: 101;
}

.nav-category.active .nav-submenu,
.nav-category:hover .nav-submenu,
.nav-category:focus-within .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.nav-submenu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-radius: 6px;
  margin: 4px;
}

.nav-submenu a:hover {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

.nav-submenu a:first-child {
  margin-top: 8px;
}

.nav-submenu a:last-child {
  margin-bottom: 8px;
}

.app-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.app-nav a:hover {
  background: var(--nav-hover-bg);
  transform: translateY(-1px);
}

.app-nav img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.header-right {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}

.nav-menu {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-menu a:hover {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex !important;
  }

  header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--panel);
  }

  .header-left {
    display: none !important;
  }

  .header-right {
    display: flex !important;
    gap: 8px;
  }

  .header-right .nav-menu {
    display: none !important;
  }

  .lang-switch {
    display: flex !important;
    gap: 4px;
  }

  .lang-switch button {
    padding: 6px 8px;
    font-size: 11px;
  }

  h1 {
    font-size: 32px;
  }

  h1 img {
    width: 32px;
    height: 32px;
  }

  /* Mobile styles for buy buttons in h1 */
  h1 .h1-buy-btn {
    display: block !important;
    margin: 16px auto 0 !important;
    max-width: 200px;
    text-align: center;
    font-size: 14px !important;
    padding: 8px 20px !important;
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 18px;
  }

  main {
    padding: 16px;
  }

  .screenshot {
    width: 100%;
    max-width: 100%;
    margin: 20px 0 8px 0;
  }

  .caption {
    font-size: 13px;
  }
}

.lang-switch {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.lang-switch button {
  all: unset;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid var(--border);
}

.lang-switch button.active {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-color: var(--brand);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  z-index: 101;
  position: relative;
  width: 40px;
  height: 40px;
}

.hamburger span {
  width: 24px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-menu {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--panel);
  z-index: 98;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  border-bottom: 1px solid transparent;
}

.mobile-menu.active {
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-content {
  padding: 12px 16px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.mobile-menu-section {
  margin-bottom: 8px;
}

.mobile-menu-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px 0;
  font-weight: 600;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.2s;
}

.mobile-menu-link:hover,
.mobile-menu-link:active {
  background: var(--nav-hover-bg);
}

.mobile-menu-link img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.mobile-menu-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.mobile-arrow {
  font-size: 20px;
  font-weight: bold;
  transition: transform 0.3s ease;
  display: inline-block;
  color: var(--accent);
}

.mobile-submenu {
  margin-left: 44px;
  margin-top: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-submenu.active {
  max-height: 1000px;
}

.mobile-submenu a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: all 0.2s;
}

.mobile-submenu a:hover,
.mobile-submenu a:active {
  background: var(--nav-hover-bg);
  color: var(--accent);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  font-size: 42px;
  margin-bottom: 0.3em;
  display: flex;
  align-items: center;
  gap: 12px;
}

h1 img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

h2 {
  font-size: 28px;
  margin-top: 2em;
  margin-bottom: 0.5em;
  scroll-margin-top: 80px;
}

h3 {
  font-size: 20px;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--brand);
  scroll-margin-top: 80px;
}

.hidden {
  display: none;
}

.screenshot {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 12px;
  margin: 24px auto 8px auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: block;
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.caption {
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 24px;
  font-style: italic;
  text-align: center;
}

footer {
  padding: 20px;
  text-align: center;
  margin-top: 60px;
  border-top: 1px solid var(--border);
}

footer p {
  margin: 0;
  font-size: 14px;
}
