/* ============================================
   MA Assessment Tool - Base Styles
   Design: Dark Mode OLED × Fintech
   Font: IBM Plex Sans
   ============================================ */

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

:root {
  --bg-base:       #020617;
  --bg-surface:    #0F172A;
  --bg-elevated:   #1E293B;
  --bg-hover:      #263248;
  --border:        #1E293B;
  --border-subtle: #334155;

  --text-primary:  #F8FAFC;
  --text-secondary:#94A3B8;
  --text-muted:    #64748B;

  --green:         #22C55E;
  --green-dim:     rgba(34,197,94,0.12);
  --green-glow:    rgba(34,197,94,0.25);
  --yellow:        #F59E0B;
  --yellow-dim:    rgba(245,158,11,0.12);
  --red:           #EF4444;
  --red-dim:       rgba(239,68,68,0.12);

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  --shadow-card:   0 1px 3px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --shadow-glow:   0 0 20px rgba(34,197,94,0.15);
  --transition:    150ms cubic-bezier(0.4,0,0.2,1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Utilities ---- */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.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;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-accent {
  color: var(--green);
}

.nav {
  display: flex;
  gap: 24px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: 64px 0 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(34,197,94,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero-accent {
  color: var(--green);
  text-shadow: 0 0 40px rgba(34,197,94,0.4);
}

.hero-sub {
  font-size: 1rem;
  color: #CBD5E1;
  line-height: 1.75;
  max-width: 560px;
  margin: 0 auto;
}

/* ============================================
   MAIN / FORM
   ============================================ */
.main {
  padding-bottom: 80px;
}

.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

/* Step */
.step {
  margin-bottom: 40px;
}

.step-hidden {
  display: none;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.step-num {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  padding: 4px 10px;
  border-radius: 100px;
}

.step-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step-desc {
  font-size: 0.875rem;
  color: #CBD5E1;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1.0rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  text-align: center;
}

.cat-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

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

.cat-btn.selected {
  background: var(--green-dim);
  border-color: rgba(34,197,94,0.4);
  color: var(--green);
  box-shadow: var(--shadow-glow);
}

.cat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.4;
}

.cat-btn.selected .cat-sub {
  color: rgba(34,197,94,0.7);
}

/* Sub category */
.sub-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sub-btn {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.sub-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

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

.sub-btn.selected {
  background: var(--green-dim);
  border-color: rgba(34,197,94,0.4);
  color: var(--green);
}

.other-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

.other-input::placeholder {
  color: var(--text-muted);
}

.other-input:focus {
  border-color: rgba(34,197,94,0.5);
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.upload-zone:hover,
.upload-zone:focus-visible {
  border-color: rgba(34,197,94,0.4);
  background: rgba(34,197,94,0.03);
}

.upload-zone:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.upload-zone.dragover {
  border-color: var(--green);
  background: var(--green-dim);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  margin: 0 auto 16px;
  display: block;
}

.upload-main {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.upload-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-filename {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--green);
}

.upload-remove {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.upload-remove:hover {
  color: var(--red);
  border-color: var(--red);
}

/* Submit */
.submit-area {
  margin-top: 8px;
  text-align: center;
}

.submit-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--green);
  border: none;
  border-radius: var(--radius-md);
  color: #022c0a;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 20px rgba(34,197,94,0.4);
}

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

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-outline:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

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

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  z-index: 30;
}

/* hidden属性がある場合は確実に非表示（display:flexの上書き防止） */
.loading-overlay[hidden],
.submit-area[hidden],
.upload-success[hidden] {
  display: none !important;
}

.loading-inner {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(34,197,94,0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  max-width: 260px;
  margin: 0 auto;
}

.loading-step {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: all 0.4s;
}

.loading-step.active {
  color: var(--green);
  border-color: rgba(34,197,94,0.25);
  background: var(--green-dim);
}

.loading-step.done {
  color: var(--text-secondary);
  text-decoration: line-through;
}

/* ============================================
   HOW IT WORKS
   ============================================ */
.how-section {
  margin-top: 64px;
}

.how-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

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

.how-item {
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.how-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 14px;
}

.how-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.how-item-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .form-card {
    padding: 24px 20px;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .how-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .category-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .cat-btn {
    padding: 16px 10px;
  }

  .nav {
    gap: 14px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
