:root {
  --bg-deep: #183246;
  --bg-warm: #efe3cf;
  --bg-soft: #f8f0e5;
  --panel: rgba(255, 249, 240, 0.84);
  --panel-strong: rgba(255, 252, 245, 0.94);
  --panel-dark: linear-gradient(145deg, rgba(24, 50, 70, 0.96), rgba(29, 104, 92, 0.94));
  --ink: #142636;
  --ink-soft: rgba(20, 38, 54, 0.72);
  --ink-faint: rgba(20, 38, 54, 0.48);
  --line: rgba(20, 38, 54, 0.11);
  --accent: #d9653b;
  --accent-strong: #b94b26;
  --accent-soft: rgba(217, 101, 59, 0.13);
  --teal: #1f7a73;
  --gold: #efc675;
  --gold-soft: rgba(239, 198, 117, 0.24);
  --shadow: 0 24px 70px rgba(24, 50, 70, 0.14);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --pron-speaker-size: 13px;
  --pron-speaker-image-scale: 1.2;
  --font-display: "Avenir Next", "Trebuchet MS", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-body: "Source Sans 3", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(239, 198, 117, 0.34), transparent 30%),
    radial-gradient(circle at 82% 12%, rgba(31, 122, 115, 0.18), transparent 22%),
    linear-gradient(135deg, var(--bg-warm) 0%, var(--bg-soft) 48%, #f2e6d7 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.glow {
  position: absolute;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.42;
  pointer-events: none;
}

.glow-left {
  background: rgba(217, 100, 58, 0.22);
  top: -8rem;
  left: -10rem;
}

.glow-right {
  background: rgba(31, 122, 115, 0.2);
  right: -8rem;
  bottom: -8rem;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
}

.card-hero {
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(255, 248, 238, 0.95), rgba(255, 243, 223, 0.82)),
    var(--panel);
  animation: rise-in 0.7s ease both;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 1rem;
  color: var(--teal);
  font-weight: 700;
}

.hero h1,
.result-card h2,
.practice-card h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.05;
}

.hero h1 {
  max-width: 8.5ch;
  font-size: clamp(1.5rem, 2.8vw, 2.5rem);
  letter-spacing: -0.03em;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-top: 28px;
}

.search-box {
  display: grid;
  gap: 10px;
  padding: 16px 18px 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(21, 37, 54, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.search-label {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

.search-box input {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  font-weight: 700;
}

.search-box input::placeholder {
  color: rgba(21, 37, 54, 0.38);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  min-height: 40px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  font-weight: 700;
  font-size: 0.9rem;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(21, 37, 54, 0.12);
}

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

.button-primary {
  background: linear-gradient(135deg, #183246 0%, #22445c 100%);
  color: #fffaf4;
}

.button-secondary {
  background: rgba(21, 37, 54, 0.08);
  color: var(--ink);
}

.button-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #ef8a4a 100%);
  color: white;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.chip {
  border: 1px solid rgba(21, 37, 54, 0.12);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.8);
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  grid-template-rows: auto 1fr;
  gap: 28px;
  align-items: stretch;
}

.hero-title {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-search-wrap {
  grid-column: 1;
  grid-row: 2;
}

.hero-search-wrap .search-form {
  max-width: 470px;
}

.hero-main-right {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  min-width: 0;
  align-self: stretch;
  justify-content: center;
}

.result-card,
.practice-card {
  display: block;
  width: 100%;
  margin: 0;
  justify-self: stretch;
  padding: 24px;
  animation: rise-in 0.7s ease both;
}

.hero-sphere-panel {
  display: block;
  position: relative;
  width: 100%;
  min-height: 100%;
  padding: 24px;
  animation: rise-in 0.7s ease both;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 237, 0.72)),
    var(--panel-strong);
  border: 1px solid rgba(21, 37, 54, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.hero-sphere-panel::before {
  content: "";
  position: absolute;
  inset: auto auto -72px -64px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 101, 59, 0.16), transparent 68%);
  pointer-events: none;
}

.hero-sphere-panel::after {
  content: "";
  position: absolute;
  inset: -84px -64px auto auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 122, 115, 0.14), transparent 70%);
  pointer-events: none;
}

.hero-sphere-copy {
  position: relative;
  z-index: 1;
}

.hero-sphere-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  line-height: 1.08;
}

.hero-sphere-hint {
  margin: 12px 0 0;
  max-width: 20rem;
  color: var(--ink-soft);
  line-height: 1.68;
}

.word-sphere-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 340px;
  margin-top: 18px;
  perspective: 1200px;
}

.word-sphere-shell,
.word-sphere-cloud {
  width: min(100%, 332px);
  height: min(100%, 332px);
  border-radius: 50%;
}

