:root {
  color-scheme: light dark;
  --bg: #f5f6fa;
  --bg-menu: rgba(255, 255, 255, 0.94);
  --bg-dropdown: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-subtle: rgba(15, 23, 42, 0.05);
  --fg: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-soft: #eff6ff;
  --live: #047857;
  --live-soft: rgba(4, 120, 87, 0.11);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 36px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070a12;
    --bg-menu: rgba(15, 21, 35, 0.94);
    --bg-dropdown: #0f172a;
    --bg-card: rgba(20, 27, 44, 0.86);
    --bg-subtle: rgba(255, 255, 255, 0.06);
    --fg: #f8fafc;
    --muted: #94a3b8;
    --line: #1e293b;
    --accent: #60a5fa;
    --accent-2: #818cf8;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --live: #34d399;
    --live-soft: rgba(52, 211, 153, 0.14);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.32);
    --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.46);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.72);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.11), transparent 38%),
    radial-gradient(circle at 88% 12%, rgba(79, 70, 229, 0.11), transparent 42%),
    radial-gradient(circle at 50% 88%, rgba(16, 185, 129, 0.07), transparent 44%);
  background-attachment: fixed;
  color: var(--fg);
  font: 16px/1.62 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

[dir="rtl"] body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "SF Hebrew", "Geeza Pro", "Arial Hebrew", "Segoe UI", Tahoma, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

a:hover {
  opacity: 0.88;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 20px 84px;
}

/* Sticky Top Header with Flag Language Selector */
.site-header {
  position: sticky;
  top: 14px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  margin-bottom: 48px;
  background-color: var(--bg-menu);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  text-decoration: none;
  text-align: start;
}

.brand:hover {
  opacity: 1;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.24);
  flex-shrink: 0;
}

.brand-text .name {
  font-weight: 750;
  font-size: 17px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text .sub {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.25;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--fg);
  background: var(--bg-subtle);
  opacity: 1;
}

/* Flag Language Selector */
.lang {
  position: relative;
}

.lang summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  font-size: 19px;
  line-height: 1;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lang summary .lang-code {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--fg);
  letter-spacing: 0.02em;
  direction: ltr;
  unicode-bidi: isolate;
}

.lang summary::-webkit-details-marker {
  display: none;
}

.lang summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  margin-inline-start: 2px;
}

.lang summary:hover,
.lang[open] summary {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.lang .langs {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 200;
  width: min(396px, calc(100vw - 32px));
  max-height: min(72vh, calc(100dvh - 110px));
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 10px;
  background-color: var(--bg-dropdown);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  line-height: 1.35;
  direction: ltr;
}

.lang .langs a {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
  direction: ltr;
  text-align: left;
  font-weight: 500;
}

.lang .langs a:hover,
.lang .langs a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
}

/* Hero Section */
.hero {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 64px;
  padding: 10px 0 6px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.pill-accent {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.25);
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.028em;
  margin: 0 0 18px;
  font-weight: 800;
  text-wrap: balance;
}

.hero p.lead {
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 28px;
  line-height: 1.56;
  text-wrap: pretty;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 650;
  font-size: 15.5px;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.93;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* Section Headers */
.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 34px;
}

.section-header h2 {
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: -0.022em;
  margin: 0 0 10px;
  font-weight: 760;
}

.section-header p {
  color: var(--muted);
  margin: 0;
  font-size: 16px;
}

/* Apps Showcase Grid */
.apps-section {
  margin-bottom: 72px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}

.app-card {
  --card-accent: var(--accent);
  --card-accent-soft: var(--accent-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-md);
  text-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.app-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 4px;
  background: var(--card-accent);
  opacity: 0.9;
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-accent);
}

.app-card--plain {
  --card-accent: #334155;
  --card-accent-soft: rgba(51, 65, 85, 0.10);
}

.app-card--keepcheck {
  --card-accent: #0f766e;
  --card-accent-soft: rgba(15, 118, 110, 0.11);
}

.app-card--braindump {
  --card-accent: #4f46e5;
  --card-accent-soft: rgba(79, 70, 229, 0.12);
}

