:root {
  --bg: #0a0a0c;
  --ink: #ece8e2;
  --ink-soft: #8f8a83;
  --crimson: #c8102e;
  --crimson-deep: #8c0c20;
  --gold: #c9a24b;
  --gold-soft: #e3c984;
  --card: #15151a;
  --card-line: rgba(201, 162, 75, 0.35);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  font-family: "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  /* スポットライト＆ヴィネット */
  background-image:
    radial-gradient(120% 90% at 50% -10%, rgba(200, 16, 46, 0.22), transparent 55%),
    radial-gradient(100% 80% at 50% 120%, rgba(201, 162, 75, 0.10), transparent 60%),
    radial-gradient(140% 120% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.85) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 18px 56px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* フィルムグレイン */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: rise 0.6s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== hero ===== */
.hero { text-align: center; padding-top: 6px; }
.kicker {
  display: inline-block;
  font-family: "Shippori Mincho B1", serif;
  color: var(--gold-soft);
  font-size: 13px;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
  opacity: 0.9;
}
.title {
  font-family: "Shippori Mincho B1", serif;
  line-height: 1.2;
  font-weight: 800;
}
.title span { display: block; }
.title__a {
  font-size: clamp(28px, 8vw, 40px);
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 18px rgba(200, 16, 46, 0.5);
}
.title__b {
  font-size: clamp(30px, 9.2vw, 46px);
  color: #fff;
  margin-top: 8px;
  letter-spacing: 0.02em;
}
#title-trend {
  display: inline;
  color: var(--gold);
  padding: 0 2px;
  text-shadow: 0 0 22px rgba(201, 162, 75, 0.6);
}
.speech {
  position: relative;
  display: inline-block;
  margin-top: 24px;
  font-family: "Shippori Mincho B1", serif;
  background: rgba(12, 12, 16, 0.6);
  border: 1px solid var(--card-line);
  border-left: 3px solid var(--crimson);
  border-radius: 6px;
  padding: 13px 20px;
  font-size: 14.5px;
  color: var(--ink);
  backdrop-filter: blur(4px);
}
.speech b { color: var(--gold-soft); font-weight: 800; }

/* ===== panel ===== */
.panel {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 24px 18px 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}
.panel__label {
  font-family: "Shippori Mincho B1", serif;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold-soft);
  margin-bottom: 14px;
}
.panel__label--tone { margin-top: 22px; }
.reload {
  font-family: "Zen Kaku Gothic New", sans-serif;
  display: inline-block;
  margin-left: 8px;
  font-size: 11.5px;
  letter-spacing: 0;
  color: var(--ink-soft);
  border: 1px solid rgba(236, 232, 226, 0.22);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.reload:hover { color: var(--gold-soft); border-color: var(--gold); }
.reload.is-spin { opacity: 0.6; pointer-events: none; }
.trends__loading {
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 6px 0;
}

/* チップ */
.trends, .tones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.trend, .tone {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(236, 232, 226, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.trend:hover, .tone:hover { color: var(--ink); border-color: var(--gold); }
.trend:active, .tone:active { transform: scale(0.96); }
.trend.is-active {
  background: rgba(201, 162, 75, 0.14);
  border-color: var(--gold);
  color: var(--gold-soft);
}
.tone.is-active {
  background: var(--crimson);
  border-color: var(--crimson);
  color: #fff;
  box-shadow: 0 0 16px rgba(200, 16, 46, 0.5);
}

/* 自由入力 */
.custom {
  width: 100%;
  margin-top: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(236, 232, 226, 0.2);
  border-radius: 6px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.custom::placeholder { color: var(--ink-soft); font-weight: 500; }
.custom:focus { border-color: var(--gold); }

/* 決定ボタン */
.generate {
  width: 100%;
  margin-top: 8px;
  font-family: "Shippori Mincho B1", serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, var(--crimson), var(--crimson-deep));
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 17px;
  cursor: pointer;
  box-shadow: 0 8px 26px rgba(200, 16, 46, 0.4);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.generate:hover { box-shadow: 0 10px 32px rgba(200, 16, 46, 0.6); transform: translateY(-1px); }
.generate:active { transform: translateY(2px); }

/* AIボタン */
.ai-btn {
  width: 100%;
  margin-top: 14px;
  font-family: "Shippori Mincho B1", serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-soft);
  background: transparent;
  border: 1px solid var(--card-line);
  border-radius: 8px;
  padding: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ai-btn:hover { background: rgba(201, 162, 75, 0.08); border-color: var(--gold); }
.ai-btn:active { transform: scale(0.98); }
.ai-btn:disabled { cursor: progress; opacity: 0.8; }
.ai-btn__loading { display: inline-block; animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.4;} }
.ai-note { margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--ink-soft); }

/* ===== result ===== */
.result { display: flex; flex-direction: column; gap: 14px; }
.result__card {
  position: relative;
  background: linear-gradient(180deg, #16161b, #101015);
  border: 1px solid var(--card-line);
  border-top: 3px solid var(--crimson);
  border-radius: var(--radius);
  padding: 30px 24px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7);
  text-align: center;
}
.badge {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-soft);
  font-family: "Shippori Mincho B1", serif;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 4px;
  margin-bottom: 18px;
}
.badge:empty { display: none; }
.line {
  font-family: "Shippori Mincho B1", serif;
  font-size: clamp(19px, 5.4vw, 24px);
  font-weight: 800;
  line-height: 1.85;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.result__actions { display: flex; gap: 10px; }
.action {
  flex: 1;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.action:active { transform: translateY(2px); }
.action--copy {
  background: var(--crimson);
  border-color: var(--crimson);
  color: #fff;
}
.action--copy.is-copied { background: #2f8a5a; border-color: #2f8a5a; }
.action--again {
  background: transparent;
  border-color: rgba(236, 232, 226, 0.3);
  color: var(--ink);
}
.action--again:hover { border-color: var(--gold); }

/* animation */
.pop { animation: pop 0.4s cubic-bezier(0.16, 0.9, 0.3, 1.1); }
@keyframes pop {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* footer */
.foot { text-align: center; color: var(--ink-soft); font-size: 12px; }
.foot__sub { margin-top: 8px; font-size: 10.5px; opacity: 0.7; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .wrap { animation: none; }
}
