:root {
  --bg: #ffffff;
  --fg: #1f2937;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #f3f4f6;
  --border: #e5e7eb;
  --shadow: rgba(0, 0, 0, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 0.5rem;
  --radius-lg: 1rem;
}

[data-theme="dark"] {
  --bg: #111827;
  --fg: #f9fafb;
  --secondary: #1f2937;
  --border: #374151;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius);
  z-index: 100;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container--narrow {
  max-width: 800px;
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 0.5rem;
}

.btn--primary {
  background: var(--primary);
  color: white;
}

.btn--primary:hover, .btn--primary:focus-visible {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--shadow);
}

.btn--secondary {
  background: var(--secondary);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn--secondary:hover, .btn--secondary:focus-visible {
  background: var(--border);
  transform: translateY(-1px);
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  gap: 0.5rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav__link {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s ease;
}

.nav__link:hover, .nav__link:focus-visible {
  color: var(--primary);
}

.nav__link[aria-current="page"]:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle:hover, .theme-toggle:focus-visible {
  background: var(--secondary);
}

.hero {
  padding: 4rem 0;
  background: linear-gradient(135deg, var(--bg) 0%, var(--secondary) 100%);
}

.hero__content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
  text-align: center;
}

.hero__text h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--fg);
}

.hero__text p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  color: var(--fg);
  opacity: 0.8;
}

.hero__cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.demo {
  padding: 4rem 0;
}

.demo__card {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.demo__upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  margin-bottom: 2rem;
  transition: border-color 0.3s ease;
  cursor: pointer;
}

.demo__upload:hover {
  border-color: var(--primary);
}

.demo__upload input {
  display: none;
}

.demo__preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.demo__result {
  background: var(--secondary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  text-align: left;
}

.demo__disclaimer {
  font-size: 0.875rem;
  color: var(--warning);
  margin-top: 1rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton 2s infinite;
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.hero__demo:hover div[style*="transform: perspective"] {
  transform: perspective(800px) rotateY(0deg) rotateX(0deg) scale(1.05) !important;
}

.skeleton-text {
  height: 1rem;
  border-radius: var(--radius);
  margin: 0.5rem 0;
}

.skeleton-text--wide { width: 100%; }
.skeleton-text--medium { width: 75%; }
.skeleton-text--narrow { width: 50%; }

.section {
  padding: 4rem 0;
}

.section__header {
  text-align: center;
  margin-bottom: 3rem;
}

.section__title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section__subtitle {
  font-size: 1.25rem;
  color: var(--fg);
  opacity: 0.8;
}

.feature__icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.step {
  text-align: center;
  position: relative;
}

.step__number {
  width: 3rem;
  height: 3rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 auto 1rem;
}

.faq__item {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}

.faq__question {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.faq__answer {
  color: var(--fg);
  opacity: 0.8;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.faq-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--shadow);
}

.faq-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.faq-card__question {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--fg);
  line-height: 1.4;
}

.faq-card__answer {
  color: var(--fg);
  opacity: 0.8;
  line-height: 1.6;
}

.footer {
  background: var(--secondary);
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
}

.footer__content {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer__links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer__link {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer__link:hover, .footer__link:focus-visible {
  color: var(--primary);
}

.footer__bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--fg);
  opacity: 0.6;
}

/* Page-specific styles */
.main-content {
  padding: 4rem 0;
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.page-subtitle {
  font-size: 1.25rem;
  color: var(--fg);
  opacity: 0.8;
}

.content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem 0;
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.content h2:first-child {
  margin-top: 0;
}

.content h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem 0;
  color: var(--fg);
}

.content p {
  margin-bottom: 1rem;
}

.content ul, .content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.content li {
  margin-bottom: 0.5rem;
}

.content a {
  color: var(--primary);
  text-decoration: none;
}

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

.breadcrumb {
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.last-updated {
  background: var(--secondary);
  padding: 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary);
}

.warning-box {
  background: #fef3c7;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--warning);
}

[data-theme="dark"] .warning-box {
  background: #451a03;
  border-color: var(--warning);
}

.danger-box {
  background: #fee2e2;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid var(--danger);
}

[data-theme="dark"] .danger-box {
  background: #450a0a;
  border-color: var(--danger);
}

.highlight {
  background: #fef3c7;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-weight: 600;
}

[data-theme="dark"] .highlight {
  background: #451a03;
}

@media (min-width: 768px) {
  .hero__content {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
  
  .hero__cta {
    justify-content: flex-start;
  }
  
  .footer__content {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

@media (max-width: 767px) {
  .nav__links {
    display: none;
  }
  
  .header__content {
    justify-content: space-between;
  }
  
  .hero__cta {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
  
  .content {
    padding: 2rem;
  }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}