:root {
  --green: #2e7d32;
  --green-dark: #1b5e20;
  --green-light: #e8f5e9;
  --red: #c62828;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 20px;
  background: var(--green-light);
  color: #1c2b1d;
}
header {
  background: var(--green);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
h1 { margin: 0; font-size: 32px; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 28px; }
nav button {
  background: transparent;
  color: #fff;
  border: 2px solid transparent;
  margin-left: 6px;
}
nav button.active { border-color: #fff; }
main { max-width: 760px; margin: 0 auto; padding: 24px; }

button, input, select, textarea {
  font: inherit;
  padding: 10px 16px;
  border-radius: 8px;
  border: 2px solid #a5d6a7;
  background: #fff;
}
button { cursor: pointer; border-color: var(--green); color: var(--green-dark); font-weight: bold; }
button.primary { background: var(--green); color: #fff; }
button.primary:hover { background: var(--green-dark); }
button.good { background: var(--green); color: #fff; }
button.bad { background: var(--red); border-color: var(--red); color: #fff; }
button.small { padding: 4px 10px; font-size: 16px; }

label { display: block; margin-bottom: 14px; font-weight: bold; }
label input, label textarea, label select { display: block; width: 100%; margin-top: 6px; font-weight: normal; }
.row { display: flex; gap: 10px; }
.row input { flex: 1; }
.hint { color: #5a7a5c; }
.error { color: var(--red); }

.card {
  background: #fff;
  border: 3px solid var(--green);
  border-radius: 16px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  margin: 16px 0;
  font-size: 40px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.card.back { background: #c8e6c9; font-size: 28px; }
.card .front { font-weight: bold; font-size: 22px; color: #2e7d32; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 2px solid #81c784; }
#answer-buttons { display: flex; gap: 12px; }
#answer-buttons button { flex: 1; padding: 16px; }
#reveal { width: 100%; padding: 16px; }
#train-setup select { display: block; width: 100%; margin: 12px 0; }

.list { list-style: none; padding: 0; }
.list li {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.list .text { flex: 1; overflow-wrap: anywhere; }
.list .text small { display: block; color: #5a7a5c; font-size: 16px; white-space: pre-wrap; }
#card-form { background: #fff; padding: 20px; border-radius: 12px; margin-bottom: 20px; }
label.check { font-weight: normal; }
label.check input { display: inline; width: auto; margin: 0 8px 0 0; }
[hidden] { display: none !important; }

#card-img { display: block; max-width: 100%; max-height: 40vh; margin: 1rem auto 0; border-radius: 8px; }

#paste-zone { border: 2px dashed #2e7d32; border-radius: 8px; padding: 1rem; margin: .5rem 0; text-align: center; color: #2e7d32; outline: none; }
#paste-zone:focus { background: #e8f5e9; }
#paste-preview { display: block; max-width: 100%; max-height: 200px; margin: .5rem auto 0; border-radius: 6px; }

#card-back { min-height: 260px; resize: vertical; }
.badge { display: inline-block; background: #ffe066; color: #5c4a00; border-radius: 12px; padding: 2px 10px; font-size: 14px; font-weight: normal; margin-left: 8px; vertical-align: middle; }

#card-img, #paste-preview { cursor: zoom-in; }
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 2vmin; }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
