
:root {
  --green: #008c45;
  --green-dark: #006c36;
  --red: #cd212a;
  --red-dark: #a8171f;
  --ink: #18211d;
  --muted: #63716a;
  --paper: #f6f7f4;
  --white: #ffffff;
  --line: #d9dfda;
  --soft-green: #e8f4ed;
  --soft-red: #fae9ea;
  --shadow: 0 16px 40px rgba(20, 40, 30, 0.11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(0, 140, 69, 0.08), transparent 32rem),
    radial-gradient(circle at 90% 80%, rgba(205, 33, 42, 0.07), transparent 34rem),
    var(--paper);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.flagbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 7px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.flagbar span:nth-child(1) { background: var(--green); }
.flagbar span:nth-child(2) { background: var(--white); }
.flagbar span:nth-child(3) { background: var(--red); }

.app-shell {
  width: min(1040px, calc(100% - 28px));
  margin: 0 auto;
  padding: 42px 0 50px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -0.025em; }
#subtitle { color: var(--muted); margin-bottom: 0; }
.eyebrow {
  margin-bottom: 6px;
  color: var(--green-dark);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 223, 218, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 38px);
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
}
.hero-card {
  border-radius: 20px;
  padding: 30px;
  color: white;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  min-height: 310px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-number { font-size: clamp(4rem, 10vw, 7.5rem); font-weight: 900; line-height: 0.9; }
.hero-label { margin-top: 14px; font-weight: 800; font-size: 1.2rem; }
.hero-card p { margin: 18px 0 0; line-height: 1.55; opacity: 0.92; }

.settings-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-content: center;
  padding: 12px 4px;
}
.settings-card label:not(.checkline), .search-label {
  margin-top: 8px;
  font-size: 0.87rem;
  font-weight: 800;
  color: var(--muted);
}
select, input[type="text"], input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
}
select:focus, input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 140, 69, 0.12);
}
.checkline {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  line-height: 1.4;
}
.checkline input { margin-top: 3px; accent-color: var(--green); }

.action-row, .quiz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}
.button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--green); box-shadow: 0 8px 20px rgba(0, 140, 69, 0.22); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { color: var(--ink); background: white; border: 1px solid var(--line); }
.button.danger { color: white; background: var(--red); box-shadow: 0 8px 20px rgba(205, 33, 42, 0.2); }
.button.danger:hover { background: var(--red-dark); }

.utility-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.text-button {
  border: 0;
  padding: 4px;
  background: transparent;
  color: var(--green-dark);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.danger-text { color: var(--red-dark); }
.file-label { cursor: pointer; }
.file-label input { position: absolute; opacity: 0; pointer-events: none; }
.message { text-align: center; color: var(--muted); margin: 16px 0 0; min-height: 1.4em; }

.quiz-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--soft-green);
  color: var(--green-dark);
  font-size: 0.84rem;
}
.badge.review { background: var(--soft-red); color: var(--red-dark); }
.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #edf0ed;
  overflow: hidden;
  margin: 14px 0 24px;
}
#progressBar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #4baa73);
  transition: width 0.25s ease;
}
.question-card {
  max-width: 760px;
  min-height: 360px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(22px, 4vw, 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: white;
}
.mode-hint {
  margin-bottom: 10px;
  color: var(--green-dark);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}
#questionTitle { margin-bottom: 7px; font-size: clamp(2rem, 5vw, 3rem); }
.question-subtitle { color: var(--muted); font-size: 1.05rem; margin-bottom: 22px; }
.answer-input { font-size: 1.2rem; font-weight: 650; }
.forms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-field label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.form-field input.correct-field { border-color: var(--green); background: var(--soft-green); }
.form-field input.wrong-field { border-color: var(--red); background: var(--soft-red); }

.accent-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}
.accent-row button {
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8f9f7;
  font-weight: 800;
}
.feedback {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 14px;
  line-height: 1.5;
}
.feedback.correct { background: var(--soft-green); color: var(--green-dark); }
.feedback.wrong { background: var(--soft-red); color: var(--red-dark); }
.feedback .note { display: block; margin-top: 7px; color: var(--muted); font-size: 0.9rem; }

.live-stats {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  color: var(--muted);
}
.live-stats strong { color: var(--ink); }

.report-heading { text-align: center; max-width: 650px; margin: 0 auto 26px; }
.report-heading p:last-child { color: var(--muted); line-height: 1.55; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 18px;
  text-align: center;
}
.stat-card strong { display: block; font-size: 1.8rem; margin-bottom: 3px; }
.stat-card span { color: var(--muted); font-size: 0.86rem; }
.report-box {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.report-box h3 { margin-bottom: 14px; }
.mistake-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.mistake-item:first-child { border-top: 0; padding-top: 0; }
.mistake-item strong { color: var(--red-dark); }
.mistake-item small { display: block; color: var(--muted); margin-top: 4px; }


.button.learn-button {
  color: var(--green-dark);
  background: var(--soft-green);
  border: 1px solid rgba(0, 140, 69, 0.24);
}
.button.learn-button:hover { background: #dcefe4; }

.verb-card-dialog { width: min(760px, calc(100% - 24px)); }
.verb-card-german {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
}
.verb-card-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.verb-fact {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 16px;
  background: #fafbf9;
}
.verb-fact span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}
.verb-fact strong { font-size: 1.12rem; }
.conjugation-card, .verb-note-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  background: white;
}
.conjugation-card h3, .verb-note-card h3 { margin-bottom: 14px; }
.conjugation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.conjugation-item {
  border-radius: 13px;
  padding: 12px 14px;
  background: var(--soft-green);
}
.conjugation-item.current-form {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}
.conjugation-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.conjugation-item strong { font-size: 1.08rem; }
.verb-note-card {
  margin-top: 12px;
  background: #fffaf1;
  border-color: #eadbbd;
}
.verb-note-card p { margin-bottom: 0; line-height: 1.55; }
.dialog-action {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

dialog {
  width: min(1180px, calc(100% - 24px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(18, 30, 24, 0.62); backdrop-filter: blur(3px); }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}
.close-button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 1.7rem;
  line-height: 1;
}
.search-label { display: block; margin: 4px 0 14px; }
.search-label input { margin-top: 6px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 1100px; background: white; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: #f0f3ef; font-size: 0.8rem; }
td { font-size: 0.88rem; }
tbody tr:hover { background: #f8faf8; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 18px, 1040px); padding-top: 28px; }
  .app-header { align-items: flex-start; flex-direction: column; }
  .intro-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 230px; }
  .panel { border-radius: 18px; padding: 18px; }
  .question-card { min-height: 330px; padding: 20px; }
  .forms-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .verb-card-summary, .conjugation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quiz-actions .button, .action-row .button { width: 100%; }
  .utility-row { flex-direction: column; align-items: center; gap: 10px; }
}

@media (max-width: 460px) {
  .verb-card-summary, .conjugation-grid { grid-template-columns: 1fr; }
}
