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

:root {
  --ink: #1a2848;
  --paper: #f4efe4;
  --paper-deep: #ebe2d4;
  --persimmon: #c45c3e;
  --brass: #b8923a;
  --moss: #4a6b5a;
  --mint: #5eead4;
  --shadow: rgba(26, 40, 72, 0.14);
  --font-ui: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --font-body: "Hiragino Mincho ProN", "Yu Mincho", "Hiragino Sans", serif;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

.desk-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(255, 255, 255, 0.55), transparent 55%),
    linear-gradient(180deg, #e8dcc8 0%, var(--paper) 35%, #efe6d8 100%);
  pointer-events: none;
}

.desk-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 48px,
    rgba(26, 40, 72, 0.03) 48px,
    rgba(26, 40, 72, 0.03) 49px
  );
}

.visually-hidden,
.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;
}

.masthead {
  padding: 12px 16px 0;
  max-width: 960px;
  margin: 0 auto;
}

.back {
  color: var(--moss);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
}

.back:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-radius: 4px;
}

.editorial-app {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--brass);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4.5vw, 2rem);
  line-height: 1.15;
  font-weight: 900;
}

.hero h1 span {
  display: block;
  color: var(--persimmon);
}

.catch {
  margin: 8px 0 0;
  font-size: 0.98rem;
  max-width: 28em;
}

.burapi-wrap {
  position: relative;
  margin: 0;
  flex-shrink: 0;
}

.burapi-char {
  display: block;
  width: 72px;
  height: auto;
  filter: drop-shadow(0 4px 8px var(--shadow));
}

.armband {
  position: absolute;
  right: -4px;
  bottom: 8px;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--paper);
  background: var(--persimmon);
  border-radius: 4px;
  transform: rotate(-8deg);
}

.proof-stage {
  display: grid;
  gap: 18px;
}

