/* ================================================================
   手取り計算シミュレーター - Design System & Styles
   ================================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #10b981;

  --accent-green: #10b981;
  --accent-emerald: #34d399;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;

  --gradient-primary: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  --gradient-secondary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
                 radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
                 radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);

  --font-primary: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --border-radius-xl: 24px;
  --border-radius-lg: 16px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  background-image: var(--gradient-bg);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Ambient Background Animation --- */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(16, 185, 129, 0.03) 0%, transparent 40%),
              radial-gradient(circle at 70% 60%, rgba(59, 130, 246, 0.03) 0%, transparent 40%);
  animation: ambientFloat 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes ambientFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
.site-header {
  padding: 24px 0;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero h1 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

/* --- Main Grid --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding-bottom: 60px;
}

@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Glass Card --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-xl);
  padding: 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: var(--glass-border-hover);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.card-icon.green { background: rgba(16, 185, 129, 0.15); }
.card-icon.blue { background: rgba(59, 130, 246, 0.15); }
.card-icon.purple { background: rgba(139, 92, 246, 0.15); }

.card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-label .value-display {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 15px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper .prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  font-weight: 500;
}

.input-wrapper .suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  font-weight: 500;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 14px 50px 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 600;
  transition: var(--transition);
  outline: none;
  text-align: right;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]:focus,
input[type="text"]:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* --- Range Slider --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  margin-top: 12px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  transition: var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient-primary);
  cursor: pointer;
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* --- Select / Toggle Buttons --- */
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
}

.toggle-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 600;
}

/* --- Select Dropdown --- */
select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  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='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

select:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* --- Results Section --- */
.result-hero {
  text-align: center;
  padding: 28px 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--glass-border);
}

.result-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.result-value {
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.result-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-weight: 500;
}

.result-sub strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* --- Chart Area --- */
.chart-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

#donutChart {
  max-width: 220px;
  max-height: 220px;
}

/* --- Breakdown List --- */
.breakdown-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--border-radius-md);
  transition: var(--transition);
  border: 1px solid transparent;
}

.breakdown-item:hover {
  border-color: var(--glass-border);
  transform: translateX(4px);
}

.breakdown-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.breakdown-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.breakdown-right {
  text-align: right;
}

.breakdown-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.breakdown-percent {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Monthly Card --- */
.monthly-card {
  margin-top: 24px;
  padding: 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.monthly-label {
  font-size: 14px;
  color: var(--accent-emerald);
  font-weight: 500;
}

.monthly-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-emerald);
}

/* --- CTA / Affiliate Section --- */
.cta-section {
  padding: 60px 0 80px;
}

.cta-title {
  text-align: center;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.cta-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 15px;
}

.cta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .cta-grid {
    grid-template-columns: 1fr;
  }
}

.cta-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-xl);
  padding: 32px 24px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.cta-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: var(--transition);
}

.cta-card:nth-child(1)::before { background: var(--gradient-primary); }
.cta-card:nth-child(2)::before { background: var(--gradient-secondary); }
.cta-card:nth-child(3)::before { background: var(--gradient-warm); }

.cta-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.cta-card:hover::before {
  opacity: 1;
}

.cta-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.cta-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.cta-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.cta-button.green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.cta-button.green:hover {
  background: rgba(16, 185, 129, 0.25);
}

.cta-button.purple {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.cta-button.purple:hover {
  background: rgba(139, 92, 246, 0.25);
}

.cta-button.orange {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.cta-button.orange:hover {
  background: rgba(245, 158, 11, 0.25);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--glass-border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.site-footer a:hover {
  color: var(--accent-green);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* --- Divider --- */
.section-divider {
  margin: 16px 0;
  border: none;
  border-top: 1px solid var(--glass-border);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .glass-card {
    padding: 24px 20px;
    border-radius: var(--border-radius-lg);
  }

  .hero {
    padding: 40px 0 28px;
  }

  .main-grid {
    gap: 20px;
  }

  .cta-section {
    padding: 40px 0 60px;
  }

  .monthly-card {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}
