:root {
  --bg: #0b0f1a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --ink: #e2e8f0;
  --muted: #8b95a8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #4f8ef7;
  --accent-soft: rgba(79, 142, 247, 0.14);
  --positive: #34d399;
  --negative: #f87171;
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(79, 142, 247, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(52, 211, 153, 0.08), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

/* ---- Header ---- */

.site-header {
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.header-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

nav {
  display: flex;
  gap: 16px;
}

nav a {
  color: var(--muted);
  font-size: 0.83rem;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(79, 142, 247, 0.3);
}

h1 {
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 14px;
}

h2, h3 {
  font-weight: 700;
}

h3 {
  font-size: 0.95rem;
  margin-bottom: 7px;
}

.header-sub {
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 520px;
  margin-bottom: 18px;
}

.header-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.header-tags span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(79, 142, 247, 0.22);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ---- Main tool area (vertical flow) ---- */

.main-tool {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ---- Result area ---- */

.result-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 20px;
}

.gauge-wrap {
  position: relative;
}

.gauge-svg {
  width: 100%;
  display: block;
}

.gauge-center {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.gauge-kicker {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.gauge-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.metric-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-sub span {
  font-size: 0.76rem;
}

.net-profit {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 10px;
}

.net-profit.positive { color: var(--positive); }
.net-profit.negative { color: var(--negative); }

.net-summary {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.65;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stat {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.stat-label {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 5px;
  line-height: 1.4;
}

.stat-val {
  font-size: 1.1rem;
  font-weight: 700;
}

.stat-val.positive { color: var(--positive); }
.stat-val.negative { color: var(--negative); }

/* ---- Input area ---- */

.card-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.card-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 20px;
}

.input-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

label {
  font-size: 0.87rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field small {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
}

.input-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-box input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
}

.input-box span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  border-left: 1px solid var(--line);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

select {
  font: inherit;
  font-size: 0.92rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 32px 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 10 7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b95a8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select option {
  background: #1a2035;
  color: var(--ink);
}

/* Cost presets */

.cost-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}

.cost-btn {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 140ms ease, background 140ms ease;
}

.cost-btn small {
  display: block;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 400;
}

.cost-btn:hover {
  border-color: var(--accent);
  background: rgba(79, 142, 247, 0.1);
}

.cost-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.cost-btn.active small {
  color: rgba(79, 142, 247, 0.7);
}

/* Slider */

.slider {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.22);
  transition: transform 140ms ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
}

.rate-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.preset-hint {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Recommend area ---- */

.recommend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0 10px;
}

.tool-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.tool-card:hover {
  border-color: var(--accent);
  background: rgba(79, 142, 247, 0.1);
  transform: translateY(-1px);
}

.tool-name {
  font-size: 0.93rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.tool-price {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.tool-desc {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
}

.tool-arrow {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
  margin-left: 10px;
  transition: color 150ms ease;
}

.tool-card:hover .tool-arrow {
  color: var(--accent);
}

.ad-note {
  font-size: 0.73rem;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ---- Guide section ---- */

.guide-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.guide-card {
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.guide-card p {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.75;
}

/* ---- Footer ---- */

.site-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.site-footer p {
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 560px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.81rem;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(79, 142, 247, 0.3);
  white-space: nowrap;
}

/* ---- Document pages (privacy, terms, 404) ---- */

.document-shell {
  max-width: 760px;
  padding-top: 28px;
  margin: 0 auto;
}

.document-panel {
  padding: 32px;
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.88rem;
  text-underline-offset: 0.2em;
  text-decoration-color: rgba(79, 142, 247, 0.3);
}

.document-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 8px;
}

.document-lead {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

.document-section {
  margin-top: 24px;
}

.document-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.document-section p,
.document-list {
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.9;
}

.document-list {
  padding-left: 18px;
}

/* ---- Responsive ---- */

@media (max-width: 680px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .result-top {
    grid-template-columns: 1fr;
  }

  .gauge-wrap {
    width: 180px;
    margin: 0 auto;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .input-grid-2 {
    grid-template-columns: 1fr;
  }

  .cost-presets {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .site-footer {
    flex-direction: column;
    gap: 14px;
  }
}
