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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #0f3460;
  --primary: #e94560;
  --text: #eaeaea;
  --muted: #8892a4;
  --green: #2ecc71;
  --red: #e74c3c;
  --radius: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

header {
  background: var(--surface);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--accent);
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

#score-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#score-bar strong { color: var(--text); }

#reset-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
}

#reset-btn:hover { color: var(--primary); border-color: var(--primary); }

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

#card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

#verb-es {
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

#question-label {
  font-size: 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--accent);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
}

#answer-input {
  width: 100%;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

#answer-input:focus { border-color: var(--primary); }
#answer-input.correct { border-color: var(--green); }
#answer-input.incorrect { border-color: var(--red); }

#submit-btn, #next-btn {
  width: 100%;
  padding: 0.9rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

#submit-btn { background: var(--primary); color: #fff; }
#submit-btn:hover { opacity: 0.88; }

#next-btn { background: var(--accent); color: var(--text); }
#next-btn:hover { opacity: 0.88; }

#feedback {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  min-height: 1.8rem;
}

#feedback.correct { color: var(--green); }
#feedback.incorrect { color: var(--red); }

#expected {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 1.2rem;
}

.hidden { display: none !important; }

/* ── Mode navigation ── */
#mode-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--accent);
  flex-shrink: 0;
}

.nav-btn {
  padding: 0.5rem 1.6rem;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.nav-btn:hover  { background: #1a4a80; color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; }
.nav-btn.active:hover { background: var(--primary); opacity: 0.9; }

/* ── Study view ── */
#study-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#study-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--accent);
  flex-shrink: 0;
}

#filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

#filter-label input { accent-color: var(--primary); cursor: pointer; }

#go-practice-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

#go-practice-btn:hover { opacity: 0.85; }

#table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#verb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#verb-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--accent);
}

#verb-table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

#verb-table td {
  padding: 0.55rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  white-space: nowrap;
}

#verb-table tbody tr:hover { background: rgba(255,255,255,0.04); }

#verb-table tbody tr.irregular td:first-child {
  border-left: 3px solid var(--primary);
  padding-left: calc(1rem - 3px);
}

#profile-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

#profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  text-align: center;
}

#profile-card h2 {
  font-size: 1.5rem;
  color: var(--primary);
}

#profile-error {
  color: var(--red);
  font-size: 0.9rem;
}

#profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.profile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.profile-btn:hover {
  border-color: var(--primary);
  background: rgba(233,69,96,0.15);
  transform: translateY(-2px);
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

#profile-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

#switch-btn {
  background: none;
  border: 1px solid var(--accent);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
}

#switch-btn:hover { color: var(--primary); border-color: var(--primary); }

@media (max-width: 400px) {
  #card { padding: 1.5rem 1rem; }
  #verb-es { font-size: 1.8rem; }
}
