/* src/styles.css */
:root {
  color: #1f2328;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #f7f4ee;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

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

.app {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  background: #fffaf2;
  border-bottom: 1px solid #ded8cf;
  justify-content: space-between;
  align-items:  center;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 42px);
}

.brand {
  display: grid;
  gap: 2px;
}

.brand__title {
  color: #202124;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 780;
}

.brand__subtitle {
  color: #6b6259;
  font-size: .88rem;
}

.range {
  display: flex;
  color: #51483f;
  align-items:  center;
  gap: 10px;
}

.range__fields {
  display: flex;
  align-items:  center;
  gap: 8px;
}

.range input {
  color: #1f2328;
  text-align: center;
  background: #fff;
  border: 1px solid #cfc6bb;
  border-radius: 8px;
  width: 74px;
  height: 40px;
}

.range__summary {
  color: #6b6259;
  text-align: right;
  min-width: 74px;
  font-size: .86rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, .86fr) minmax(340px, 1.14fr);
  gap: clamp(18px, 4vw, 44px);
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px);
}

.practice {
  display: grid;
  align-content:  start;
  gap: 16px;
}

.flashcard {
  display: grid;
  background: #fffdf8;
  border: 1px solid #d9d0c5;
  border-radius: 8px;
  place-items:  center;
  min-height: 360px;
  padding: clamp(24px, 6vw, 58px);
  box-shadow: 0 18px 40px #1f232814;
}

.front, .back {
  width: 100%;
}

.number {
  color: #205a66;
  text-align: center;
  font-size: clamp(6rem, 16vw, 10rem);
  font-weight: 820;
  line-height: .95;
}

.answer {
  display: grid;
  text-align: center;
  justify-items: center;
  gap: 12px;
}

.answer__word {
  overflow-wrap: anywhere;
  color: #8f321d;
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  font-weight: 800;
  line-height: 1.05;
}

.answer__ipa {
  color: #3d4632;
  font-family: SFMono-Regular, Consolas, Liberation Mono, monospace;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.primary, .secondary, .icon-button {
  display: inline-grid;
  border-radius: 8px;
  place-items:  center;
  min-height: 44px;
  transition: transform .12s, background-color .12s, box-shadow .12s;
}

.primary {
  color: #fff;
  background: #205a66;
  font-weight: 760;
  box-shadow: 0 12px 24px #205a6633;
}

.secondary, .icon-button {
  color: #205a66;
  background: #fff;
  border: 1px solid #cfc6bb;
}

.secondary {
  width: 52px;
}

.icon-button {
  width: 38px;
  min-height: 34px;
  font-size: .82rem;
}

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

.primary:focus-visible {
  outline: 3px solid #d69b3a;
  outline-offset: 2px;
}

.secondary:focus-visible {
  outline: 3px solid #d69b3a;
  outline-offset: 2px;
}

.icon-button:focus-visible {
  outline: 3px solid #d69b3a;
  outline-offset: 2px;
}

input:focus-visible {
  outline: 3px solid #d69b3a;
  outline-offset: 2px;
}

.needs-tap {
  color: #8f321d;
  border-color: #8f321d;
}

.rules {
  min-width: 0;
}

.rules__heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.rules__heading h2 {
  color: #202124;
  margin: 0;
  font-size: 1.05rem;
}

.rules__count {
  color: #6b6259;
  font-size: .86rem;
}

.table-wrap {
  overflow: auto;
  background: #fffdf8;
  border: 1px solid #d9d0c5;
  border-radius: 8px;
  max-height: calc(100vh - 190px);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
}

th, td {
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #ebe4dc;
  padding: 10px 12px;
}

thead th {
  position: sticky;
  z-index: 1;
  color: #51483f;
  background: #efe8df;
  font-size: .82rem;
  font-weight: 760;
  top: 0;
}

tbody th {
  color: #205a66;
  font-variant-numeric: tabular-nums;
  width: 54px;
}

tbody td:nth-child(3) {
  color: #3d4632;
  font-family: SFMono-Regular, Consolas, Liberation Mono, monospace;
}

tbody td:last-child {
  text-align: right;
  width: 54px;
}

tbody tr:last-child th, tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 820px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .range {
    flex-direction: column;
    align-items:  flex-start;
  }

  .range__summary {
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .flashcard {
    min-height: 300px;
  }

  .table-wrap {
    max-height: none;
  }
}
