:root {
  --bg-top: #f6efe3;
  --bg-bottom: #eadcc4;
  --paper: rgba(255, 252, 246, 0.82);
  --paper-strong: #fff9ef;
  --line: rgba(89, 52, 22, 0.12);
  --ink: #2e2318;
  --accent: #9f4b24;
  --accent-soft: #e8c39d;
  --shadow: 0 22px 60px rgba(72, 46, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(114, 77, 38, 0.035) 1px, transparent 1px);
  background-size: 100% 28px;
  opacity: 0.35;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero {
  padding: 32px;
  margin-bottom: 18px;
  animation: rise 0.6s ease-out;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.04;
  font-family: "STKaiti", "KaiTi", serif;
}

.intro {
  width: min(620px, 100%);
  margin: 14px 0 0;
  font-size: 17px;
  line-height: 1.8;
}

.panel {
  padding: 24px;
  margin-bottom: 18px;
  animation: rise 0.7s ease-out;
}

.label {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(46, 35, 24, 0.72);
}

textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid rgba(105, 68, 36, 0.16);
  border-radius: 20px;
  background: var(--paper-strong);
  color: var(--ink);
  padding: 20px 22px;
  font-size: 22px;
  line-height: 1.8;
  font-family: "Kaiti SC", "STKaiti", serif;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

textarea:focus {
  outline: 2px solid rgba(159, 75, 36, 0.22);
  border-color: rgba(159, 75, 36, 0.4);
}

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

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #9f4b24, #bb6a31);
  color: #fff9f0;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 24px rgba(159, 75, 36, 0.22);
}

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

button.ghost {
  background: rgba(255, 249, 239, 0.82);
  color: var(--ink);
  box-shadow: none;
  border: 1px solid rgba(105, 68, 36, 0.14);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.output-panel {
  min-height: 280px;
}

.hint {
  margin: 4px 0 0;
  color: rgba(46, 35, 24, 0.62);
  font-size: 14px;
}

.output {
  margin-top: 18px;
  min-height: 180px;
  border-radius: 22px;
  padding: 24px;
  border: 1px dashed rgba(105, 68, 36, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.9), rgba(248, 240, 228, 0.92));
  font-size: 32px;
  line-height: 2.3;
  white-space: normal;
  cursor: copy;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.output:hover {
  transform: translateY(-1px);
  border-color: rgba(159, 75, 36, 0.34);
  box-shadow: 0 14px 32px rgba(72, 46, 18, 0.08);
}

.output:focus {
  outline: 2px solid rgba(159, 75, 36, 0.24);
  outline-offset: 2px;
}

.output.is-empty {
  cursor: default;
}

.output.is-empty:hover {
  transform: none;
  border-color: rgba(105, 68, 36, 0.2);
  box-shadow: none;
}

.placeholder {
  margin: 0;
  font-size: 18px;
  color: rgba(46, 35, 24, 0.48);
}

.placeholder.error {
  color: #8d2f24;
}

.ruby {
  margin: 0 0.12em;
  ruby-position: over;
}

rt {
  font-size: 0.42em;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-family: "Times New Roman", "Songti SC", serif;
}

.plain,
.space {
  display: inline-block;
}

.plain {
  margin: 0 0.12em;
}

.line-break {
  display: block;
  height: 0.7em;
}

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1080px);
    padding: 24px 0 40px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  textarea {
    min-height: 160px;
    font-size: 19px;
  }

  .output {
    padding: 18px;
    font-size: 24px;
    line-height: 2.1;
  }
}
