/* ——— XAIAX Tools ——— */
.tools-page {
  background-color: #f4f7fb;
  background-image:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(59, 130, 246, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 70% 45% at 0% 100%, rgba(16, 185, 129, 0.12) 0%, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

.tools-page .tool-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 24px;
}

.tool-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.tool-header-art {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  animation: toolArtFloat 5s ease-in-out infinite;
}

.tool-header-apple {
  width: 64px;
  height: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.12));
}

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

.tool-header h1 {
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  color: var(--text-primary);
  margin: 0 0 8px;
  font-weight: 700;
}

.tool-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
  max-width: 32em;
  margin: 0 auto;
}

.tool-card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 16px;
  padding: 26px 22px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
  margin-bottom: 16px;
}

.tool-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

@media (max-width: 560px) {
  .tool-form-grid {
    grid-template-columns: 1fr;
  }
}

.tool-form-grid .form-group {
  margin-bottom: 0;
}

.tool-form-grid label,
.tool-field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tool-required-star {
  display: inline-block;
  color: #dc2626;
  margin-inline-start: 2px;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  position: relative;
  top: -0.5em;
}

.tool-form-group-center {
  grid-column: 1 / -1;
  width: calc(50% - 7px);
  max-width: 100%;
  margin-inline: auto;
}

.tool-field-label-center {
  text-align: center;
  white-space: nowrap;
}

.tool-field-hint {
  font-size: 0.72rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.tool-form-grid input,
.tool-form-grid select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-form-grid input:focus,
.tool-form-grid select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.tool-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.tool-actions .btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.tool-results {
  display: none;
  animation: toolFadeIn 0.45s ease;
}

.tool-results.visible {
  display: block;
}

@keyframes toolFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-score-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  text-align: center;
  margin-bottom: 16px;
  padding: 22px 16px 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.08) 0%, rgba(16, 185, 129, 0.06) 100%);
  border: 1px solid rgba(99, 102, 241, 0.12);
  position: relative;
  overflow: hidden;
}

.tool-score-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.5) 0%, transparent 50%);
  pointer-events: none;
}

.tool-score-ring-svg {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.tool-progress-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tool-progress-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 8;
}

.tool-progress-fill {
  fill: none;
  stroke: #14b8a6;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1s ease-out, stroke 0.3s;
}

.tool-score-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 160px;
}

.tool-score-value {
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.tool-score-value.score-high { color: #059669; }
.tool-score-value.score-mid { color: #d97706; }
.tool-score-value.score-low { color: #dc2626; }

.tool-score-badge {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-primary);
}

.tool-score-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.tool-benchmark-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.tool-benchmark-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid var(--border-light);
}

.tool-benchmark-row strong {
  font-weight: 700;
}

.tool-benchmark-row.is-better strong {
  color: #059669;
}

.tool-benchmark-row.is-worse strong {
  color: #dc2626;
}

.tool-section-title {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-priority-box {
  margin-bottom: 14px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

.tool-priority-box[hidden] {
  display: none !important;
}

.tool-priority-box p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.tool-metrics-grid {
  display: none;
}

.tool-status-list {
  display: none;
}

@media (max-width: 768px) {
  .tools-page .tool-main {
    padding: 16px 12px 20px;
    font-size: 1.0625rem;
  }

  .tool-header {
    margin-bottom: 12px;
  }

  .tool-header-art {
    width: 56px;
    height: auto;
    margin-bottom: 8px;
  }

  .tool-header-apple {
    width: 56px;
  }

  .tool-header h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
  }

  .tool-header p {
    font-size: 0.9rem;
    line-height: 1.65;
  }

  .tool-card {
    padding: 14px 12px;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .tool-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .tool-form-grid label,
  .tool-field-label {
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 4px;
  }

  .tool-required-star {
    font-size: 1.15rem;
    top: -0.5em;
  }

  .tool-form-grid input {
    padding: 8px 9px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .tool-hint {
    font-size: 0.78rem;
    margin-top: 8px;
    line-height: 1.55;
  }

  .tool-actions {
    margin-top: 10px;
  }

  .tool-actions .btn-primary {
    padding: 12px 16px;
    font-size: 1.05rem;
  }

  .tool-score-ring {
    margin-bottom: 12px;
    padding: 16px 12px 14px;
    flex-direction: column;
  }

  .tool-score-ring-svg {
    width: 88px;
    height: 88px;
  }

  .tool-score-value {
    font-size: 1.65rem;
  }

  .tool-score-badge {
    font-size: 1rem;
  }

  .tool-score-label {
    font-size: 0.95rem;
  }

  .tool-benchmark-row {
    font-size: 0.88rem;
  }

  .tool-section-title {
    font-size: 1rem;
  }

  .tool-priority-box p {
    font-size: 0.95rem;
  }

  .tool-chart-wrap {
    height: 200px;
    margin-bottom: 12px;
    padding: 8px;
  }

  .tool-report-teaser {
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .tool-cta-strip .btn-primary {
    padding: 12px 16px;
    font-size: 1rem;
  }
}

.tool-chart-wrap {
  position: relative;
  height: 280px;
  min-height: 200px;
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid var(--border-light);
}

.tool-chart-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.tool-report-teaser {
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--text-secondary);
  margin: 0 0 4px;
  padding: 0 8px;
}

.tool-cta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 0;
  border-top: none;
}

.tool-cta-strip .btn-primary {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.tool-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-dark);
  color: #fff;
  font-size: 0.875rem;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(90vw, 420px);
  text-align: center;
}

.tool-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-toast-error {
  background: #b91c1c;
}

.tools-page .container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 32px;
}
