/* D3K2 Studio — site styles. See docs/DEV_GUIDE.md */

:root {
  color-scheme: light dark;
  --font-sans: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --header-h: 64px;
  --content-max: 42rem;
  --legal-max: 50rem;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --text: #f0f0f0;
  --text-muted: #a0a0a0;
  --surface: #161616;
  --border: #2a2a2a;
  --link: #b8d4f0;
  --link-hover: #e8f4ff;
  --accent: #e8e8e8;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --surface: #ffffff;
  --border: #e0e0e0;
  --link: #0d47a1;
  --link-hover: #1565c0;
  --accent: #1a1a1a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition), color var(--transition);
}

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

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--link-hover);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  line-height: 0;
  overflow: hidden;
}

.logo-box img {
  width: 40px;
  height: 40px;
  object-fit: cover;
}

.logo-box--lg img {
  width: 120px;
  height: 120px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-left: auto;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition), background-color var(--transition);
}

.btn-icon:hover {
  border-color: var(--text-muted);
}

.btn-icon:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.lang-select {
  height: 2.25rem;
  padding: 0 1.75rem 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  transition: border-color var(--transition), background-color var(--transition);
}

[data-theme="light"] .lang-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c5c5c' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
}

.lang-select:hover {
  border-color: var(--text-muted);
}

.lang-select:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Main */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* Home */
.hero {
  text-align: center;
  padding: 2rem 0 2.5rem;
}

.hero .logo-box--lg {
  margin: 0 auto 1.5rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero .tagline {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.card-grid {
  display: grid;
  gap: 1.25rem;
  max-width: var(--content-max);
  margin: 0 auto;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.card p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card p:last-child {
  margin-bottom: 0;
}

.card .btn-link {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
}

.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.card--link:hover {
  border-color: var(--text-muted);
  color: inherit;
  transform: translateY(-2px);
}

.card--link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.card--link h2 {
  color: var(--text);
}

.card--game {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition), transform var(--transition);
}

.card--game:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.card--game-body {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.card--game-body:hover {
  color: inherit;
}

.card--game-body:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
}

.card--game-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.card--game-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 22.37%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.card--game-title h2 {
  margin: 0;
  line-height: 1.25;
}

.card--game .store-badges {
  margin: 0.25rem 0 0;
}

.card--game .store-badge img {
  height: 52px;
}

.card-cta {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--link);
}

.card--link:hover .card-cta,
.card--game:hover .card-cta {
  color: var(--link-hover);
}

/* Game detail page */
.game-page {
  max-width: var(--content-max);
}

.back-link {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.back-link a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.back-link a:hover {
  color: var(--text);
}

.game-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}

.game-content h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Play Store–style app header on game landing page */
.game-app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1rem;
}

.game-app-icon {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 22.37%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.game-app-meta {
  min-width: 0;
  flex: 1;
}

.game-app-meta h1 {
  margin: 0 0 0.2rem;
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  line-height: 1.2;
}

.game-content .game-app-developer {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--link);
}

.game-content .game-app-rating {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.age-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.3rem;
  border: 1.5px solid var(--text-muted);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.store-badges--install {
  margin: 0 0 1.25rem;
}

.store-badges--install .store-badge img {
  height: 56px;
}

.game-content .game-tagline {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .game-app-icon {
    width: 80px;
    height: 80px;
  }

  .store-badges--install .store-badge img {
    height: 52px;
  }
}

.game-content section {
  margin-bottom: 2rem;
}

.game-content section:last-child {
  margin-bottom: 0;
}

.game-content h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.game-content p {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.game-content ul {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
  color: var(--text-muted);
}

.game-content li {
  margin-bottom: 0.35rem;
}

.game-content .btn-link {
  font-weight: 600;
  text-decoration: none;
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin: 1rem 0 1.75rem;
}

.store-badge {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}

.store-badge:hover {
  opacity: 0.92;
}

.store-badge img {
  height: 64px;
  width: auto;
}

.store-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.legal-note-inline {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.credit-block h2 a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.credit-block h2 a:hover {
  color: var(--link);
}

.credits-authors {
  display: grid;
  gap: 0.25rem 1.5rem;
  margin: 0 0 1rem;
  padding-left: 0;
  list-style: none;
}

@media (min-width: 480px) {
  .credits-authors {
    grid-template-columns: 1fr 1fr;
  }
}

.credits-authors li {
  margin: 0;
  font-size: 0.95rem;
}

.credit-source {
  color: var(--text-muted);
  font-size: 0.85em;
}

.credits-disclaimer {
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-block {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

.contact-block h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.contact-block p {
  margin: 0;
  color: var(--text-muted);
}

.legal-note {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Language visibility (vi | en | zh | ja) */
[data-lang-active="vi"] [data-lang]:not([data-lang="vi"]),
[data-lang-active="en"] [data-lang]:not([data-lang="en"]),
[data-lang-active="zh"] [data-lang]:not([data-lang="zh"]),
[data-lang-active="ja"] [data-lang]:not([data-lang="ja"]) {
  display: none !important;
}

/* Legal pages */
.legal-page .site-main {
  max-width: var(--legal-max);
}

.legal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
}

.legal-content h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  line-height: 1.25;
}

.legal-content .last-updated {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.legal-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.legal-content h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  line-height: 1.35;
}

.legal-content h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.05rem;
}

.legal-content p {
  margin: 0 0 1rem;
}

.legal-content ul {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.legal-content li {
  margin-bottom: 0.35rem;
}

.legal-content li::marker {
  color: var(--text-muted);
}

.legal-content strong {
  font-weight: 600;
}

.legal-content .copyright {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.5rem 1.25rem;
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .site-nav {
    display: none;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .header-inner {
    padding: 0 1rem;
  }

  .legal-content {
    padding: 1.5rem 1.25rem;
  }
}

@media print {
  .site-header,
  .site-footer,
  .header-actions {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  .legal-content {
    border: none;
    box-shadow: none;
  }
}
