:root {
  --color-bg: #f6f8fa;
  --color-text: #1f2933;
  --color-primary: #7c3aed;
  --accent2: #db2777;
  --grad: linear-gradient(120deg, var(--color-primary), var(--accent2));
  --btn-c1: var(--color-primary);
  --btn-c2: var(--accent2);
  --btn-grad: linear-gradient(120deg, var(--btn-c1), var(--btn-c2));
  --color-card: #ffffff;
  --color-border: #d7dde3;
  --color-warn: #dc2626;
  --muted: #6b7280;
  --hero-grid: rgba(20, 20, 40, 0.05);
  --radius: 10px;
}

:root[data-theme="dark"] {
  --color-bg: #121214;
  --color-text: #ececee;
  --color-primary: #a78bfa;
  --accent2: #f472b6;
  /* ボタンの塗りは文字用のaccentよりトーンを落として、暗い背景で発光しすぎないようにする */
  --btn-c1: #7c3aed;
  --btn-c2: #db2777;
  --color-card: #1c1c20;
  --color-border: #2c2c31;
  --muted: #9a9aa2;
  --hero-grid: rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .stat-card {
  background: #1c1c20;
}
:root[data-theme="dark"] .ad-slot {
  background: #1c1c20;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle, var(--hero-grid) 1px, transparent 1px),
    radial-gradient(900px circle at 15% -10%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent 55%),
    radial-gradient(800px circle at 100% 10%, color-mix(in srgb, var(--accent2) 9%, transparent), transparent 55%);
  background-size: 22px 22px, auto, auto;
  background-attachment: fixed;
  color: var(--color-text);
  line-height: 1.7;
}

header { padding: 2rem 1rem 1rem; text-align: center; }
header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead { color: var(--muted); margin: 0; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.calculator {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 1.5rem;
}

#text-input {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.stat-card {
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label { font-size: 0.8rem; color: var(--muted); }
.stat-value { font-size: 1.4rem; font-weight: bold; color: var(--color-primary); }

#twitter-card.over-limit .stat-value { color: var(--color-warn); }

.ad-slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f4;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
  margin: 1.5rem 0;
}

.info {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.info h2 { font-size: 1.2rem; margin-top: 1.5rem; }
.info h2:first-child { margin-top: 0; }
.info ul { padding-left: 1.3rem; }
.info li { margin-bottom: 0.5rem; }

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  header h1 { font-size: 1.4rem; }
  .calculator, .info { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.2rem; }
}

.site-nav {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  box-sizing: border-box;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  color: inherit;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.site-nav a:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
}