.word-sphere-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(20, 38, 54, 0.1);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.32) 26%, transparent 30%),
    radial-gradient(circle at 70% 72%, rgba(31, 122, 115, 0.14), transparent 44%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.56), rgba(255, 247, 236, 0.16) 58%, rgba(20, 38, 54, 0.08) 100%);
  box-shadow:
    inset 0 -24px 44px rgba(20, 38, 54, 0.06),
    inset 0 14px 24px rgba(255, 255, 255, 0.72),
    0 28px 60px rgba(24, 50, 70, 0.16);
}

.word-sphere-shell::before {
  content: "";
  position: absolute;
  inset: 10% 8%;
  border-radius: 50%;
  border: 1px dashed rgba(20, 38, 54, 0.08);
  transform: rotateX(70deg);
}

.word-sphere-shell::after {
  content: "";
  position: absolute;
  inset: 18% 14%;
  border-radius: 50%;
  border-top: 1px solid rgba(20, 38, 54, 0.08);
  border-bottom: 1px solid rgba(20, 38, 54, 0.08);
  transform: rotate(-18deg);
}

.word-sphere-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100%, 388px);
  height: min(100%, 388px);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(18px);
}

.word-sphere-halo-back {
  z-index: 0;
  background: radial-gradient(circle, rgba(31, 122, 115, 0.14), transparent 68%);
  transform: translate(-50%, -50%) scale(1.08);
}

.word-sphere-halo-front {
  z-index: 3;
  background: radial-gradient(circle, rgba(239, 198, 117, 0.18), transparent 64%);
  transform: translate(-50%, -50%) scale(0.9);
}

.word-sphere-cloud {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  will-change: transform;
}

.sphere-word {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(20, 38, 54, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(24, 50, 70, 0.12);
  cursor: pointer;
  user-select: none;
  opacity: 1;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  backface-visibility: hidden;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.sphere-word:hover,
.sphere-word:focus-visible {
  background: rgba(217, 101, 59, 0.9);
  color: #fffaf4;
  box-shadow: 0 14px 28px rgba(185, 75, 38, 0.24);
  outline: none;
}

.result-card {
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.94), rgba(255, 248, 239, 0.78)),
    var(--panel-strong);
}

.result-head-main {
  min-width: 0;
  flex: 1 1 auto;
}

.result-card .card-head h2 {
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.12;
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
}

.result-status {
  margin-left: auto;
  max-width: 16rem;
  text-align: right;
  flex: 0 1 16rem;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.practice-card .card-head h2 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.status {
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: normal;
  line-height: 1.4;
}

.status-idle {
  background: rgba(21, 37, 54, 0.08);
  color: var(--ink-soft);
}

.status-success {
  background: rgba(31, 122, 115, 0.14);
  color: var(--teal);
}

.status-warn {
  background: rgba(240, 195, 107, 0.2);
  color: #8b6416;
}

.status-error {
  background: rgba(217, 100, 58, 0.16);
  color: var(--accent-strong);
}

.empty-state {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink-soft);
}

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

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

.pron-chip,
.meaning-box,
.feedback-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.pron-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 8px 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.pron-chip:hover {
  border-color: rgba(224, 149, 49, 0.48);
  box-shadow: 0 12px 22px rgba(16, 32, 66, 0.1);
  transform: translateY(-1px);
}

.pron-chip:focus-visible {
  outline: 2px solid rgba(224, 149, 49, 0.62);
  outline-offset: 2px;
}

.pron-chip-icon {
  width: var(--pron-speaker-size);
  height: var(--pron-speaker-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(224, 149, 49, 0.16);
}

.pron-chip-icon-image {
  width: calc(var(--pron-speaker-size) * var(--pron-speaker-image-scale));
  height: calc(var(--pron-speaker-size) * var(--pron-speaker-image-scale));
  display: block;
  object-fit: contain;
  filter: saturate(1.05);
}

.pron-chip-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.pron-chip-accent {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.pron-chip-ipa {
  font-size: 1.08rem;
  font-weight: 700;
  word-break: break-word;
}

.meaning-box {
  margin-top: 16px;
  padding: 18px;
}

.translation-list,
.guidance-list {
  margin: 0;
  padding-left: 18px;
}

.translation-list li,
.guidance-list li {
  margin-top: 10px;
  line-height: 1.6;
}

.meter-wrap {
  margin-top: 18px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-dark);
  color: rgba(255, 255, 255, 0.92);
}

.meter-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold) 0%, #fff0bb 100%);
  transition: width 0.08s linear;
}

.meter-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.record-actions {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: start;
  gap: 8px;
  margin-top: 14px;
}

.record-actions .button {
  width: auto;
  min-width: 76px;
  min-height: 34px;
  padding: 0 12px;
}

.help-text {
  margin: 14px 0 0;
  color: var(--ink-soft);
  line-height: 1.66;
}

.capability-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(217, 101, 59, 0.12);
  color: var(--accent-strong);
  line-height: 1.6;
  font-weight: 700;
}

.feedback-panel {
  margin-top: 18px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 247, 233, 0.84));
  text-align: center;
}

.score-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.score-label {
  color: var(--ink-soft);
  font-weight: 700;
}

