:root {
  color-scheme: light;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --ink: #172033;
  --muted: #5a6478;
  --primary: #176b63;
  --primary-soft: #dcefeb;
  --line: #dce1e8;
  --danger: #b3261e;
  --shadow: 0 10px 28px rgb(23 32 51 / 8%);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--primary);
  color: white;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  background: var(--primary-soft);
  color: var(--primary);
}

button.danger {
  background: #fbe9e7;
  color: var(--danger);
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
}

.screen {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.screen--center {
  display: grid;
  place-items: center;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stack {
  display: grid;
  gap: 14px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.grow {
  flex: 1;
}

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

.error {
  color: var(--danger);
}

.unit-button {
  display: flex;
  justify-content: space-between;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.player-word {
  margin: 0;
  font-size: clamp(2.2rem, 11vw, 4.8rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.player-phonetic {
  color: var(--primary);
  font-size: 1.25rem;
}

.player-meaning {
  font-size: 1.4rem;
  font-weight: 650;
}

.player-example {
  line-height: 1.65;
}

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

.voice-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.voice-row input {
  width: auto;
  min-height: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: 90vw;
  padding: 10px 14px;
  border-radius: 10px;
  background: #172033;
  color: white;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

[hidden] {
  display: none !important;
}
