* {
  box-sizing: border-box;
}

:root {
  --primary-light: #ffffff;
  --primary-bg: #f8fafc;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --glass: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(148, 163, 184, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 24px;
}

.header {
  text-align: center;
  padding: 80px 0 60px 0;
  position: relative;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 28px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.brand-logo:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: -0.01em;
  max-width: 600px;
  margin: 0 auto;
}

.input-section {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  margin-bottom: 60px;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.input-form {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.input-group {
  flex: 1;
  display: flex;
  gap: 12px;
  background: var(--primary-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px;
  transition: all 0.2s ease;
}

.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.domain-input {
  flex: 1;
  padding: 16px 20px;
  font-size: 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.domain-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.location-select {
  padding: 16px 20px;
  font-size: 14px;
  border: none;
  background: var(--primary-light);
  color: var(--text-secondary);
  outline: none;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  border-radius: 12px;
  border: 1px solid var(--border);
  min-width: 120px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-select:focus {
  border-color: var(--accent);
  color: var(--text-primary);
}

.location-select option {
  background: var(--primary-light);
  color: var(--text-primary);
}

.analyze-btn {
  padding: 16px 32px;
  font-size: 15px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 140px;
  position: relative;
  overflow: hidden;
}

.analyze-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
}

.analyze-btn:hover:not(:disabled)::before {
  opacity: 1;
}

.analyze-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.3);
}

.analyze-btn:active {
  transform: translateY(0);
}

.analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.loading-section {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  margin-bottom: 40px;
  box-shadow: var(--shadow);
  animation: slideUp 0.5s ease;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.loading-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 16px;
  font-weight: 400;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.agent-card {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.agent-card.active {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-bg);
}

.agent-card.active::before {
  opacity: 0.02;
}

.agent-icon {
  font-size: 2.5rem;
  margin-bottom: 20px;
  display: block;
  position: relative;
  z-index: 1;
  filter: grayscale(1);
  transition: filter 0.3s ease;
}

.agent-card.active .agent-icon {
  filter: grayscale(0);
}

.agent-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  letter-spacing: -0.01em;
}

.agent-description {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  line-height: 1.5;
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  width: 0%;
  animation: progress 37.5s ease-in-out infinite;
  border-radius: 8px;
}

.processing-text {
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.keep-open-notice {
  text-align: center;
  background: var(--glass);
  color: var(--text-secondary);
  padding: 16px 24px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  font-size: 14px;
  font-weight: 500;
}

.results-section {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  overflow: hidden;
  animation: fadeIn 0.5s ease;
  display: flex;
}
.results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 0 0;
  align-items: flex-end;
}
.table-of-contents {
  width: 320px;
  background: var(--primary-bg);
  border-right: 1px solid var(--border);
  padding: 32px 0;
  overflow-y: auto;
  flex-shrink: 0;
  position: relative;
}

.toc-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  letter-spacing: -0.01em;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
}

.toc-item:hover {
  background: var(--primary-light);
  border-left-color: var(--accent);
  color: var(--text-primary);
}

.toc-item.active {
  background: var(--primary-light);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.toc-icon {
  font-size: 18px;
  filter: grayscale(1);
  transition: filter 0.2s ease;
}

.toc-item:hover .toc-icon,
.toc-item.active .toc-icon {
  filter: grayscale(0);
}

.toc-text {
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.toc-footer{
  position: absolute;
  bottom: 20px;
}

.download-btn {
  margin: 0 40px;
  padding: 20px;
  font-size: 15px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 140px;
  position: relative;
  overflow: hidden;
}

.results-content {
  flex: 1;
  padding: 40px;
  height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1.7;
  color: var(--text-primary);
}

.results-content p {
  margin-bottom: 20px;
  margin-top: 0;
  line-height: 1.7;
  word-wrap: break-word;
  hyphens: auto;
  font-size: 15px;
  color: var(--text-secondary);
}

.results-content h3 {
  margin-top: 32px;
  margin-bottom: 20px;
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.results-content h2 {
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-top: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.results-content pre {
  background: var(--primary-light);
  padding: 20px;
  border-radius: 12px;
  border-left: 3px solid var(--accent);
  overflow-x: auto;
  font-family: "JetBrains Mono", "Monaco", "Consolas", monospace;
  font-size: 14px;
  color: var(--text-secondary);
}

.section-card {
  background: var(--primary-light);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
  transition: all 0.2s ease;
}

.section-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.capability-chip {
  background: var(--primary-bg);
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  transition: all 0.2s ease;
  word-wrap: break-word;
  hyphens: auto;
}

.capability-chip:hover {
  border-color: var(--accent);
  background: var(--primary-light);
  box-shadow: var(--shadow);
}

.competitors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.competitor-card {
  background: var(--primary-light);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
}

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

.competitor-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  margin-top: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.competitor-detail {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  color: var(--text-secondary);
}

.competitor-detail strong {
  color: var(--accent);
  font-weight: 500;
  display: inline-block;
  margin-bottom: 4px;
}

.swot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.swot-quadrant {
  padding: 28px;
  border-radius: 16px;
  min-height: 180px;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
  border: 1px solid var(--border);
  background: var(--primary-light);
  position: relative;
}

.swot-quadrant::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
}

.swot-strengths::before {
  background: #10b981;
}

.swot-weaknesses::before {
  background: #f59e0b;
}

.swot-opportunities::before {
  background: var(--accent);
}

.swot-threats::before {
  background: #ef4444;
}

.swot-title {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 20px;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  color: var(--text-primary);
}

.swot-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.swot-list li {
  margin-bottom: 16px;
  padding-left: 20px;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  hyphens: auto;
  color: var(--text-secondary);
}

.swot-list li:before {
  content: "•";
  position: absolute;
  left: 0;
  font-weight: bold;
  top: 2px;
  color: var(--accent);
}

.growth-ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.growth-idea-card {
  background: var(--primary-light);
  border-radius: 16px;
  padding: 28px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
}

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

.growth-idea-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  margin-top: 0;
  margin-right: 80px;
  line-height: 1.4;
  word-wrap: break-word;
  letter-spacing: -0.01em;
}

.confidence-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.confidence-high {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.confidence-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.confidence-low {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.timeframe-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 12px;
  margin-left: 12px;
  font-weight: 500;
}

.growth-detail {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  hyphens: auto;
  color: var(--text-secondary);
}

.growth-detail strong {
  color: var(--accent);
  font-weight: 500;
  display: inline-block;
  margin-bottom: 4px;
}

.synthesis-box {
  background: var(--primary-light);
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid #a855f7;
  margin-top: 28px;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
  line-height: 1.6;
}

.synthesis-box h4 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 16px;
  color: #a855f7;
  font-weight: 600;
}

.synthesis-box p {
  color: var(--text-secondary);
}

.market-dynamics-box {
  background: var(--primary-light);
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  margin-top: 24px;
  overflow: hidden;
  word-wrap: break-word;
  hyphens: auto;
  line-height: 1.6;
}

.market-dynamics-box h4 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
}

.market-dynamics-box p {
  color: var(--text-secondary);
}

.raw-response-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #e0e0e0;
}

.error-message,
#error-section {
  background: var(--primary-light);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 24px;
  padding: 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.error-content h3 {
  color: #ef4444;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  margin-top: 0;
  letter-spacing: -0.02em;
}

.error-content p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 28px;
  line-height: 1.6;
}

