.stfc {
  --stfc-bg: #fffaf5;
  --stfc-surface: #ffffff;
  --stfc-surface-soft: #fbf5df;
  --stfc-line: #e4d6a7;
  --stfc-line-strong: #a47b12;
  --stfc-text: #2f2415;
  --stfc-muted: #6a5a2b;
  --stfc-accent: #8f6d0d;
  --stfc-accent-strong: #6f5308;
  --stfc-accent-soft: #f4e7b0;
  --stfc-warn: #b00020;
  --stfc-shadow: 0 14px 40px rgba(111, 83, 8, 0.08);
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 12px;
  color: var(--stfc-text);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: clip;
}

.stfc,
.stfc * {
  box-sizing: border-box;
}

.stfc-form {
  width: 100%;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--stfc-line);
  border-radius: 24px;
  background: var(--stfc-surface);
  box-shadow: var(--stfc-shadow);
}

.stfc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.stfc-grid label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-grid input,
.stfc-grid select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--stfc-line-strong);
  border-radius: 14px;
  font-size: 16px;
  color: var(--stfc-text);
  background: var(--stfc-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.stfc-grid input:focus,
.stfc-grid select:focus {
  outline: none;
}

.stfc-grid input:focus-visible,
.stfc-grid select:focus-visible,
.stfc-boundary-btn:focus-visible,
.stfc-submit:focus-visible,
.stfc-kanshi-btn:focus-visible,
.stfc-link:focus-visible {
  outline: none;
  border-color: var(--stfc-accent);
  box-shadow: 0 0 0 4px rgba(143, 109, 13, 0.16);
}

.stfc-boundary {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.stfc-boundary-label {
  margin-bottom: 8px;
  font-weight: 800;
  color: var(--stfc-text);
}

.stfc-boundary-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stfc-boundary-btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--stfc-line-strong);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--stfc-muted);
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.stfc-boundary-btn:hover {
  transform: translateY(-1px);
  border-color: var(--stfc-accent);
}

.stfc-boundary-btn.is-active {
  border-color: var(--stfc-accent-strong);
  background: var(--stfc-accent-strong);
  color: #fff;
}

.stfc-boundary-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--stfc-muted);
}

.stfc-boundary-note.is-warn {
  color: var(--stfc-warn);
  font-weight: 700;
}

.stfc-storage {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--stfc-line);
  border-radius: 18px;
  background: #fffdf6;
}

.stfc-storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stfc-storage-field {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-storage input,
.stfc-storage select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--stfc-line-strong);
  border-radius: 14px;
  background: var(--stfc-surface);
  color: var(--stfc-text);
  font-size: 15px;
}

.stfc-storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.stfc-storage-btn {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--stfc-line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--stfc-accent-strong);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.stfc-storage-btn:hover {
  transform: translateY(-1px);
  border-color: var(--stfc-accent);
}

.stfc-storage-btn.is-primary {
  background: var(--stfc-accent-strong);
  color: #fff;
}

.stfc-storage-btn.is-subtle {
  color: #8a6a10;
  border-color: #cdb765;
}

.stfc-storage-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--stfc-muted);
}

.stfc-storage-status {
  min-height: 1.4em;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-storage-status[data-tone="success"] {
  color: var(--stfc-accent-strong);
}

.stfc-storage-status[data-tone="error"] {
  color: var(--stfc-warn);
}

.stfc-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.stfc-submit {
  min-width: 220px;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--stfc-accent-strong);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(111, 83, 8, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.stfc-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(111, 83, 8, 0.28);
}

.stfc-submit:disabled {
  cursor: wait;
  opacity: 0.82;
  transform: none;
  box-shadow: none;
}

.stfc-result {
  margin-top: 20px;
}

.stfc-loading,
.stfc-error,
.stfc-warning {
  padding: 14px 16px;
  border-radius: 18px;
}

.stfc-loading {
  border: 1px solid var(--stfc-line);
  background: var(--stfc-surface);
  color: var(--stfc-muted);
}

.stfc-error {
  border: 1px solid rgba(176, 0, 32, 0.2);
  background: #fff1f3;
  color: var(--stfc-warn);
  font-weight: 700;
}

.stfc-warning {
  border: 1px solid #f0c36d;
  background: #fff8e5;
  margin-bottom: 14px;
}

.stfc-output {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.stfc-section {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--stfc-line);
  border-radius: 24px;
  background: var(--stfc-surface);
  box-shadow: var(--stfc-shadow);
}

.stfc-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--stfc-text);
}

