/* =============================================
   クロスローズ AI Q&A - Global Styles
   ============================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #0d1b2a;
  --navy-mid: #1a2d42;
  --navy-light: #243b55;
  --orange: #ff6b35;
  --orange-light: #ff8c5c;
  --orange-glow: rgba(255, 107, 53, 0.25);
  --white: #ffffff;
  --text-primary: #f0f4f8;
  --text-secondary: #a0b4c8;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.07);
  --chat-ai-bg: rgba(26, 45, 66, 0.9);
  --chat-user-bg: linear-gradient(135deg, #ff6b35, #ff8c5c);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 0 30px rgba(255, 107, 53, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--navy);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
}

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  transition: var(--transition);
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--navy-mid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  text-align: center;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-logo {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
}

.modal-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
}

.modal-desc a {
  color: var(--orange-light);
  text-decoration: none;
}

.modal-desc a:hover {
  text-decoration: underline;
}

.modal-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: monospace;
  font-size: 0.875rem;
  padding: 12px 16px;
  margin-bottom: 16px;
  outline: none;
  transition: var(--transition);
}

.modal-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.modal-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--orange-glow);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
}

.modal-error {
  color: #ff6b6b;
  font-size: 0.8rem;
  margin-top: 8px;
}

/* =============================================
   Header
   ============================================= */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 27, 42, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.header-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}

.header-tagline {
  font-size: 0.7rem;
  color: var(--orange-light);
  font-weight: 500;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.8rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-outline:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 14px var(--orange-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

/* =============================================
   Hero
   ============================================= */
.hero {
  background: radial-gradient(ellipse at 60% 0%, rgba(255, 107, 53, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--navy-mid) 0%, var(--navy) 100%);
  padding: 64px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-inner {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.3);
  color: var(--orange-light);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  line-height: 1.25;
  color: var(--white);
  margin-bottom: 16px;
}

.hero-highlight {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* =============================================
   App Container
   ============================================= */
.app-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* =============================================
   Subject Tabs
   ============================================= */
.subject-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  color: var(--text-secondary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 18px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab:hover {
  border-color: rgba(255, 107, 53, 0.4);
  color: var(--orange-light);
}

.tab.active {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 16px var(--orange-glow);
  font-weight: 700;
}

/* =============================================
   Chat Window
   ============================================= */
.chat-window {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 420px;
  max-height: 560px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
  margin-bottom: 16px;
}

.chat-window::-webkit-scrollbar {
  width: 6px;
}

.chat-window::-webkit-scrollbar-track {
  background: transparent;
}

.chat-window::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

/* Message rows */
.msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: fadeSlideIn 0.35s ease-out;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-row.user {
  flex-direction: row-reverse;
}

/* Avatars */
.msg-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
}

.msg-avatar.ai {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  box-shadow: 0 4px 14px var(--orange-glow);
  color: white;
}

.msg-avatar.user-av {
  background: var(--navy-light);
  border: 1px solid var(--glass-border);
  font-size: 1.1rem;
}

/* Bubbles */
.msg-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.8;
  word-break: break-word;
}

.msg-row.ai .msg-bubble {
  background: var(--chat-ai-bg);
  border: 1px solid var(--glass-border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.msg-row.user .msg-bubble {
  background: var(--chat-user-bg);
  border-top-right-radius: 4px;
  color: white;
  box-shadow: 0 4px 16px var(--orange-glow);
}

/* Markdown content */
.msg-bubble h3,
.msg-bubble h4 {
  color: var(--orange-light);
  margin: 12px 0 6px;
  font-size: 0.95rem;
}

.msg-bubble strong {
  color: var(--white);
}

.msg-bubble em {
  color: var(--orange-light);
}

.msg-bubble ul,
.msg-bubble ol {
  padding-left: 20px;
  margin: 8px 0;
}

.msg-bubble li {
  margin: 4px 0;
}

.msg-bubble code {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: var(--orange-light);
}

.msg-bubble pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 14px;
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--glass-border);
}

.msg-bubble pre code {
  background: none;
  padding: 0;
  color: #a8d8a8;
}

.msg-bubble p {
  margin: 6px 0;
}

.msg-bubble hr {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 14px 0;
}

.msg-bubble blockquote {
  border-left: 3px solid var(--orange);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
  font-style: italic;
}

/* Loading dots */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--orange);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* =============================================
   Input Area
   ============================================= */
.input-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-glow);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--white);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  outline: none;
  resize: none;
  min-height: 26px;
  max-height: 160px;
}

