:root {
  color-scheme: light;
  --ink: #22201d;
  --muted: #716c65;
  --line: #ddd7cf;
  --paper: #f7f5f1;
  --card: #fffefa;
  --accent: #c85836;
  --accent-dark: #963b22;
  --soft-accent: #f8e8e1;
  --green: #376b52;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 0; color: var(--ink); background: var(--paper); }
button, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100% - 32px, 760px); margin: 0 auto; padding: 20px 0 52px; }
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 48px; }
.back-link { color: var(--ink); font-size: .85rem; font-weight: 700; text-decoration: none; letter-spacing: .03em; }
.tool-label, .eyebrow { color: var(--accent); font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.hero { margin-bottom: 28px; }
.hero h1 { margin: 8px 0 10px; font-size: clamp(2.4rem, 11vw, 4.8rem); letter-spacing: -.06em; line-height: .98; }
.lead { max-width: 34rem; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.8; }
.input-card, .status-card, .result-section, .error-card { border: 1px solid var(--line); background: var(--card); border-radius: 18px; }
.input-card { padding: 18px; box-shadow: 0 12px 28px rgba(60, 47, 34, .06); }
.field-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.field-heading label, h2, h3 { font-weight: 800; }
.field-heading label { font-size: .95rem; }
.char-count, .section-note, .result-meta { color: var(--muted); font-size: .78rem; }
textarea { display: block; width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--ink); background: #fff; font-size: 1rem; line-height: 1.75; outline: none; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft-accent); }
.field-help { margin: 9px 0 14px; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.error-message, .error-card p { color: #a33f2c; font-size: .86rem; line-height: 1.6; }
.primary-button, .secondary-button { border: 0; border-radius: 999px; font-weight: 800; transition: transform .15s ease, background .15s ease; }
.primary-button { width: 100%; padding: 14px 20px; color: #fff; background: var(--accent); font-size: 1.08rem; }
.primary-button:hover, .primary-button:focus-visible { background: var(--accent-dark); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }
.status-card { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 14px 16px; }
.status-dot { width: 9px; height: 9px; flex: 0 0 9px; margin-top: 6px; border-radius: 50%; background: var(--green); }
.status-card.is-busy .status-dot { background: var(--accent); box-shadow: 0 0 0 5px var(--soft-accent); }
.status-card.is-error .status-dot { background: #a33f2c; }
.status-label, .status-detail { margin: 0; }
.status-label { font-size: .88rem; font-weight: 800; }
.status-detail { margin-top: 3px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
h2 { margin: 4px 0 0; font-size: 1.4rem; letter-spacing: -.03em; }
.style-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-option, .reason-options button { border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; }
.style-option { min-height: 42px; padding: 8px 6px; font-size: .87rem; font-weight: 700; }
.style-option.is-selected, .style-option:focus-visible { border-color: var(--accent); color: var(--accent-dark); background: var(--soft-accent); }
.style-option:disabled { cursor: wait; opacity: .65; }
.result-section { margin-top: 24px; padding: 20px; scroll-margin-top: 12px; outline: none; }
.result-section:focus-visible { box-shadow: 0 0 0 3px var(--soft-accent); }
.result-heading { margin-bottom: 14px; }
.result-style-switcher { display: grid; gap: 8px; margin: 0 0 18px; padding: 12px 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-style-label { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 800; }
.secondary-button { padding: 9px 14px; color: var(--accent-dark); background: var(--soft-accent); }
.secondary-button:hover, .secondary-button:focus-visible { background: #f2d3c6; }
.result-items { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: result; transition: opacity .15s ease; }
.result-section.is-updating .result-items { opacity: .5; }
.result-items li { display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; min-width: 0; padding: 14px; border-radius: 12px; background: var(--paper); line-height: 1.7; overflow-wrap: anywhere; }
.result-items li::before { counter-increment: result; content: counter(result); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; background: var(--accent); font-size: .8rem; font-weight: 800; }
.notes-section { margin-top: 18px; padding: 14px 16px; border-left: 3px solid var(--accent); background: #fff9f5; }
.notes-section h3 { margin: 0 0 8px; font-size: .92rem; }
.notes-section ul { margin: 0; padding-left: 1.2em; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.detail-control { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.detail-control-title, .detail-control-note { margin: 0; }
.detail-control-title { font-size: .88rem; font-weight: 800; }
.detail-control-note { margin-top: 3px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.detail-toggle { flex: 0 0 auto; }
.detail-section { margin-top: 14px; padding: 16px; border-radius: 12px; background: var(--paper); }
.detail-section h3 { margin: 0 0 10px; font-size: .95rem; }
.detail-text { color: #4e4943; font-size: .88rem; line-height: 1.85; white-space: pre-line; overflow-wrap: anywhere; }
.result-meta { margin: 14px 0 0; }
.feedback-card { display: grid; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.feedback-title { margin: 0; font-size: .88rem; font-weight: 800; }
.feedback-status { min-height: 1.2em; margin: 4px 0 0; color: var(--green); font-size: .75rem; }
.feedback-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; }
.feedback-button.is-selected { border-color: var(--accent); color: var(--accent-dark); background: var(--soft-accent); }
.bad-reasons { padding-top: 4px; }
.bad-reasons p { margin: 0 0 8px; color: var(--muted); font-size: .75rem; }
.reason-options { display: flex; flex-wrap: wrap; gap: 6px; }
.reason-options button { padding: 7px 9px; font-size: .75rem; }
.error-card { margin-top: 24px; padding: 20px; }
.error-card h2 { margin-top: 0; font-size: 1.15rem; }
.disclaimer { margin: 28px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.6; text-align: center; }
[hidden] { display: none !important; }
@media (max-width: 520px) {
  .app-shell { width: min(100% - 24px, 760px); padding-top: 14px; }
  .app-header { margin-bottom: 36px; }
  .input-card, .result-section { padding: 15px; }
  .style-options { grid-template-columns: repeat(2, 1fr); }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .result-heading { flex-direction: row; align-items: end; }
  .section-note { font-size: .72rem; }
  .detail-control { align-items: flex-start; }
}