@media (prefers-color-scheme: dark) {
  .app-card--plain {
    --card-accent: #cbd5e1;
    --card-accent-soft: rgba(203, 213, 225, 0.14);
  }
  .app-card--keepcheck {
    --card-accent: #2dd4bf;
    --card-accent-soft: rgba(45, 212, 191, 0.16);
  }
  .app-card--braindump {
    --card-accent: #818cf8;
    --card-accent-soft: rgba(129, 140, 248, 0.18);
  }
}

.app-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.status-badge--live {
  background: var(--live-soft);
  color: var(--live);
  border-color: rgba(16, 185, 129, 0.28);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.app-card h3 {
  font-size: 23px;
  font-weight: 780;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--fg);
}

.app-tagline {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--card-accent);
  margin: 0 0 12px;
  line-height: 1.4;
}

.app-desc {
  font-size: 14.8px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.58;
}

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

.app-highlights li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.8px;
  color: var(--fg);
  line-height: 1.42;
}

.app-highlights li::before {
  content: "✓";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--card-accent-soft);
  color: var(--card-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}

.app-card-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-btn {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14.2px;
  font-weight: 650;
  text-decoration: none;
  text-align: center;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.app-btn--primary {
  background: var(--fg);
  color: var(--bg);
}

.app-btn--secondary {
  background: var(--card-accent-soft);
  color: var(--card-accent);
  border: 1px solid transparent;
}

.app-btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.app-meta-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.app-price {
  font-weight: 650;
  color: var(--fg);
  unicode-bidi: isolate;
}

.app-sub-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-sub-links a {
  color: var(--muted);
  font-weight: 550;
}

.app-sub-links a:hover {
  color: var(--fg);
}

/* Shared Principles Grid */
.principles-section {
  margin-bottom: 68px;
}

.principles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.principle-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  text-align: start;
}

.principle-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.principle-card h3 {
  font-size: 17px;
  margin: 0 0 8px;
  font-weight: 720;
  line-height: 1.3;
}

.principle-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.3px;
  line-height: 1.54;
}

/* Contact Banner */
.contact-banner {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 34px 36px;
  box-shadow: var(--shadow-md);
  margin-bottom: 56px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  text-align: start;
}

.contact-banner h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.02em;
}

.contact-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 620px;
}

.contact-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.email-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.28);
  color: var(--accent);
  font-weight: 680;
  font-size: 15px;
  direction: ltr;
  unicode-bidi: isolate;
}

.email-pill:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--fg);
}

.ltr-token {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* Locale-Specific Typography Rules */
:lang(ja) { line-break: strict; }
h1:lang(ja), h1:lang(zh-Hans), h1:lang(zh-Hant), h1:lang(yue-Hant) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(ko) { word-break: keep-all; overflow-wrap: break-word; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .brand-text .name { letter-spacing: 0; }
h1:lang(hi), h1:lang(th), h1:lang(mr), h1:lang(ar), h1:lang(he) { line-height: 1.26; }

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1024px) {
  .apps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .principles-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .brand-text .sub {
    display: none;
  }
  .contact-banner {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 26px 22px;
  }
  .contact-banner p {
    margin: 0 auto;
  }
  .contact-cta {
    align-items: center;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }
  .apps-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 10px 14px 56px;
  }
  .site-header {
    top: 6px;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px 12px;
    margin-bottom: 24px;
    border-radius: 14px;
  }
  .brand {
    gap: 8px;
    min-width: 0;
  }
  .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  }
  .brand-text .name {
    font-size: 15px;
    white-space: nowrap;
  }
  .lang summary {
    min-height: 32px;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 14px;
    gap: 5px;
  }
  .lang summary .lang-code {
    font-size: 11.5px;
  }
  .top-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
  }
  .top-nav::-webkit-scrollbar {
    display: none;
  }
  .top-nav a {
    min-height: 32px;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 8px;
  }
  .lang .langs {
    grid-template-columns: 1fr;
    width: min(332px, calc(100vw - 28px));
  }
  .hero {
    margin-bottom: 40px;
  }
  .app-card {
    padding: 20px;
    border-radius: 22px;
  }
  .principles-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