@media (min-width: 820px) {
  .proof-stage {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

.proof-paper {
  position: relative;
  padding: 20px 16px 20px 52px;
  background: linear-gradient(165deg, #fffdf8 0%, var(--paper) 100%);
  border: 2px solid rgba(184, 146, 58, 0.45);
  border-radius: 4px 4px 12px 12px;
  box-shadow:
    0 12px 28px var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  min-height: 220px;
}

.brass-ruler {
  position: absolute;
  left: 8px;
  top: 20px;
  bottom: 20px;
  width: 36px;
  border-right: 3px solid var(--brass);
  background: linear-gradient(90deg, rgba(184, 146, 58, 0.12), transparent);
}

.ruler-row {
  position: absolute;
  left: 0;
  right: 4px;
  display: flex;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--brass);
  line-height: 1;
  transform: translateY(-50%);
}

.ruler-compact {
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.proof-body-wrap {
  position: relative;
}

.proof-body {
  font-family: var(--font-body);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  transition: width 0.35s ease;
}

.type-mark {
  position: absolute;
  right: 4px;
  bottom: -8px;
  margin: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--paper);
  background: var(--ink);
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.proof-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  border: 3px solid var(--persimmon);
  color: var(--persimmon);
  border-radius: 999px;
  transform: rotate(-12deg);
  background: rgba(255, 255, 255, 0.55);
}

.proof-stamp[data-state="good"] {
  border-color: var(--persimmon);
  color: var(--persimmon);
}

.proof-stamp[data-state="loose"] {
  border-color: var(--moss);
  color: var(--moss);
}

.proof-stamp[data-state="tight"] {
  border-color: #8b3a32;
  color: #8b3a32;
}

.proof-stamp.stamp-hit {
  animation: stamp-pop 0.55s ease;
}

@keyframes stamp-pop {
  0% {
    transform: rotate(-12deg) scale(1);
  }
  40% {
    transform: rotate(-8deg) scale(1.12);
  }
  100% {
    transform: rotate(-12deg) scale(1);
  }
}

.wave-meter {
  position: relative;
  padding: 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  overflow: hidden;
  --wave: 0.5;
}

.spine-stack {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  gap: 3px;
  opacity: 0.35;
}

.spine-stack span {
  display: block;
  width: 8px;
  height: 24px;
  background: linear-gradient(180deg, var(--persimmon), #6b3040);
  border-radius: 1px;
}

.spine-stack span:nth-child(2) {
  height: 32px;
}
.spine-stack span:nth-child(3) {
  height: 40px;
}
.spine-stack span:nth-child(4) {
  height: 48px;
}

.wave-svg {
  width: 100%;
  height: 48px;
  opacity: calc(0.35 + var(--wave) * 0.65);
}

.wave-path {
  fill: none;
  stroke: var(--mint);
  stroke-width: 3;
  stroke-linecap: round;
}

.meter-label {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.meter-score {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.meter-score small {
  font-size: 0.72rem;
  margin-left: 6px;
  opacity: 0.75;
}

.metrics-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 12px 0 0;
  padding: 12px;
  background: var(--paper-deep);
  border-radius: 10px;
  font-size: 0.82rem;
}

.metrics-dl div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metrics-dl dt {
  font-weight: 700;
  color: var(--moss);
  font-size: 0.72rem;
}

.metrics-dl dd {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
}

.text-panel {
  display: block;
  margin-top: 18px;
}

.panel-label {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
}

textarea {
  width: 100%;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  border: 2px solid rgba(26, 40, 72, 0.15);
  border-radius: 8px;
  background: #fffdf8;
  resize: vertical;
  min-height: 120px;
}

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

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: rgba(26, 40, 72, 0.72);
}

.controls-panel {
  margin-top: 20px;
  padding: 16px;
  background: linear-gradient(180deg, #fffdf8, var(--paper-deep));
  border: 2px solid rgba(26, 40, 72, 0.12);
  border-radius: 14px;
}

.controls-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.dial-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-btn {
  flex: 1;
  min-width: 88px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
}

.preset-btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

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

.sliders {
  display: grid;
  gap: 14px;
}

.dial {
  display: block;
}

.dial-cap {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.dial-width input {
  accent-color: var(--ink);
}
.dial-size input {
  accent-color: var(--persimmon);
  height: 8px;
}
.dial-line input {
  accent-color: var(--moss);
}
.dial-para input {
  accent-color: var(--brass);
}

input[type="range"] {
  width: 100%;
  min-height: 28px;
}

.ruler-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-weight: 700;
  font-size: 0.88rem;
}

.diag-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .diag-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.diag-card {
  padding: 14px;
  background: #fffdf8;
  border-left: 4px solid var(--brass);
  border-radius: 0 10px 10px 0;
  box-shadow: 0 4px 12px var(--shadow);
}

.diag-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.diag-card .good {
  margin: 0 0 8px;
  font-size: 0.86rem;
}

.diag-card .next {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(26, 40, 72, 0.85);
}

.css-panel {
  margin-top: 20px;
}

.css-panel h3 {
  margin: 0 0 8px;
}

.css-block {
  margin: 0;
  padding: 14px;
  background: var(--ink);
  color: #e8f0ff;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre-wrap;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn-primary,
.btn-ghost {
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--persimmon);
  color: #fff;
  border-color: #9a4228;
  box-shadow: 0 4px 0 #7a3420;
}

.btn-primary.copied {
  animation: paper-flip 0.55s ease;
}

@keyframes paper-flip {
  50% {
    transform: translateY(-4px) rotate(-1deg);
  }
}

.btn-ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn-text {
  background: none;
  border: none;
  color: var(--moss);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px 4px;
}

.utility-row {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}

.live-msg {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--moss);
}

.disclaimer {
  margin-top: 24px;
  font-size: 0.78rem;
  color: rgba(26, 40, 72, 0.78);
  line-height: 1.6;
}

.measure-root {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  font-family: var(--font-body);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.capture-hud {
  position: sticky;
  top: 8px;
  z-index: 20;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  font-weight: 800;
  text-align: center;
}

html[data-capture="1"] .capture-hide {
  display: none !important;
}

html[data-capture="1"] .capture-only {
  display: block !important;
}

html[data-promoShot="1"] .promo-hide {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .proof-body {
    transition: none;
  }
}

@media (max-width: 420px) {
  .proof-paper {
    padding-left: 44px;
  }

  .metrics-dl {
    grid-template-columns: 1fr;
  }
}

html[data-promoShot="1"] .editorial-app {
  max-width: 390px;
  padding-bottom: 16px;
}

html[data-promoShot="1"] .text-panel,
html[data-promoShot="1"] .utility-row,
html[data-promoShot="1"] .disclaimer,
html[data-promoShot="1"] .hero .catch {
  display: none !important;
}

html[data-promoShot="1"] .hero {
  position: relative;
  padding-right: 84px;
}

html[data-promoShot="1"] .burapi-wrap {
  display: block !important;
  position: absolute;
  right: 8px;
  top: 64px;
  z-index: 5;
}

html[data-promoShot="1"] .diag-grid {
  grid-template-columns: 1fr;
}
