@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Playfair+Display:ital,wght@0,500;1,500&display=swap");

:root {
  --ink: #1d2924;
  --muted: #64716b;
  --paper: #eef2e8;
  --paper-light: #f8faf4;
  --line: rgba(29, 41, 36, 0.14);
  --green: #235b45;
  --green-bright: #2f785b;
  --orange: #e37743;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.85), transparent 26%),
    radial-gradient(circle at 88% 52%, rgba(217,229,211,.85), transparent 34%),
    var(--paper);
  font-family: var(--sans);
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.grain {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.page-shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 43px; height: 43px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; }
.brand-mark svg { width: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.5; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--serif); font-size: 19px; font-weight: 500; letter-spacing: .08em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.site-header > p { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.site-header > p i { width: 6px; height: 6px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 5px rgba(47,120,91,.1); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  gap: clamp(50px, 7vw, 105px);
  align-items: center;
  min-height: 730px;
  padding-block: 76px;
}

.eyebrow { margin: 0 0 22px; color: var(--green); font-size: 9px; font-weight: 600; letter-spacing: .22em; }
.hero h1 { max-width: 650px; margin: 0; font-family: var(--serif); font-size: clamp(54px, 6vw, 82px); font-weight: 500; line-height: 1.08; letter-spacing: -.045em; }
.hero h1 em { color: var(--orange); font-weight: 500; }
.hero-intro { max-width: 610px; margin: 25px 0 0; color: var(--muted); font-size: 15px; line-height: 1.9; }

.pronunciation-form { margin-top: 42px; }
.pronunciation-form > label { display: block; margin-bottom: 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.word-field { display: flex; min-width: 0; height: 60px; align-items: center; border: 1px solid rgba(29,41,36,.25); border-radius: 3px; background: rgba(255,255,255,.38); transition: border-color .18s, box-shadow .18s, background .18s; }
.word-field:focus-within { border-color: var(--green); background: rgba(255,255,255,.68); box-shadow: 0 0 0 4px rgba(35,91,69,.08); }
.word-field > span { padding-left: 19px; color: var(--green); font-family: var(--serif); font-size: 18px; }
.word-field input { width: 100%; min-width: 0; height: 100%; padding: 0 12px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 17px; }
.word-field input::placeholder { color: rgba(29,41,36,.35); }
.word-field button { width: 42px; height: 42px; margin-right: 7px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 20px; }
.listen-button { display: flex; min-width: 148px; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 3px; color: #fff; background: var(--green); box-shadow: 0 12px 24px rgba(35,91,69,.16); cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: .04em; transition: transform .18s, background .18s, box-shadow .18s; }
.listen-button:hover:not(:disabled) { background: var(--green-bright); box-shadow: 0 15px 29px rgba(35,91,69,.22); transform: translateY(-2px); }
.listen-button:disabled { cursor: wait; opacity: .65; }
.listen-button svg, .player-actions svg, .history-item svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }

.form-options { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-top: 15px; }
.accent-picker { display: flex; gap: 8px; margin: 0; padding: 0; border: 0; }
.accent-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.accent-option { display: grid; grid-template-columns: auto 1fr; min-width: 143px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; transition: border-color .18s, background .18s, color .18s; }
.accent-option > span { grid-row: 1 / 3; align-self: center; margin-right: 10px; color: var(--green); font-family: var(--serif); font-size: 16px; }
.accent-option b { color: inherit; font-size: 10px; font-weight: 600; }
.accent-option small { margin-top: 1px; font-size: 8px; opacity: .68; }
.accent-option.is-active { border-color: rgba(35,91,69,.46); color: var(--ink); background: rgba(255,255,255,.46); box-shadow: inset 3px 0 var(--green); }
.form-options > p { max-width: 215px; margin: 0; color: rgba(29,41,36,.46); font-size: 9px; line-height: 1.65; text-align: right; }
.form-error { margin: 12px 0 0; color: #a13f31; font-size: 11px; }

.examples { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 24px; }
.examples > span { margin-right: 4px; color: rgba(29,41,36,.44); font-size: 9px; letter-spacing: .08em; }
.examples button { padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: transparent; cursor: pointer; font-family: var(--serif); font-size: 11px; font-style: italic; transition: color .18s, border-color .18s, background .18s; }
.examples button:hover { border-color: var(--green); color: var(--green); background: rgba(255,255,255,.45); }

.sound-card { position: relative; min-height: 570px; padding: 27px 31px 29px; overflow: hidden; border: 1px solid rgba(29,41,36,.15); border-radius: 4px 48px 4px 48px; background: rgba(248,250,244,.74); box-shadow: 0 32px 70px rgba(40,64,52,.13); backdrop-filter: blur(12px); }
.sound-card::before { content: ""; position: absolute; inset: 12px; pointer-events: none; border: 1px solid rgba(29,41,36,.07); border-radius: 2px 38px 2px 38px; }
.sound-card-top { position: relative; z-index: 2; display: flex; justify-content: space-between; padding-bottom: 17px; border-bottom: 1px solid var(--line); color: var(--green); font-size: 8px; font-weight: 600; letter-spacing: .16em; }
.sound-card-top span:last-child { color: var(--orange); }

.record-stage { position: relative; height: 250px; margin-top: 16px; }
.record { position: absolute; top: 13px; left: 50%; width: 220px; height: 220px; border-radius: 50%; background: repeating-radial-gradient(circle, #193e31 0 2px, #1d4738 3px 4px, #16382d 5px 7px); box-shadow: 0 18px 36px rgba(18,47,37,.28), inset 0 0 0 1px rgba(255,255,255,.13); transform: translateX(-57%); }
.record::after { content: ""; position: absolute; inset: 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.record-ring { position: absolute; inset: 35px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 29px rgba(255,255,255,.018), 0 0 0 58px rgba(255,255,255,.018); }
.record-label { position: absolute; inset: 76px; display: grid; place-content: center; border-radius: 50%; color: #f7e9d1; background: var(--orange); text-align: center; }
.record-label i { position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; border: 2px solid #f7e9d1; border-radius: 50%; transform: translate(-50%,-50%); }
.record-label b { margin-top: -22px; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.record-label small { margin-top: 28px; font-size: 5px; letter-spacing: .2em; }
.tonearm { position: absolute; z-index: 2; top: 16px; right: 23px; width: 78px; height: 195px; transform: rotate(-10deg); transform-origin: 62px 19px; transition: transform .55s ease; }
.tonearm i { position: absolute; top: 0; right: 0; width: 39px; height: 39px; border: 9px solid #bdc3b7; border-radius: 50%; background: #4b5750; box-shadow: 0 5px 12px rgba(0,0,0,.18); }
.tonearm::before { content: ""; position: absolute; top: 25px; right: 25px; width: 7px; height: 145px; border-radius: 99px; background: linear-gradient(90deg,#8c938b,#e8e9e1 45%,#90978e); transform: rotate(13deg); transform-origin: top; }
.tonearm span { position: absolute; right: -3px; bottom: 4px; width: 29px; height: 45px; border-radius: 3px 3px 9px 9px; background: #34483f; transform: rotate(13deg); }
.sound-card.is-playing .record { animation: recordSpin 3s linear infinite; }
.sound-card.is-playing .tonearm { transform: rotate(7deg); }

.result-copy { position: relative; z-index: 2; text-align: center; }
.result-copy > p:first-child { margin: 0; color: var(--orange); font-size: 8px; font-weight: 600; letter-spacing: .18em; }
.result-copy h2 { max-width: 100%; margin: 7px 0 3px; overflow: hidden; color: var(--ink); font-family: var(--serif); font-size: clamp(31px, 3.3vw, 45px); font-weight: 500; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.result-copy > p:last-child { margin: 0; color: var(--muted); font-size: 10px; }

.waveform { position: relative; z-index: 2; display: flex; height: 48px; align-items: center; justify-content: center; gap: 3px; margin: 14px 0; }
.waveform i { width: 2px; height: calc(5px + (var(--n, 3) * 3px)); border-radius: 99px; background: rgba(35,91,69,.28); transform: scaleY(.32); transition: background .2s; }
.waveform i:nth-child(3n+1) { --n: 5; }.waveform i:nth-child(4n+2) { --n: 9; }.waveform i:nth-child(5n+3) { --n: 12; }.waveform i:nth-child(7n) { --n: 7; }
.sound-card.is-playing .waveform i { background: var(--green-bright); animation: wavePulse .75s ease-in-out infinite alternate; animation-delay: calc(var(--i, 1) * -50ms); }
.waveform i:nth-child(2n) { animation-delay: -.18s !important; }.waveform i:nth-child(3n) { animation-delay: -.36s !important; }.waveform i:nth-child(5n) { animation-delay: -.52s !important; }

.player-actions { position: relative; z-index: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.player-actions button, .player-actions a { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 3px; color: var(--green); background: rgba(255,255,255,.34); cursor: pointer; font-size: 9px; font-weight: 600; text-decoration: none; }
.player-actions button:disabled { cursor: not-allowed; opacity: .35; }
.player-actions a { color: var(--orange); }

.history-section { padding: 88px 0 108px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.section-heading .eyebrow { margin-bottom: 8px; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: 38px; font-weight: 500; }
.clear-history { padding: 7px 0; border: 0; border-bottom: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.empty-history { display: grid; min-height: 180px; place-content: center; border: 1px dashed var(--line); border-radius: 3px 28px 3px 28px; color: var(--muted); text-align: center; }
.empty-history > span { color: var(--orange); font-family: var(--serif); font-size: 24px; }
.empty-history p { margin: 12px 0 4px; font-family: var(--serif); font-size: 18px; }
.empty-history small { font-size: 9px; opacity: .65; }
.history-list { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.history-item { position: relative; display: grid; min-height: 140px; align-content: space-between; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px 22px 3px 22px; color: var(--ink); background: rgba(255,255,255,.28); cursor: pointer; text-align: left; transition: transform .18s, border-color .18s, background .18s; }
.history-item:hover { border-color: rgba(35,91,69,.42); background: rgba(255,255,255,.55); transform: translateY(-3px); }
.history-accent { color: var(--orange); font-size: 8px; font-weight: 600; letter-spacing: .16em; }
.history-word { overflow: hidden; font-family: var(--serif); font-size: 25px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--muted); font-size: 8px; }
.history-item svg { position: absolute; right: 18px; bottom: 17px; color: var(--green); }

.site-footer { display: flex; min-height: 115px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.site-footer p:first-child { display: flex; align-items: center; gap: 12px; }
.site-footer strong { color: var(--ink); font-family: var(--serif); font-size: 17px; font-weight: 500; }

.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; padding: 12px 16px; border-radius: 3px; color: #fff; background: var(--ink); box-shadow: 0 12px 30px rgba(0,0,0,.2); font-size: 10px; }

@keyframes recordSpin { to { transform: translateX(-57%) rotate(360deg); } }
@keyframes wavePulse { from { transform: scaleY(.35); } to { transform: scaleY(1); } }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-block: 62px 78px; }
  .hero-copy { text-align: center; }
  .hero h1, .hero-intro { margin-inline: auto; }
  .pronunciation-form { text-align: left; }
  .examples { justify-content: center; }
  .sound-card { width: min(520px,100%); margin-inline: auto; }
  .history-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 580px) {
  .page-shell { width: min(100% - 28px, 1180px); }
  .site-header { min-height: 76px; }
  .site-header > p { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .hero { gap: 50px; padding-top: 48px; }
  .hero h1 { font-size: clamp(46px,14vw,66px); }
  .hero-intro { font-size: 13px; }
  .input-row { grid-template-columns: 1fr; }
  .listen-button { min-height: 54px; }
  .form-options { display: block; }
  .accent-picker { width: 100%; }
  .accent-option { min-width: 0; flex: 1; }
  .form-options > p { max-width: none; margin-top: 10px; text-align: left; }
  .sound-card { min-height: 544px; padding: 24px 20px; border-radius: 4px 34px 4px 34px; }
  .record { width: 200px; height: 200px; }
  .record-label { inset: 68px; }
  .record-stage { height: 228px; }
  .tonearm { right: 7px; transform: scale(.9) rotate(-10deg); transform-origin: top right; }
  .sound-card.is-playing .tonearm { transform: scale(.9) rotate(7deg); }
  .result-copy h2 { font-size: 34px; }
  .history-section { padding: 70px 0 84px; }
  .history-list { grid-template-columns: 1fr; }
  .history-item { min-height: 115px; }
  .site-footer { display: grid; gap: 8px; padding-block: 27px; text-align: center; }
  .site-footer p { margin: 0; justify-content: center; }
}

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