.retry-btn {
  padding: 14px 28px;
  font-size: 15px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.retry-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3);
}

.retry-btn:active {
  transform: translateY(0);
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s ease-in-out infinite;
}

.hidden {
  display: none !important;
}
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  width: 500px;
}
.modal-input-label .email-input-label {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}
.email-input-label {
  margin-top: 20px;
}
.modal-input-label #emailInput {
  margin-top: 20px;
}
.modal-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.modal-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.modal-content button {
  padding: 8px 12px;
  margin: 5px;
}
.email-research-btn {
  margin: 20px 40px;
  padding: 20px;
  font-size: 15px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.modal-btn {
  margin: 20px 40px;
  padding: 20px;
  font-size: 15px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: white;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 140px;
  position: relative;
  overflow: hidden;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 20px 0 0;
}
.text-copyright {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 0 16px 0;
  color: #64748b;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: translateY(-4px) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.02);
  }
  100% {
    transform: translateY(-4px) scale(1);
  }
}

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

@keyframes progress {
  0% {
    width: 0%;
  }
  25% {
    width: 30%;
  }
  50% {
    width: 60%;
  }
  75% {
    width: 85%;
  }
  100% {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }

  .input-form {
    flex-direction: column;
  }

  .domain-input {
    width: 100%;
  }

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

  .results-section {
    flex-direction: column;
    max-height: none;
  }

  .table-of-contents {
    width: 100%;
    border-right: none;
    border-bottom: 2px solid #e0e0e0;
    max-height: 200px;
    overflow-y: auto;
   position: relative;
  }

  .toc-item {
    padding: 8px 16px;
  }

  .toc-text {
    font-size: 0.85rem;
  }

  .results-content {
    height: auto;
    max-height: 60vh;
  }
  .modal-input {
    width: 100%;
  }
}