.stfc-sub {
  display: grid;
  gap: 4px;
}

.stfc-sub p {
  margin: 0;
  font-size: 14px;
  color: var(--stfc-muted);
}

.stfc-pillar-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  min-width: 0;
}

.stfc-kanshi-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 14px 16px;
  border: 1px solid var(--stfc-line);
  border-radius: 18px;
  text-decoration: none;
  color: var(--stfc-text);
  background: var(--stfc-surface);
  box-shadow: 0 10px 24px rgba(111, 83, 8, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.stfc-kanshi-btn:hover {
  transform: translateY(-2px);
  border-color: var(--stfc-accent);
  background: #fff5ef;
  box-shadow: 0 14px 28px rgba(111, 83, 8, 0.16);
}

.stfc-kanshi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-kanshi-btn:hover .stfc-kanshi-label {
  color: var(--stfc-accent-strong);
}

.stfc-kanshi-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.stfc-kanshi-action {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  color: var(--stfc-accent-strong);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.stfc-scrollhint {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--stfc-muted);
}

.stfc-scrollwrap {
  position: relative;
  border-radius: 18px;
  background: #f8efe6;
  padding: 1px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.stfc-scrollwrap::after {
  content: none;
}

.stfc-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  padding-bottom: 8px;
  border-radius: 17px;
  background: var(--stfc-surface);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.stfc-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

.stfc-table td {
  min-width: 84px;
  padding: 10px 12px;
  border-right: 1px solid var(--stfc-line);
  border-bottom: 1px solid var(--stfc-line);
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  font-size: 14px;
  background: var(--stfc-surface);
}

.stfc-table tr:first-child td {
  background: var(--stfc-surface-soft);
  font-weight: 800;
}

.stfc-table tr:first-child td,
.stfc-table td:first-child {
  border-top: 1px solid var(--stfc-line);
}

.stfc-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 92px;
  background: #fffaf3;
  font-weight: 800;
  color: var(--stfc-text);
}

.stfc-table tr:first-child td:first-child {
  z-index: 3;
}

.stfc-table td:last-child {
  border-right: 1px solid var(--stfc-line);
}

.stfc-desktop-table {
  display: block;
}

.stfc-mobile-grid {
  display: none;
}

.stfc-mobile-card {
  border: 1px solid var(--stfc-line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--stfc-surface);
  box-shadow: 0 8px 22px rgba(111, 83, 8, 0.08);
}

.stfc-mobile-card.is-turning-point {
  border-color: #caa233;
}

.stfc-mobile-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--stfc-line);
  background: #faf4dd;
}

.stfc-mobile-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-mobile-card-kanshi {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  color: var(--stfc-text);
  line-height: 1.15;
}

.stfc-mobile-card-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--stfc-accent-strong);
  font-weight: 700;
}

.stfc-mobile-card-body {
  padding: 8px 14px 12px;
}

.stfc-mobile-row {
  display: grid;
  grid-template-columns: minmax(92px, 108px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #f1e6bf;
}

.stfc-mobile-row:first-child {
  border-top: 0;
}

.stfc-mobile-key {
  font-size: 12px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-mobile-value {
  min-width: 0;
  font-size: 14px;
  color: var(--stfc-text);
  line-height: 1.45;
}

.stfc-empty {
  color: #8a8062;
}

.stfc-natal-table {
  display: block;
}

.stfc-natal-cards {
  display: none;
}

.stfc-natal-card {
  border: 1px solid var(--stfc-line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--stfc-surface);
}

.stfc-natal-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--stfc-line);
  background: #faf2e8;
}

.stfc-natal-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-natal-card-kanshi {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  color: var(--stfc-text);
  line-height: 1.1;
}

.stfc-natal-card-body {
  padding: 8px 14px 12px;
}

