/* 口コミ返信の下書きAI — 「便箋と朱印」の方向性。
   外部フォントは読み込まない（外部送信を増やさず、表示も速くするため）。
   見出しは端末の明朝体、本文はゴシック体を使う。 */

:root {
  --paper: #f6f1e7;
  --paper-deep: #ece4d3;
  --sheet: #fffdf8;
  --ink: #1f2a44;
  --ink-soft: #4a5470;
  --ink-faint: #7d8296;
  --rule: #d9cfbb;
  --shu: #c0392b;          /* 朱色：注意点・低評価に限って使う */
  --shu-wash: #fbeae6;
  --moss: #3d6b4f;         /* 成功・コピー完了 */
  --gold: #b8892d;         /* 星 */
  --focus: #2f6fde;

  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;

  --text-sm: 0.875rem;
  --text-base: clamp(0.98rem, 0.94rem + 0.2vw, 1.06rem);
  --text-lg: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --text-hero: clamp(2.1rem, 1.3rem + 3.6vw, 3.6rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-section: clamp(2.5rem, 1.5rem + 4vw, 5rem);

  --radius-sheet: 4px;
  --radius-control: 10px;
  --shadow-sheet: 0 1px 0 rgba(31, 42, 68, 0.05), 0 12px 32px -18px rgba(31, 42, 68, 0.35);
  --duration-fast: 150ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161b26;
    --paper-deep: #1d2330;
    --sheet: #20273a;
    --ink: #ece6d8;
    --ink-soft: #c3bfb4;
    --ink-faint: #9a988f;
    --rule: #3a4258;
    --shu: #f07a6b;
    --shu-wash: #3a2422;
    --moss: #7fc79a;
    --gold: #e0b45a;
    --focus: #8ab4ff;
    --shadow-sheet: 0 12px 32px -18px rgba(0, 0, 0, 0.8);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  /* 紙の繊維のような細い横罫 */
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(125, 110, 80, 0.06) 31px 32px);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.8;
  font-feature-settings: "palt";
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}

.skip-link:focus {
  top: var(--space-4);
}

.sp-only {
  display: none;
}

@media (max-width: 480px) {
  .sp-only {
    display: inline;
  }
}

/* ---- ヘッダーと導入 ---- */

.site-header,
main,
.site-footer {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  padding-block: var(--space-6) 0;
}

.brand {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: var(--text-sm);
}

.brand-sub {
  margin-left: var(--space-2);
  color: var(--ink-faint);
  font-weight: 400;
}

.hero {
  padding-block: var(--space-8) var(--space-8);
  max-width: 44rem;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 var(--space-3);
  padding: 0 var(--space-3);
  border: 1.5px solid var(--shu);
  border-radius: 999px;
  color: var(--shu);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.lead {
  margin: 0 0 var(--space-4);
  color: var(--ink-soft);
  font-size: var(--text-lg);
  line-height: 1.9;
}

.lead strong {
  color: var(--ink);
  background: linear-gradient(transparent 62%, rgba(184, 137, 45, 0.28) 62%);
}

.notice {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.notice-ai {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-left: 3px solid var(--ink);
  background: var(--paper-deep);
}

/* ---- 2 枚の便箋 ---- */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 880px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sheet {
  position: relative;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  box-shadow: var(--shadow-sheet);
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
}

/* 返信側の便箋は少し重ねて、手紙が往復する感じを出す */
.sheet-output {
  margin-top: var(--space-12);
}

@media (max-width: 880px) {
  .sheet-output {
    margin-top: 0;
  }
}

.sheet-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.step {
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--sheet);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* ---- フォーム ---- */

.field {
  margin: 0 0 var(--space-6);
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  padding: 0;
}

.optional {
  margin-left: var(--space-2);
  color: var(--ink-faint);
  font-weight: 400;
}

select,
input[type="text"],
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}

textarea {
  resize: vertical;
  min-height: 10rem;
  line-height: 1.8;
}

select:hover,
input[type="text"]:hover,
textarea:hover {
  border-color: var(--ink-faint);
}

select:focus-visible,
input[type="text"]:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 30%, transparent);
}

.hint {
  margin: var(--space-2) 0 0;
  color: var(--ink-faint);
  font-size: var(--text-sm);
  line-height: 1.7;
}

.hint.center {
  text-align: center;
}

.field-foot {
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  align-items: flex-start;
}

.count {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.count.is-over {
  color: var(--shu);
  font-weight: 700;
}

/* 星とトーンは、ラジオボタンを見た目のボタンにする（キーボード操作はネイティブのまま） */
.stars,
.tones {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.stars input,
.tones input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.stars label,
.tones label {
  cursor: pointer;
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  background: var(--paper);
  transition: transform var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}

.stars {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 4rem));
}

