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

body {
  margin: 0;
  font-family: "Comic Sans MS", "Yuanti SC", "STYuanti", "PingFang SC", sans-serif;
  background: linear-gradient(145deg, #ffe4f0 0%, #ffcce0 35%, #ffd6e8 70%, #fff0f6 100%);
  color: #5c3d4e;
  min-height: 100vh;
}

body::before {
  content: "✿ ✧ ♡ ✧ ✿";
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  color: rgba(255, 105, 180, 0.35);
  letter-spacing: 1.2rem;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 16px 48px;
}

.header {
  text-align: center;
  margin-bottom: 28px;
}

.header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  color: #e84393;
  text-shadow: 2px 2px 0 #ffd6e8;
}

.subtitle {
  margin: 0;
  color: #c06c8c;
  font-size: 1.05rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1 1 calc(33.333% - 10px);
  min-width: 90px;
  padding: 12px 8px;
  border: 3px solid #ff85a2;
  border-radius: 999px;
  background: #fff5f8;
  color: #e84393;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, color 0.15s;
  box-shadow: 0 3px 0 #ffb3c6;
}

.tab-btn:hover {
  transform: translateY(-2px);
}

.tab-btn.active {
  background: linear-gradient(180deg, #ff85a2, #ff6b9d);
  color: #fff;
  box-shadow: 0 4px 0 #e84393;
}

.tab-panel {
  background: #fffafc;
  border: 3px solid #ffcce0;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(255, 105, 180, 0.18);
}

.exercise-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.exercise-link {
  display: inline-block;
  padding: 14px 24px;
  background: linear-gradient(180deg, #ff9ec4, #ff6b9d);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 4px 0 #e84393;
  transition: transform 0.15s;
}

.exercise-link:hover {
  transform: translateY(-2px);
}

.placeholder {
  margin: 0;
  color: #d4a5b5;
  text-align: center;
  font-size: 1rem;
}

/* Test page */
.test-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.test-header {
  text-align: center;
}

.test-header h1 {
  margin: 8px 0 0;
  font-size: 1.85rem;
  color: #e84393;
  text-shadow: 2px 2px 0 #ffd6e8;
}

.back-link {
  display: inline-block;
  color: #ff6b9d;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 14px;
  background: #fff0f6;
  border-radius: 999px;
  border: 2px solid #ffcce0;
}

.history-panel {
  background: #fffafc;
  border: 3px solid #ffcce0;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(255, 105, 180, 0.15);
  max-height: 260px;
  overflow-y: auto;
}

.history-panel h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: #e84393;
  text-align: center;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.history-item {
  padding: 10px 6px;
  border-radius: 16px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid transparent;
  word-break: break-all;
}

.history-item.correct {
  background: linear-gradient(180deg, #d8ffe8, #b8f5cc);
  color: #2d8659;
  border-color: #7dcea0;
}

.history-item.wrong {
  background: linear-gradient(180deg, #ffe0e8, #ffc8d4);
  color: #c9184a;
  border-color: #ff85a2;
}

.history-empty {
  margin: 0;
  padding: 16px 8px;
  color: #d4a5b5;
  font-size: 0.95rem;
  text-align: center;
  grid-column: 1 / -1;
  list-style: none;
  font-weight: 700;
}

.stats-bar {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  background: #fffafc;
  border: 3px solid #ffcce0;
  border-radius: 999px;
  padding: 14px 24px;
  box-shadow: 0 6px 18px rgba(255, 105, 180, 0.12);
  font-size: 1rem;
  font-weight: 700;
}

.stats-bar span {
  padding: 4px 14px;
  border-radius: 999px;
  background: #fff0f6;
}

.stat-correct strong {
  color: #2d8659;
}

.stat-wrong strong {
  color: #e84393;
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: #fffafc;
  border: 3px solid #ffcce0;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(255, 105, 180, 0.15);
}

.timer-box .label,
.duration-box label {
  display: block;
  font-size: 0.85rem;
  color: #c06c8c;
  margin-bottom: 4px;
  font-weight: 700;
}

.timer-display {
  font-size: 2.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ff6b9d;
  text-shadow: 1px 1px 0 #ffd6e8;
}

.duration-box input {
  width: 80px;
  padding: 10px;
  border: 2px solid #ffb3c6;
  border-radius: 14px;
  font-size: 1rem;
  background: #fff5f8;
  color: #5c3d4e;
  text-align: center;
}

.duration-box input:focus {
  outline: none;
  border-color: #ff6b9d;
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.25);
}

.primary-btn {
  margin-left: auto;
  padding: 14px 32px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9ec4, #ff6b9d);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #e84393;
  transition: transform 0.15s;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  background: #fffafc;
  border: 3px dashed #ffb3c6;
  border-radius: 28px;
  padding: 36px 16px;
  box-shadow: 0 8px 24px rgba(255, 105, 180, 0.12);
}

.status-msg {
  margin: 0;
  color: #c06c8c;
  font-size: 1.15rem;
  font-weight: 700;
}

.question-text {
  margin: 0 0 22px;
  font-size: 2.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #e84393;
  text-shadow: 2px 2px 0 #ffd6e8;
}

.question-box input {
  width: 220px;
  padding: 14px 16px;
  border: 3px solid #ff85a2;
  border-radius: 18px;
  font-size: 1.35rem;
  text-align: center;
  background: #fff5f8;
  color: #5c3d4e;
  font-weight: 700;
}

.question-box input:focus {
  outline: none;
  border-color: #ff6b9d;
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.25);
}

.question-box input:disabled {
  opacity: 0.5;
}

@media (max-width: 640px) {
  .history-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .question-text {
    font-size: 2.2rem;
  }
}

@media (max-width: 420px) {
  .history-list {
    grid-template-columns: 1fr;
  }
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 16px 32px;
  font-size: 0.85rem;
  color: #b8889a;
}

.site-footer__company {
  margin: 0 0 6px;
}

.site-footer__meta {
  margin: 0;
}

.site-footer a {
  color: #c06c8c;
  text-decoration: none;
}

.site-footer a:hover {
  color: #e84393;
  text-decoration: underline;
}

.site-footer__sep {
  margin: 0 8px;
  color: #d4a5b5;
}
