:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #657080;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --line: #d9e0e6;
  --teal: #087f8c;
  --green: #2f8f46;
  --red: #c14646;
  --amber: #c77d1d;
  --blue: #305f9f;
  --shadow: 0 18px 45px rgba(28, 39, 54, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(8, 127, 140, 0.12), rgba(199, 125, 29, 0.12)),
    var(--paper);
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
  display: flex;
  align-items: stretch;
}

.practice-panel {
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 224, 230, 0.9);
  box-shadow: var(--shadow);
}

.top-bar,
.settings-row,
.card-top,
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.25;
}

.score-box {
  min-width: 82px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  background: #f7faf9;
}

.score-box span {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
}

.score-box small,
.hint-text,
.feedback-box small,
.answer-label,
.progress-text {
  color: var(--muted);
}

.settings-row {
  flex-wrap: wrap;
  justify-content: space-between;
}

.select-label,
.toggle-label,
.range-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

select {
  max-width: 230px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

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

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
}

.prompt-card {
  min-height: 185px;
}

.card-top {
  justify-content: space-between;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  background: #eaf6f3;
  color: #075e68;
  font-weight: 700;
  font-size: 0.85rem;
}

.ja-prompt {
  margin: 22px 0 10px;
  font-size: 2rem;
  line-height: 1.35;
  font-weight: 800;
}

.hint-text {
  margin: 0;
  line-height: 1.6;
}

.answer-area {
  min-height: 88px;
  padding: 14px 16px;
  border-left: 5px solid var(--blue);
  background: #f5f8fc;
}

.dictation-area {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.dictation-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  align-items: stretch;
}

.typed-answer {
  min-height: 52px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fbfcfd;
  font-size: 1rem;
}

.typed-answer:focus {
  outline: 3px solid rgba(8, 127, 140, 0.18);
  border-color: var(--teal);
}

.check-button {
  min-height: 52px;
  background: #eaf6f3;
  color: #075e68;
}

.answer-label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.spoken-text,
.correct-answer {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.45;
  font-weight: 700;
}

.feedback-box {
  min-height: 72px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  background: #f9fafb;
}

.feedback-box p {
  margin: 0 0 4px;
  font-weight: 800;
}

.feedback-box.ok {
  border-color: rgba(47, 143, 70, 0.45);
  background: #eef8f0;
}

.feedback-box.miss {
  border-color: rgba(193, 70, 70, 0.45);
  background: #fff2f2;
}

.feedback-box.listening {
  border-color: rgba(199, 125, 29, 0.55);
  background: #fff7e9;
}

.primary-controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
}

.sub-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.control-button,
.small-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.control-button {
  min-height: 76px;
  padding: 14px;
  color: #fff;
  font-size: 1.1rem;
}

.control-button span {
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.control-button.main {
  background: var(--teal);
}

.control-button.secondary {
  background: var(--blue);
}

.control-button:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.small-button {
  min-height: 50px;
  padding: 10px;
  color: var(--ink);
  background: #eef2f5;
  border: 1px solid var(--line);
}

.answer-card {
  min-height: 96px;
}

.phone-hint {
  display: none;
  padding: 12px 14px;
  border: 1px solid rgba(8, 127, 140, 0.3);
  background: #edf8f6;
  color: #075e68;
  font-size: 0.9rem;
  line-height: 1.55;
}

.hidden {
  visibility: hidden;
}

@media (max-width: 560px) {
  body {
    background: var(--paper);
  }

  .app-shell {
    padding: 0;
  }

  .practice-panel {
    min-height: 100vh;
    padding: 14px;
    border: 0;
    box-shadow: none;
  }

  .top-bar {
    align-items: flex-start;
  }

  h1 {
    font-size: 1.2rem;
  }

  .score-box {
    min-width: 72px;
  }

  .settings-row {
    align-items: stretch;
    gap: 10px;
  }

  .select-label,
  .range-label {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  select {
    width: 100%;
    max-width: none;
  }

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

  .toggle-label {
    min-height: 44px;
    width: calc(50% - 6px);
  }

  .prompt-card {
    min-height: 150px;
  }

  .ja-prompt {
    margin-top: 18px;
    font-size: 1.55rem;
  }

  .primary-controls,
  .sub-controls {
    grid-template-columns: 1fr 1fr;
  }

  .control-button {
    min-height: 88px;
    font-size: 1.05rem;
  }

  .small-button {
    min-height: 58px;
  }

  .dictation-area {
    padding: 12px;
  }

  .dictation-row {
    grid-template-columns: 1fr;
  }

  .typed-answer {
    min-height: 58px;
    font-size: 1.02rem;
  }

  .phone-hint {
    display: block;
  }
}
