/* Distinct visual design for the passcode-gated sentence bank (v2) -
   deliberately different from both style.css (serif site theme) and the
   drills.html look, so this reads as its own space. Clean sans-serif
   "app" aesthetic, soft indigo palette. */

:root {
  --v2-bg: #f4f3fb;
  --v2-panel: #ffffff;
  --v2-border: #e1def2;
  --v2-text: #211f3d;
  --v2-muted: #7b7799;
  --v2-accent: #5b4de0;
  --v2-accent-soft: #ece9fb;
  --v2-good: #1f9d63;
  --v2-bad: #d0454f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --v2-bg: #141225;
    --v2-panel: #1d1a35;
    --v2-border: #322d55;
    --v2-text: #eeecfb;
    --v2-muted: #948fc0;
    --v2-accent: #8b7bff;
    --v2-accent-soft: #292350;
    --v2-good: #4fd996;
    --v2-bad: #ff7b84;
  }
}

* { box-sizing: border-box; }

html {
  /* Stop iOS from inflating text when the phone turns to landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.v2 {
  background: var(--v2-bg);
  color: var(--v2-text);
  font-family: -apple-system, "Segoe UI", "Inter", Helvetica, Arial, sans-serif;
  max-width: 34rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
  line-height: 1.5;
  /* Long German compound nouns must wrap, not widen the page. */
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: rgba(91, 77, 224, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.v2-crumb {
  font-size: 0.85rem;
  color: var(--v2-muted);
  margin-bottom: 1.5rem;
}
.v2-crumb a { color: var(--v2-muted); text-decoration: none; }
.v2-crumb a:hover { color: var(--v2-accent); }

/* Gate */
.v2-gate {
  background: var(--v2-panel);
  border: 1px solid var(--v2-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 12px 32px rgba(91, 77, 224, 0.08);
}
.v2-lock-icon { font-size: 2.2rem; margin-bottom: 0.6rem; }
.v2-gate h1 { font-size: 1.3rem; margin: 0 0 0.4rem; }
.v2-gate p { color: var(--v2-muted); font-size: 0.92rem; margin: 0 0 1.5rem; }
.v2-gate input {
  width: 100%;
  font-family: inherit;
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.15em;
  padding: 0.75rem;
  border: 1px solid var(--v2-border);
  border-radius: 10px;
  background: var(--v2-bg);
  color: var(--v2-text);
  margin-bottom: 0.9rem;
}
.v2-gate input:focus { outline: 2px solid var(--v2-accent); }
.v2-gate button {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem;
  border: none;
  border-radius: 10px;
  background: var(--v2-accent);
  color: #fff;
  cursor: pointer;
}
.v2-gate button:hover { opacity: 0.92; }
.v2-gate-error { color: var(--v2-bad); font-size: 0.85rem; min-height: 1.2rem; margin-top: 0.8rem; }

/* App */
.v2-app-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}
.v2-app-head h1 { font-size: 1.2rem; margin: 0; }
.v2-lock-btn {
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--v2-muted);
  background: none;
  border: 1px solid var(--v2-border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.v2-lock-btn:hover { color: var(--v2-accent); border-color: var(--v2-accent); }

.v2-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.v2-row select {
  flex: 1;
  min-width: 8rem;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--v2-border);
  border-radius: 8px;
  background: var(--v2-panel);
  color: var(--v2-text);
}

.v2-toggle {
  display: inline-flex;
  border: 1px solid var(--v2-border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--v2-panel);
}
.v2-toggle button {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--v2-text);
  cursor: pointer;
}
.v2-toggle button.active { background: var(--v2-accent); color: #fff; }

.v2-icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--v2-border);
  border-radius: 999px;
  background: var(--v2-panel);
  cursor: pointer;
}
.v2-icon-btn.active { border-color: var(--v2-accent); color: var(--v2-accent); }

.v2-meta {
  text-align: center;
  font-size: 0.78rem;
  color: var(--v2-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1rem 0 0.8rem;
}

.v2-card {
  background: var(--v2-panel);
  border: 1px solid var(--v2-border);
  border-radius: 18px;
  padding: 1.8rem 1.6rem;
  box-shadow: 0 10px 28px rgba(91, 77, 224, 0.07);
}
.v2-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}
.v2-index { font-size: 0.8rem; color: var(--v2-muted); }
.v2-tag {
  font-size: 0.72rem;
  text-transform: lowercase;
  background: var(--v2-accent-soft);
  color: var(--v2-accent);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.v2-prompt {
  font-size: 1.4rem;
  font-weight: 600;
  min-height: 3.5rem;
  margin-bottom: 1.1rem;
}

.v2-reveal {
  width: 100%;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--v2-muted);
  background: var(--v2-bg);
  border: 1px dashed var(--v2-border);
  border-radius: 10px;
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
}
.v2-reveal:hover { border-color: var(--v2-accent); color: var(--v2-accent); }

.v2-answer {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--v2-accent-soft);
  font-size: 1.1rem;
}

.v2-type-row { display: flex; gap: 0.5rem; }
.v2-type-row[hidden] { display: none; }
.v2-type-row input {
  flex: 1;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--v2-border);
  border-radius: 10px;
  background: var(--v2-bg);
  color: var(--v2-text);
}
.v2-type-row button {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--v2-accent);
  color: #fff;
  cursor: pointer;
}
.v2-verdict { font-size: 0.85rem; margin: 0.6rem 0 0; min-height: 1.1rem; }
.v2-verdict.correct { color: var(--v2-good); }
.v2-verdict.wrong { color: var(--v2-bad); }

.v2-next-wrap { text-align: center; margin-top: 1.4rem; }
.v2-next {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.8rem;
  border: none;
  border-radius: 999px;
  background: var(--v2-text);
  color: var(--v2-bg);
  cursor: pointer;
}
.v2-next:hover { opacity: 0.88; }

.v2-hint { text-align: center; font-size: 0.78rem; color: var(--v2-muted); margin-top: 1.5rem; }

/* ---------- phones ---------- */

@media (max-width: 600px) {
  body.v2 { padding: 1.5rem 1rem 4rem; }

  /* iOS zooms the page when a focused control is under 16px. */
  .v2-row select,
  .v2-type-row input,
  .v2-gate input { font-size: 16px; }

  .v2-gate { padding: 1.75rem 1.25rem; }
  .v2-gate input { min-height: 44px; }
  .v2-gate button { min-height: 48px; }

  .v2-card { padding: 1.25rem 1.1rem; }
  .v2-prompt {
    font-size: 1.2rem;
    min-height: 3rem;
  }
  .v2-answer { font-size: 1.05rem; }

  /* Comfortable thumb targets (Apple's 44px guideline). */
  .v2-lock-btn,
  .v2-toggle button,
  .v2-reveal,
  .v2-next,
  .v2-type-row input,
  .v2-type-row button { min-height: 44px; }
  .v2-icon-btn { width: 2.6rem; height: 2.6rem; }
  .v2-row select { min-height: 44px; }

  /* Stack the answer field over its button so both are full width. */
  .v2-type-row { flex-direction: column; }
  .v2-type-row button { width: 100%; }

  .v2-next { width: 100%; border-radius: 12px; }
}

@media (max-width: 380px) {
  body.v2 { padding: 1.25rem 0.85rem 4rem; }
  .v2-gate { padding: 1.5rem 1rem; }
  .v2-card { padding: 1.1rem 0.9rem; }
  .v2-prompt { font-size: 1.1rem; }
}
