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

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: #333;
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
  -webkit-text-size-adjust: 100%;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
  font-size: clamp(1.4rem, 5vw, 2rem);
}

h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
}

.continent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  padding: 10px;
}

.continent-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 1.1em;
  font-weight: bold;
  color: #34495e;
  -webkit-tap-highlight-color: transparent;
}

.continent-card:hover,
.continent-card:active {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
  background: #3498db;
  color: #fff;
}

/* Table wrapper for horizontal scroll on small screens */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 400px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 0.95em;
}

th {
  background: #3498db;
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
}

td input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #bdc3c7;
  border-radius: 6px;
  font-size: 1em;
  -webkit-appearance: none;
  appearance: none;
}

td input:focus {
  outline: none;
  border-color: #3498db;
}

td input.correct {
  background-color: #d4edda;
  border-color: #28a745;
}

td input.wrong {
  background-color: #f8d7da;
  border-color: #dc3545;
}

.hint {
  color: #27ae60;
  font-weight: bold;
  font-size: 0.8em;
  display: block;
  margin-top: 4px;
}

.buttons {
  text-align: center;
  margin-top: 24px;
  margin-bottom: 40px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 48px;
}

.btn:hover {
  opacity: 0.85;
}

.btn-check {
  background: #27ae60;
  color: #fff;
}

.btn-check:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.btn-reset {
  background: #f39c12;
  color: #fff;
}

.btn-show {
  background: #8e44ad;
  color: #fff;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #3498db;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05em;
  padding: 8px 0;
}

.back-link:hover {
  text-decoration: underline;
}

/* Mobile card layout */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .continent-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0;
  }

  .continent-card {
    padding: 20px 12px;
    font-size: 1em;
  }

  .table-wrapper {
    overflow-x: visible;
  }

  table {
    min-width: unset;
  }

  /* Switch table to card layout on mobile */
  table thead {
    display: none;
  }

  table tbody tr {
    display: block;
    background: #fff;
    margin-bottom: 12px;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-bottom: none;
  }

  table tbody td {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: none;
    font-size: 0.95em;
  }

  table tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: #3498db;
    min-width: 95px;
    flex-shrink: 0;
  }

  td input {
    padding: 10px 12px;
    font-size: 1em;
  }

  .hint {
    display: inline;
    margin-left: 6px;
    margin-top: 0;
  }

  .buttons {
    flex-direction: column;
    align-items: stretch;
    padding: 0 10px;
  }

  .btn {
    width: 100%;
    padding: 16px;
    font-size: 1.05em;
  }
}
