:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #617067;
  --line: #d8e0da;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --accent-soft: #dff3ef;
  --warm: #c27a28;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.10), transparent 34%),
    linear-gradient(315deg, rgba(194, 122, 40, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 220px;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

input[type="range"] {
  accent-color: var(--accent);
}

.primary-button,
.record-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.22);
}

.primary-button:hover,
.record-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.practice-area {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.speech-status {
  min-width: 170px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.tab-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.is-hidden {
  display: none !important;
}

.phrase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
}

.phrase-card {
  display: grid;
  gap: 14px;
  min-height: 390px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.phrase-card__head,
.actions,
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.phrase-card__head {
  justify-content: space-between;
}

.level-pill,
.theme-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.level-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.theme-pill {
  background: #fff0dc;
  color: #8a4e0b;
}

.english {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 850;
  line-height: 1.25;
}

.question-text,
.answer-text {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.3;
}

.answer-text {
  color: var(--accent-strong);
}

.qa-block {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.qa-block > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.pronunciation,
.translation,
.tip {
  margin: 0;
  line-height: 1.45;
}

.pronunciation {
  padding: 12px;
  border-left: 4px solid var(--warm);
  background: #fff8ef;
  color: #744206;
  font-weight: 800;
}

.translation {
  color: var(--muted);
}

.tip {
  color: #33413a;
  font-size: 0.92rem;
}

.actions {
  margin-top: auto;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #e8eeee;
  color: var(--ink);
  font-weight: 900;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  min-height: 44px;
  padding: 0 14px;
  background: #17201b;
  color: #ffffff;
  font-weight: 800;
}

.record-button.is-recording {
  background: var(--danger);
}

.recognition-result {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.recognition-result span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.recognized-text {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.score-row {
  justify-content: space-between;
}

.score-bar {
  position: relative;
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece8;
}

.score-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warm), var(--accent));
  transition: width 220ms ease;
}

.score-label {
  min-width: 44px;
  text-align: right;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    max-width: none;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    display: flex;
  }

  .tab-button {
    flex: 1;
  }
}

@media (max-width: 420px) {
  .sidebar,
  .practice-area {
    padding: 18px;
  }

  .phrase-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-wrap: wrap;
  }
}
