:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #1a1d21;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #9a3412;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topbar,
.controls,
.word-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  min-height: 44px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
}

h2 {
  min-height: 30px;
  font-size: 26px;
  line-height: 1.15;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.controls {
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input,
button {
  font: inherit;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.28);
  outline-offset: 1px;
}

.word-field {
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.suggestions {
  display: none;
  max-height: 154px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.suggestions.is-open {
  display: block;
}

.suggestion {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion:focus-visible {
  background: #eef6f4;
}

.suggestion small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.word-card {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

dl > div {
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.speak-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.speak-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.speak-button svg path:not(:first-child) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.speak-button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.speak-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.status.is-warning {
  color: var(--warn);
}

@media (max-width: 360px) {
  .app {
    padding: 6px;
    gap: 6px;
  }

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

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 24px;
  }
}