.stfc-natal-row {
  display: grid;
  grid-template-columns: minmax(92px, 108px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #f0e4d7;
}

.stfc-natal-row:first-child {
  border-top: 0;
}

.stfc-natal-key {
  font-size: 12px;
  font-weight: 700;
  color: var(--stfc-muted);
}

.stfc-natal-value {
  min-width: 0;
  font-size: 14px;
  color: var(--stfc-text);
  line-height: 1.45;
}

.stfc-table .is-turning-point {
  background: #fbf5df;
  font-weight: 800;
  border-top: 3px solid #caa233;
}

.stfc-turning-note {
  font-size: 10px;
  color: var(--stfc-accent-strong);
}

.stfc-tags {
  display: grid;
  gap: 4px;
}

.stfc-tag-link,
.stfc-tag-text {
  display: block;
}

.stfc-link {
  color: var(--stfc-accent-strong);
  text-decoration: underline;
  text-decoration-color: rgba(142, 64, 34, 0.25);
  text-underline-offset: 0.15em;
}

.stfc-link:hover {
  text-decoration-color: currentColor;
}

.stfc-summary-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(234, 220, 205, 0.8);
}

.stfc-summary-title {
  margin-bottom: 6px;
}

.stfc-summary-copy {
  margin-bottom: 10px;
}

.stfc-graph-cell {
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #555;
}

.stfc-lucky-color {
  margin-top: 20px;
  padding: 18px;
  border: 2px dashed #caa233;
  border-radius: 20px;
  background: #fffdf5;
  text-align: center;
}

.stfc-lucky-kicker {
  margin: 0;
  font-size: 0.9rem;
  color: var(--stfc-muted);
}

.stfc-lucky-title {
  margin: 6px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--stfc-accent-strong);
}

.stfc-lucky-value {
  margin-top: 12px;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--stfc-text);
}

.stfc-lucky-value span {
  display: inline-block;
  padding-bottom: 4px;
  border-bottom: 3px solid #caa233;
}

.stfc-lucky-copy {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #777;
}

@media (max-width: 900px) {
  .stfc {
    max-width: 100%;
    padding: 0 10px;
  }

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

  .stfc-pillar-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stfc-storage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .stfc-form,
  .stfc-section {
    padding: 16px;
    border-radius: 20px;
  }

  .stfc {
    padding: 0 8px;
  }

  .stfc-actions {
    justify-content: stretch;
  }

  .stfc-storage-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stfc-submit {
    width: 100%;
    min-width: 0;
  }

  .stfc-boundary-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .stfc-boundary-btn {
    justify-content: center;
  }

  .stfc-title {
    font-size: 17px;
  }

  .stfc-scrollhint {
    display: none;
  }

  .stfc-desktop-table,
  .stfc-natal-table {
    display: none;
  }

  .stfc-mobile-grid,
  .stfc-natal-cards {
    display: grid;
    gap: 12px;
  }

  .stfc-scrollwrap,
  .stfc-natal-scrollwrap {
    padding: 0;
    background: transparent;
    overflow: visible;
  }

  .stfc-scroll,
  .stfc-natal-scrollwrap .stfc-scroll {
    background: transparent;
    overflow: visible;
    padding-bottom: 0;
  }

  .stfc-sub p {
    font-size: 13px;
  }

  .stfc-table td {
    min-width: 74px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .stfc-table td:first-child {
    min-width: 82px;
    position: static;
  }

  .stfc-mobile-row,
  .stfc-natal-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stfc-lucky-value {
    font-size: 1.3rem;
  }
}

@media (max-width: 460px) {
  .stfc-pillar-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stfc-grid input,
  .stfc-grid select {
    min-height: 46px;
    padding: 11px 12px;
  }

  .stfc-kanshi-btn {
    min-height: 76px;
  }

  .stfc-kanshi-value {
    font-size: 22px;
  }

  .stfc-natal-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stfc-natal-card-head {
    padding: 12px 14px;
  }

  .stfc-mobile-card-head {
    padding: 12px 14px;
  }

  .stfc-mobile-card-kanshi,
  .stfc-natal-card-kanshi {
    font-size: 22px;
  }
}