.stars label {
  padding: var(--space-2) var(--space-3);
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stars label span {
  color: var(--gold);
  margin-right: 0.15em;
}

.tones label {
  flex: 1 1 8rem;
  padding: var(--space-2) var(--space-3);
  font-weight: 700;
}

.tones label small {
  display: block;
  color: var(--ink-faint);
  font-weight: 400;
  font-size: 0.78rem;
  line-height: 1.5;
}

.stars label:hover,
.tones label:hover {
  border-color: var(--ink-faint);
  transform: translateY(-1px);
}

.stars input:checked + label,
.tones input:checked + label {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--sheet);
}

.stars input:checked + label span {
  color: inherit;
}

.tones input:checked + label small {
  color: color-mix(in srgb, var(--sheet) 75%, transparent);
}

/* 低評価を選んだら朱色で示す */
.stars input[value="1"]:checked + label,
.stars input[value="2"]:checked + label {
  border-color: var(--shu);
  background: var(--shu);
}

.stars input:focus-visible + label,
.tones input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 利用規約・プライバシーポリシーへの同意 */
.consent {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.7;
}

.consent input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  flex: none;
  accent-color: var(--ink);
}

/* Turnstile のウィジェット。表示前後で高さが変わらないよう、ウィジェットの高さ（65px）を先に確保する */
.turnstile-widget {
  min-height: 65px;
}

.field-turnstile .hint {
  margin-top: var(--space-2);
}

.form-errors {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--shu);
  background: var(--shu-wash);
  color: var(--ink);
  font-size: var(--text-sm);
}

.form-errors ul {
  margin: 0;
  padding-left: 1.2em;
}

.submit {
  display: block;
  width: 100%;
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--sheet);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--ink) 55%, black);
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), opacity var(--duration-fast);
}

.submit:hover {
  transform: translateY(-1px);
}

.submit:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 -1px color-mix(in srgb, var(--ink) 55%, black);
}

.submit[disabled] {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

/* ---- 出力 ---- */

.output-empty {
  color: var(--ink-faint);
  font-size: var(--text-sm);
}

.output-empty p {
  margin: 0 0 var(--space-3);
}

.output-status:empty {
  display: none;
}

.output-status {
  margin-bottom: var(--space-4);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.mock-banner {
  margin-bottom: var(--space-4);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--ink-faint);
  border-radius: var(--radius-control);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}

.cautions {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-4) var(--space-2);
  border: 1.5px solid var(--shu);
  border-radius: var(--radius-sheet);
  background: var(--shu-wash);
}

.cautions h3,
.cautions h4 {
  margin: 0 0 var(--space-2);
  color: var(--shu);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

.cautions h4 {
  margin-top: var(--space-3);
}

.cautions ul {
  margin: 0 0 var(--space-2);
  padding-left: 1.2em;
  font-size: var(--text-sm);
  line-height: 1.75;
}

.replies {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: reply;
}

.reply {
  counter-increment: reply;
  position: relative;
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sheet);
  background: var(--sheet);
  animation: reply-in 400ms var(--ease-out) both;
}

.reply:nth-child(2) {
  animation-delay: 80ms;
}

.reply:nth-child(3) {
  animation-delay: 160ms;
}

@keyframes reply-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reply {
    animation: none;
  }
  .stars label,
  .tones label,
  .submit {
    transition: none;
  }
}

.reply-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.reply-label {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
}

.reply-label::before {
  content: "案" counter(reply) "　";
  color: var(--ink-faint);
}

.reply-length {
  color: var(--ink-faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reply-text {
  margin: 0 0 var(--space-3);
  white-space: pre-wrap;
  line-height: 1.9em;
  overflow-wrap: anywhere;
  /* 便箋の罫線（行の高さと同じ間隔で、各行の下に引く） */
  background: repeating-linear-gradient(180deg, transparent 0 calc(1.9em - 1px), var(--rule) calc(1.9em - 1px) 1.9em);
}

.copy-button {
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}

.copy-button:hover {
  background: var(--ink);
  color: var(--sheet);
}

.copy-button.is-copied {
  border-color: var(--moss);
  background: var(--moss);
  color: var(--sheet);
}

/* ---- 説明とフッター ---- */

.guide {
  padding-block: var(--space-section) var(--space-8);
}

.guide h2 {
  margin: 0 0 var(--space-6);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-8);
}

.guide h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-base);
}

.guide ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
}

.guide li {
  margin-bottom: var(--space-2);
}

.site-footer {
  padding-block: var(--space-8) var(--space-12);
  border-top: 1px solid var(--rule);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-4) 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.small {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
}

/* ---- 規約などの文書ページ ---- */

.doc {
  max-width: 46rem;
  padding-block: var(--space-8) var(--space-12);
}

.doc h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
}

.doc h2 {
  margin: var(--space-8) 0 var(--space-3);
  font-family: var(--font-serif);
  font-size: var(--text-lg);
}

.doc h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-base);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  display: block;
  overflow-x: auto;
}

.doc th,
.doc td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  min-width: 8rem;
}

.doc th {
  background: var(--paper-deep);
}
