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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f0f2f5;
  color: #1f2937;
  min-height: 100vh;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

nav .brand { font-weight: 700; font-size: 1.15rem; color: #2563eb; text-decoration: none; }
nav div { display: flex; gap: 20px; }
nav a { color: #374151; text-decoration: none; }
nav a:hover { color: #2563eb; }

.hero {
  max-width: 640px;
  margin: 96px auto;
  padding: 0 20px;
  text-align: center;
}
.hero h1 { font-size: 2.2rem; margin-bottom: 12px; }
.hero p { color: #6b7280; margin-bottom: 28px; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  background: #2563eb;
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #1d4ed8; }

.card {
  max-width: 380px;
  margin: 80px auto;
  padding: 36px 32px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}
.card h1 { font-size: 1.5rem; margin-bottom: 20px; }

.card label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 18px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}
.card input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.card button { width: 100%; }

.error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: 8px;
  font-size: .9rem;
}

.hint { margin-top: 16px; font-size: .85rem; color: #6b7280; text-align: center; }

.dash { max-width: 720px; margin: 60px auto; padding: 0 20px; }
.panel {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}
.panel h1 { margin-bottom: 8px; }
.panel p { color: #6b7280; margin-bottom: 24px; }
.meta { margin-top: 28px !important; font-size: .9rem; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn.ghost {
  background: #fff;
  color: #2563eb !important;
  border: 1px solid #2563eb;
}
.btn.ghost:hover { background: #eff6ff; }

.game { max-width: 560px; margin: 40px auto 60px; padding: 0 20px; }
.game-head h1 { font-size: 1.8rem; }
.game-head .sub { color: #6b7280; margin-bottom: 20px; }

.game-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.game-bar label { font-weight: 600; font-size: .9rem; }
.game-bar select {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: .95rem;
  background: #fff;
}

.counter {
  text-align: center;
  font-size: .9rem;
  color: #6b7280;
  margin-bottom: 12px;
}

.flip-card {
  perspective: 1200px;
  height: 260px;
  cursor: pointer;
  outline: none;
}
.flip-card:focus-visible .flip-inner { box-shadow: 0 0 0 3px rgba(37, 99, 235, .3); }
.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s;
  border-radius: 16px;
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face.front {
  background: linear-gradient(135deg, #ffffff, #eef2ff);
  border: 1px solid #dbeafe;
}
.face.back {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  transform: rotateY(180deg);
}

.word {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}
.word.tr { font-weight: 600; }

.badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.face.front .badge { background: #dbeafe; color: #1d4ed8; }
.face.back .badge { background: rgba(255, 255, 255, .25); color: #fff; }

.tap-hint {
  position: absolute;
  bottom: 14px;
  font-size: .78rem;
  opacity: .55;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
