* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #fdf6ec;
  color: #333;
}

header {
  text-align: center;
  padding: 24px 16px 8px;
}

header h1 {
  margin: 0 0 4px;
  color: #d62828;
}

header p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.card {
  display: block;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.card img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  background: #fffdf8;
  padding: 6px;
}

.card span {
  display: block;
  padding: 8px 4px 10px;
  font-weight: 600;
  color: #d62828;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* Detail / popup page */
.detail-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

.detail-wrap img {
  max-width: 320px;
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  background: #fffdf8;
}

.detail-word {
  font-size: 32px;
  font-weight: 700;
  color: #d62828;
  text-transform: uppercase;
  margin: 20px 0 12px;
  letter-spacing: 1px;
}

.detail-wrap audio {
  width: 100%;
  max-width: 320px;
  margin-top: 6px;
}

.replay-btn {
  margin-top: 16px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: #d62828;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.replay-btn:hover {
  background: #b81f1f;
}

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: #888;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 14px;
  color: #d62828;
  text-decoration: none;
  font-weight: 600;
}

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