*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6f9;
  color: #222;
  min-height: 100vh;
  padding-bottom: 150px; /* Space for fixed phoneme bank */
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #1a1a2e;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-link {
  color: #a0c4ff;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
}

.stats {
  display: flex;
  gap: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}

#score-display { color: #a0ffb0; }
#mistakes-display { color: #ffadad; }
#timer-display { color: #ffd6a0; font-family: monospace; }

main {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

#phoneme-bank {
  background: #fff;
  padding: 1rem;
  border-top: 2px solid #ddd;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 100;
  text-align: center;
}

.bank-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
  min-height: 3rem;
  max-height: 100px;
  overflow-y: auto;
}

.phoneme-card {
  background: #4a90e2;
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: grab;
  font-size: 1.2rem;
  user-select: none;
}

.phoneme-card.dragging {
  opacity: 0.5;
}

.phoneme-card.was-wrong {
  background: #e74c3c;
}

.charts-container {
  width: 100%;
  max-width: 1100px;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

table {
  border-collapse: collapse;
  background: #fff;
  width: 100%;
  font-size: 0.85rem;
  table-layout: fixed;
}

caption {
  font-weight: bold;
  padding: 0.5rem;
  background: #eee;
}

th, td {
  border: 1px solid #ccc;
  text-align: center;
  height: 2.5rem;
  position: relative;
}

.row-label {
  background: #f9f9f9;
  font-style: italic;
  width: 120px;
}

.impossible {
  background: #e0e0e0;
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 50%, #ccc 50%, #ccc 75%, transparent 75%, transparent);
  background-size: 4px 4px;
}

.ipa-pair {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.drop-zone {
  width: 28px;
  height: 28px;
  border: 1px dashed #aaa;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.drop-zone.over {
  background: #e3f2fd;
  border-color: #2196f3;
}

.drop-zone.filled {
  border-style: solid;
  border-color: #27ae60;
  background: #eafaf1;
  font-weight: bold;
  font-size: 1.1rem;
}

.drop-zone.filled.was-wrong {
  border-color: #e74c3c;
  background: #fdedec;
  color: #e74c3c;
}

.drop-zone:empty::after {
  content: attr(data-ipa);
  opacity: 0.05;
  font-size: 0.7rem;
}

.drop-zone.not-english {
  border: none;
  background: transparent;
}
.drop-zone.not-english::after {
  content: attr(data-ipa);
  opacity: 1;
}

.other-symbols {
  width: auto;
  align-self: flex-start;
}

.other-symbols .row-label {
  width: 250px;
  text-align: left;
  padding-left: 1rem;
}
