:root {
  --bg: #f4ede2;
  --bg-deep: #eadcc3;
  --paper: rgba(255, 251, 244, 0.78);
  --paper-strong: rgba(255, 250, 242, 0.92);
  --ink: #171411;
  --ink-soft: #645a4d;
  --accent: #c24a2b;
  --accent-deep: #8e2f1b;
  --accent-soft: rgba(194, 74, 43, 0.12);
  --line: rgba(23, 20, 17, 0.12);
  --line-strong: rgba(23, 20, 17, 0.22);
  --shadow: 0 28px 90px rgba(70, 42, 23, 0.18);
  --shadow-tight: 0 16px 40px rgba(70, 42, 23, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "BIZ UDPMincho", serif;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(194, 74, 43, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(194, 74, 43, 0.2), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: 0;
  pointer-events: none;
}

body::before {
  top: -120px;
  right: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(194, 74, 43, 0.16), rgba(194, 74, 43, 0));
}

body::after {
  left: -120px;
  bottom: -140px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 20, 17, 0.08), rgba(23, 20, 17, 0));
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.hero {
  margin-bottom: 22px;
}

.hero-copy,
.panel,
.tip-card {
  border: 1px solid var(--line);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  padding: 34px 34px 30px;
  background:
    linear-gradient(135deg, rgba(255, 252, 247, 0.96), rgba(248, 238, 223, 0.9)),
    var(--paper-strong);
}

.hero-copy::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 180px;
  height: 10px;
  background: linear-gradient(90deg, var(--accent), rgba(194, 74, 43, 0));
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -42px;
  width: 220px;
  height: 220px;
  border-radius: 28px;
  transform: rotate(22deg);
  background:
    repeating-linear-gradient(90deg,
      rgba(23, 20, 17, 0.03) 0,
      rgba(23, 20, 17, 0.03) 2px,
      transparent 2px,
      transparent 16px),
    linear-gradient(180deg, rgba(194, 74, 43, 0.15), rgba(194, 74, 43, 0.02));
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid rgba(194, 74, 43, 0.22);
  border-radius: 999px;
  background: rgba(194, 74, 43, 0.08);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--accent-deep);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5.4vw, 5.3rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.lede {
  margin: 18px 0 0;
  color: var(--ink-soft);
  line-height: 1.85;
  font-size: 1.02rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.mode-controls,
.spacing-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.mode-controls legend,
.spacing-controls legend {
  width: 100%;
  margin-bottom: 4px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.mode-controls label,
.spacing-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(23, 20, 17, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
}

.mode-controls input,
.spacing-controls input {
  accent-color: var(--accent);
}

.hero-chip {
  min-width: 180px;
  padding: 14px 16px;
  border: 1px solid rgba(23, 20, 17, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-tight);
}

.hero-chip span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero-chip strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

.panel,
.tip-card {
  background: var(--paper);
  backdrop-filter: blur(16px);
}

.panel {
  min-height: 480px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), rgba(194, 74, 43, 0));
}

.panel-input {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0)),
    var(--paper);
}

.panel-output {
  background:
    linear-gradient(180deg, rgba(23, 20, 17, 0.03), rgba(23, 20, 17, 0)),
    var(--paper);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h2,
.tip-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header p,
.tip-card p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.75;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  color: #fff7f0;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 24px rgba(142, 47, 27, 0.22);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(142, 47, 27, 0.26);
}

button:active {
  transform: translateY(0);
}

button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(23, 20, 17, 0.08);
  box-shadow: none;
}

textarea,
pre {
  width: 100%;
  min-height: 392px;
  margin: 0;
  border-radius: 24px;
  padding: 20px 22px;
  line-height: 1.75;
  font-size: 1.05rem;
}

textarea {
  resize: vertical;
  color: var(--ink);
  border: 1px solid rgba(23, 20, 17, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.66)),
    #fffdf8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

textarea::placeholder {
  color: rgba(100, 90, 77, 0.7);
}

.flow-controls {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(23, 20, 17, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
}

.flow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  margin-top: 10px;
}

.flow-toggle:first-child {
  margin-top: 0;
}

.flow-range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--ink-soft);
}

.flow-range-head strong {
  color: var(--ink);
  font-size: 0.98rem;
}

#wrapLengthSlider {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--accent);
}

#wrapLengthSlider:disabled {
  opacity: 0.45;
}

.flow-note {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  font-size: 0.92rem;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(194, 74, 43, 0.35);
  outline-offset: 2px;
}

pre {
  overflow: auto;
  border: 1px solid rgba(23, 20, 17, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    linear-gradient(160deg, #1a1714, #2d1d18);
  color: #fff7ef;
  white-space: pre;
  font-family: "Hiragino Sans", "Yu Gothic", "BIZ UDPGothic", sans-serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.copy-button {
  width: 100%;
  margin-top: 14px;
  padding: 15px 18px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.spacing-controls {
  margin: 0 0 14px;
}

.output-stats {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(23, 20, 17, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.output-stats-label,
.output-stats-note {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.output-stats strong {
  font-size: 1.15rem;
  line-height: 1;
}

.share-button {
  width: 100%;
  margin: 0 0 14px;
  white-space: nowrap;
}

.tips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.tip-card {
  padding: 22px 24px;
  box-shadow: var(--shadow-tight);
}

.tip-card h2 {
  position: relative;
  padding-left: 16px;
}

.tip-card h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 7px;
  height: 1.1em;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}

.feature-card {
  grid-column: 1 / -1;
}

.feature-list {
  margin: 10px 0 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  line-height: 1.8;
}

.feature-list li + li {
  margin-top: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-copy,
.panel,
.tip-card {
  animation: rise-in 560ms cubic-bezier(0.21, 1, 0.31, 1) both;
}

.panel-input {
  animation-delay: 100ms;
}

.panel-output {
  animation-delay: 140ms;
}

.tip-card:nth-child(1) {
  animation-delay: 180ms;
}

.tip-card:nth-child(2) {
  animation-delay: 220ms;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero h1 {
    max-width: none;
  }

  .hero-meta {
    display: none;
  }
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1160px);
    padding-top: 20px;
  }

  .workspace,
  .tips {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  textarea,
  pre {
    min-height: 320px;
  }
}

@media (max-width: 560px) {

  .hero-copy,
  .panel,
  .tip-card {
    border-radius: 24px;
  }

  .hero-copy,
  .panel {
    padding: 18px;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 12vw, 3.4rem);
  }

  .hero-chip {
    width: 100%;
  }

  .actions,
  .mode-controls,
  .spacing-controls {
    gap: 8px;
  }

  .mode-controls label,
  .spacing-controls label {
    width: 100%;
    justify-content: center;
  }
}