.chat-input::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--orange-glow);
}

.send-btn:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.45);
}

.send-btn:active {
  transform: scale(0.97);
}

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

.input-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
  padding-right: 4px;
}

/* =============================================
   CTA Section
   ============================================= */
.cta-section {
  background: linear-gradient(135deg, var(--navy-mid) 0%, rgba(255, 107, 53, 0.08) 100%);
  border-top: 1px solid var(--glass-border);
  padding: 64px 24px;
}

.cta-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.cta-badge {
  display: inline-block;
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.3);
  color: var(--orange-light);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.cta-title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 900;
  color: var(--white);
  margin-bottom: 16px;
}

.cta-highlight {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cta-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.9;
}

.cta-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 36px;
  text-align: left;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

.cta-features li {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 500;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

.cta-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  border-radius: var(--radius-md);
  color: white;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 18px 40px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 8px 30px rgba(255, 107, 53, 0.35);
  letter-spacing: 0.02em;
}

.cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(255, 107, 53, 0.5);
}

/* =============================================
   Footer
   ============================================= */
.footer {
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--glass-border);
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.8;
}

.footer-note {
  font-size: 0.75rem;
  margin-top: 4px;
}

/* =============================================
   Model Selector
   ============================================= */
.model-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.model-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.model-select {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.82rem;
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  max-width: 300px;
}

.model-select:focus {
  border-color: var(--orange);
}

.model-select option {
  background: var(--navy-mid);
  color: var(--text-primary);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 600px) {
  .header-inner {
    padding: 12px 16px;
  }

  .header-name {
    font-size: 0.85rem;
  }

  .header-tagline {
    display: none;
  }

  .btn-outline {
    display: none;
  }

  .hero {
    padding: 44px 16px 32px;
  }

  .app-container {
    padding: 20px 14px;
  }

  .chat-window {
    min-height: 380px;
    max-height: 460px;
    padding: 16px;
  }

  .msg-bubble {
    max-width: 88%;
    font-size: 0.88rem;
  }

  .cta-section {
    padding: 44px 16px;
  }

  .cta-btn {
    padding: 16px 28px;
    font-size: 0.95rem;
  }

  .subject-tabs {
    gap: 6px;
  }

  .tab {
    font-size: 0.78rem;
    padding: 7px 12px;
  }
}

/* =============================================
   LINE誘導バナー
   ============================================= */
.line-banner {
  border: 1px solid rgba(6, 199, 85, 0.35);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(6, 199, 85, 0.07) 0%, rgba(6, 199, 85, 0.03) 100%);
  padding: 18px 20px 16px;
  margin-top: -8px;
  animation: fadeSlideIn 0.4s ease-out;
  position: relative;
  overflow: hidden;
}

.line-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #06C755, #00e676);
}

.line-banner-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(6, 199, 85, 0.8);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.line-banner-lead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 10px;
}

.line-banner-emoji {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.line-banner-body {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 14px;
}

.line-banner-body strong {
  color: var(--text-primary);
}

.line-banner-features {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.line-banner-feature-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(6, 199, 85, 0.9);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.line-banner-features ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-banner-features ul li {
  font-size: 0.82rem;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lbf-label {
  display: inline-block;
  background: rgba(6, 199, 85, 0.15);
  border: 1px solid rgba(6, 199, 85, 0.3);
  color: rgba(6, 199, 85, 0.9);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.line-banner-how {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid rgba(6, 199, 85, 0.5);
}

.line-banner-how strong {
  color: var(--text-primary);
}

.line-banner-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #06C755, #00e676);
  border-radius: var(--radius-sm);
  color: white;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 13px 20px;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(6, 199, 85, 0.3);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.line-banner-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(6, 199, 85, 0.45);
}

.line-banner-btn:active {
  transform: scale(0.98);
}

.line-banner-caution {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  opacity: 0.85;
}