.score-gauge {
  --score-progress: 0;
  --score-color: hsl(0 72% 50%);
  width: 156px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--score-color) calc(var(--score-progress) * 1%), rgba(20, 38, 54, 0.12) 0),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.96) 62%, transparent 63%);
  box-shadow: inset 0 0 0 1px rgba(20, 38, 54, 0.06);
}

.score-gauge-inner {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

#score-text {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1;
}

.score-unit {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.94rem;
}

.summary-text {
  margin: 18px 0 0;
  font-size: 1.06rem;
  line-height: 1.7;
  max-width: 32rem;
  text-align: left;
}

.feedback-panel .guidance-list {
  margin-top: 10px;
  max-width: 32rem;
  text-align: left;
}

.phoneme-score-panel {
  margin-top: 22px;
}

.phoneme-score-title {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  font-weight: 700;
}

.phoneme-score-list {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  min-height: 170px;
}

.phoneme-bar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 32px;
}

.phoneme-bar-value {
  font-weight: 700;
  color: var(--ink-soft);
}

.phoneme-bar-track {
  width: 30px;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 0;
  border-radius: 999px;
  background: rgba(20, 38, 54, 0.08);
}

.phoneme-bar-fill {
  display: block;
  width: 100%;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(20, 38, 54, 0.14);
}

.phoneme-bar-label {
  font-weight: 700;
  color: var(--ink);
}

.site-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  justify-content: flex-start;
  min-height: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  justify-content: flex-start;
  text-align: left;
}

.pill-muted {
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink-soft);
}

.hidden {
  display: none !important;
}

.details-grid {
  display: block;
  width: 100%;
  margin-top: 18px;
}

.details-grid > .card + .card {
  margin-top: 18px;
}

.practice-card {
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.88), rgba(255, 251, 246, 0.72)),
    var(--panel);
}

@media (max-width: 940px) {
  .layout {
    width: min(100vw - 24px, 100%);
    padding: 20px 0 28px;
  }

  .hero-main {
    grid-template-columns: 1fr;
  }

  .card-hero,
  .result-card,
  .practice-card {
    padding: 20px;
  }
}

@media (max-width: 780px) {
  .layout {
    width: min(100vw - 18px, 100%);
    padding: 14px 0 24px;
  }

  .glow {
    width: 24rem;
    height: 24rem;
    opacity: 0.28;
  }

  .card-hero,
  .result-card,
  .practice-card {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-main {
    gap: 18px;
  }

  .hero-sphere-panel {
    padding: 18px;
  }

  .site-notes {
    gap: 8px;
  }

  .pill {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  .pron-chip,
  .meaning-box,
  .feedback-panel {
    padding: 16px;
  }

  .word-sphere-stage {
    min-height: 288px;
  }

  .word-sphere-shell,
  .word-sphere-cloud {
    width: min(100%, 286px);
    height: min(100%, 286px);
  }

  .word-sphere-halo {
    width: min(100%, 330px);
    height: min(100%, 330px);
  }

  .meter-wrap {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .hero-main {
    display: flex;
    flex-direction: column;
  }

  .hero h1 {
    font-size: clamp(1.18rem, 4.6vw, 1.42rem);
    line-height: 1.05;
    white-space: nowrap;
  }

  .hero-title {
    order: 1;
  }

  .hero-main-right {
    order: 2;
  }

  .hero-search-wrap {
    order: 3;
  }

  .practice-card .card-head h2 {
    font-size: 1.08rem;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .card-head,
  .meter-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .pronunciation-grid {
    gap: 8px;
  }

  .word-sphere-stage {
    min-height: 252px;
  }

  .word-sphere-shell,
  .word-sphere-cloud {
    width: min(100%, 244px);
    height: min(100%, 244px);
  }

  .sphere-word {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .result-status {
    max-width: none;
    text-align: left;
    margin-left: 0;
  }

  .result-status,
  #recording-badge {
    width: 100%;
    text-align: left;
    align-self: stretch;
  }

  .site-notes {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pill {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .layout {
    width: calc(100vw - 12px);
    padding: 10px 0 18px;
  }

  .card-hero,
  .result-card,
  .practice-card {
    padding: 14px;
    border-radius: 20px;
  }

  .search-box {
    padding: 14px 14px 16px;
  }

  .search-box input {
    font-size: 1.08rem;
  }

  .hero-sphere-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .hero-sphere-copy h2 {
    font-size: 1.22rem;
  }

  .card-head h2 {
    font-size: 1.52rem;
  }

  .pron-chip {
    min-height: 52px;
    padding: 12px 13px;
  }

  .pron-chip-text {
    gap: 7px;
  }

  .pron-chip-ipa {
    font-size: 1rem;
  }

  .meter-meta {
    font-size: 0.84rem;
  }

  .record-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .record-actions .button {
    width: 100%;
    min-width: 0;
  }

  .score-band {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  #score-text {
    font-size: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sphere-word {
    transition: none;
  }
}

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

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