/* ============================================================
   複利計算シミュレーター — style.css
   Primary: #059669 (Emerald Green)
   ============================================================ */

:root {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-rgb: 5, 150, 105;
  --primary-light: #d1fae5;
  --primary-xlight: #ecfdf5;
  --bg: #f9f7f4;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-weak: #9ca3af;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  --transition: 0.15s ease;
}

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

body {
  font-family: 'Outfit', 'BIZ UDPGothic', -apple-system, BlinkMacSystemFont,
    'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  word-break: break-word;
}

/* ============================================================
   Header
   ============================================================ */
header {
  background: linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  color: #fff;
  padding: 2rem 1.25rem 1.75rem;
  text-align: center;
}

.header-inner {
  max-width: 780px;
  margin: 0 auto;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 100px;
  padding: 0.25rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 0.9rem;
  opacity: 0.88;
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* ============================================================
   Main Layout
   ============================================================ */
main {
  max-width: 780px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

/* ============================================================
   Ad Unit
   ============================================================ */
.ad-unit {
  min-height: 90px;
  background: var(--border);
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-weak);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px dashed #cbd5e1;
}

/* ============================================================
   Privacy Notice
   ============================================================ */
.privacy-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-xlight);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  color: #065f46;
  margin-bottom: 1.25rem;
}

.privacy-notice i {
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
}

/* ============================================================
   Card (共通)
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* ============================================================
   Tool Section
   ============================================================ */
.tool-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.section-title i {
  color: var(--primary);
}

/* ============================================================
   Form Grid
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.field-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.field input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  font-family: 'Outfit', sans-serif;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
  width: 100%;
  color: var(--text);
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

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

/* ============================================================
   Scenario Checkboxes
   ============================================================ */
.scenario-box {
  background: #f8fffe;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.scenario-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #065f46;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.scenario-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  min-height: 44px;
  padding: 0.25rem 0;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

.check-text {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

.scenario-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ============================================================
   Inline Validation
   ============================================================ */
.is-invalid {
  border-color: #dc2626 !important;
}

.field-error {
  color: #dc2626;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
  min-height: 1em;
}

/* ============================================================
   Primary Button
   ============================================================ */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Outfit', 'BIZ UDPGothic', sans-serif;
  cursor: pointer;
  min-height: 48px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ============================================================
   Result Section
   ============================================================ */
.result-section {
  margin-top: 1.5rem;
}

/* Hero */
.result-hero {
  background: linear-gradient(135deg, var(--primary-xlight) 0%, #d1fae5 100%);
  border: 2px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.result-hero-label {
  font-size: 0.9375rem;
  color: #065f46;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-hero-value {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.result-unit {
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 600;
  margin-left: 0.25rem;
}

.result-hero-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: box-shadow var(--transition), transform var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.summary-card.accent {
  background: linear-gradient(135deg, var(--primary-xlight), #d1fae5);
  border-color: #a7f3d0;
}

.summary-icon {
  font-size: 1.5rem;
  margin-bottom: 0.375rem;
  color: var(--primary);
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.summary-value {
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.summary-card.accent .summary-value {
  color: var(--primary);
}

.summary-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* Chart */
.chart-wrapper {
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.chart-title i {
  color: var(--primary);
}

/* Table */
.table-wrapper {
  margin-bottom: 1.25rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 400px;
}

.summary-table th {
  background: #f0fdf4;
  color: #065f46;
  font-weight: 700;
  padding: 0.625rem 0.875rem;
  text-align: right;
  border-bottom: 2px solid #a7f3d0;
  white-space: nowrap;
}

.summary-table th:first-child {
  text-align: left;
}

.summary-table td {
  padding: 0.5rem 0.875rem;
  text-align: right;
  border-bottom: 1px solid #f0f4f8;
  color: var(--text);
}

.summary-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
}

.summary-table tr:last-child td {
  border-bottom: none;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-xlight);
}

.summary-table tr:hover td {
  background: #f8fffe;
}

/* ============================================================
   Howto Section
   ============================================================ */
.howto-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 2rem;
}

/* ============================================================
   Accordion
   ============================================================ */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  overflow: hidden;
}

.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: #fafafa;
  list-style: none;
  min-height: 48px;
  transition: background var(--transition);
  user-select: none;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary:hover {
  background: var(--primary-xlight);
}

.accordion-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.accordion-left i {
  color: var(--primary);
}

.accordion-arrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 1rem 1.125rem 1.125rem;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.75;
  border-top: 1px solid var(--border);
  background: #fff;
}

.mt {
  margin-top: 0.75rem;
}

.steps {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.steps li {
  line-height: 1.6;
}

.steps-ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  list-style: disc;
}

/* Rule 72 Table */
.rule72-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rule72-table th {
  background: var(--primary-xlight);
  color: #065f46;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #a7f3d0;
}

.rule72-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f0f4f8;
}

.rule72-table tr:last-child td {
  border-bottom: none;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.faq-item {
  background: #fafafa;
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  border-left: 3px solid var(--primary);
}

.faq-q {
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.faq-q i {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.faq-a {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding-left: 1.375rem;
}

/* ============================================================
   Next Action CTA
   ============================================================ */
.next-action-block {
  background: #f0fdf4;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1.5rem;
}

.next-action-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.next-action-link {
  display: block;
  color: var(--primary);
  text-decoration: none;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.next-action-link:hover {
  text-decoration: underline;
}

/* ============================================================
   Footer
   ============================================================ */
footer {
  background: #1a1a2e;
  color: #9ca3af;
  padding: 2rem 1.25rem;
  text-align: center;
  margin-top: 3rem;
}

.footer-inner {
  max-width: 780px;
  margin: 0 auto;
}

.footer-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.75rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition);
}

.footer-nav a:hover {
  color: #d1fae5;
}

.footer-copy {
  font-size: 0.8125rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .result-hero {
    padding: 1.5rem 1rem;
  }
}

@media (min-width: 640px) {
  main {
    padding: 1.75rem 2rem 3.5rem;
  }

  .tool-section,
  .howto-section {
    padding: 2rem;
  }

  .card {
    padding: 2rem;
  }
}
