:root { font-family: system-ui, sans-serif; color: #1a2e1a; background: #f2f7f2; }
* { box-sizing: border-box; }
body { margin: 0; }
header { background: #2e5d32; color: #fff; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
header h1 { font-size: 1.2rem; margin: 0; }
header .version { font-size: .7rem; opacity: .75; }
.btn { background: #4c8a50; color: #fff; border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: .9rem; }
.btn.sec { background: #d9e8d9; color: #2e5d32; }
.btn.sec.ok { background: #4c8a50; color: #fff; }
main { max-width: 900px; margin: 0 auto; padding: 20px; }
.card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; }
label { display: block; font-size: .85rem; color: #4b6b4b; margin-top: 10px; }
/* Test dropdown list: options monospaced so the padded label columns (name/date/count) line up exactly; the closed select keeps the normal font */
select#quiz-test option { font-family: ui-monospace, Consolas, "Courier New", monospace; }
input[type=text], select { width: 100%; padding: 8px; border: 1px solid #c4d4c4; border-radius: 8px; font-size: 1rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
/* Quiz buttons: main button left, Beenden right, natural size (no stretching) */
.btn-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.quiz-img { max-width: 100%; max-height: 420px; border-radius: 12px; display: block; margin: 0 auto; }
/* Plant images: single image centered, up to 3 split images side by side, responsive */
.img-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 6px 0; }
.img-grid .quiz-img { max-width: 100%; max-height: 420px; object-fit: contain; }
.hidden { display: none; }
.muted { color: #6b8a6b; font-size: .85rem; }
.pill { display: inline-block; background: #e7f1e7; border-radius: 20px; padding: 3px 10px; font-size: .8rem; margin: 2px; }
.pill input { margin-right: 4px; }
.correct { color: #2e7d32; font-weight: 600; }
.wrong { color: #b3563e; font-weight: 600; }
.big { font-size: 1.1rem; }
.center { text-align: center; }
fieldset { border: 1px solid #c4d4c4; border-radius: 10px; margin: 12px 0; }
.score-bar { height: 10px; background: #e0eae0; border-radius: 5px; overflow: hidden; margin: 10px 0; }
.score-fill { height: 100%; background: #4c8a50; transition: width .3s; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #2e5d32; color: #fff; padding: 10px 20px; border-radius: 20px; display: none; z-index: 10; }
.field-block { margin: 14px 0; padding: 10px; border: 1px solid #e0eae0; border-radius: 10px; }
.field-block .flabel { font-weight: 600; font-size: .9rem; color: #2e5d32; }
.choice-btn { display: block; margin: 6px 0; width: 100%; text-align: left; }
.fact { margin: 4px 0; }
.fact .fact-label { font-weight: 600; color: #2e5d32; font-size: .9rem; }
/* Question blocks: up to 3 per row, responsive via auto-fit */
.ask-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.ask-grid .field-block { margin: 0; }

/* News bell next to the version badge: hover on desktop, tap on touch */
.news-bell { position: relative; display: inline-flex; align-items: center; margin-left: 8px; cursor: pointer; font-size: 1rem; }
.news-dot { position: absolute; top: -2px; right: -4px; width: 9px; height: 9px; background: #e8a13c; border-radius: 50%; border: 1px solid #fff; }
.news-tip { display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; min-width: 240px; max-width: 320px; background: #fff; color: #1a2e1a; border: 1px solid #c4d4c4; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 10px 14px; font-size: .85rem; white-space: pre-line; }
.news-bell:hover .news-tip, .news-bell:focus .news-tip, .news-bell.open .news-tip { display: block; }

/* Quiz header: only test name; mode/order shown on hover (desktop) or tap (touch) */
.header-tip { position: relative; cursor: default; }
.header-tip .tip { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; background: #fff; color: #1a2e1a; border: 1px solid #c4d4c4; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 6px 12px; font-size: .85rem; font-weight: 400; white-space: nowrap; }
.header-tip:hover .tip, .header-tip:focus .tip, .header-tip.open .tip { display: block; }

/* Endless checkbox next to the start button */
.start-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.endless-label { margin-top: 0; cursor: pointer; }
/* Start page: card header with label (left) and nav button (right) */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
/* Compact date/subject lists on the start page */
.home-list { list-style: none; margin: 10px 0 0; padding: 0; }
.home-list li { padding: 5px 0; border-bottom: 1px solid #e0eae0; }
.home-list li:last-child { border-bottom: none; }
.home-date { display: inline-block; min-width: 7.2em; font-weight: 600; color: #2e5d32; }
/* Back link above the composed feature views (quiz/schedule) */
.back-row { margin-bottom: 12px; }
/* Test dates on the start page: two side-by-side blocks on wide screens, stacked on narrow */
.home-tests { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 24px; }
/* Unterricht card: group selector (1-3) next to the card label */
.head-group { display: flex; align-items: center; gap: 8px; }
.card-head select { width: auto; padding: 3px 6px; font-size: .8rem; margin-top: 0; }
/* Unterricht card: one equal-sized field per hour, two rows (morning 1-5 / afternoon 7-11) */
.unit { margin-top: 12px; }
.unit-date { font-weight: 600; color: #2e5d32; }
.unit-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 4px; margin-top: 4px; }
.slot { border-radius: 6px; padding: 8px 2px; min-height: 34px; display: flex; align-items: center; justify-content: center; font-size: .8rem; text-align: center; background: #e7f1e7; }
.slot.empty { background: #f0f5f0; }
/* Unterricht card: framed block around consecutive group lessons (Übungseinheiten) */
.slot-block { display: flex; gap: 4px; border: 2px solid #2e5d32; border-radius: 8px; padding: 2px; }
/* keep the framed block exactly as tall as a single slot (34px) so the
   neighbouring field in the same grid row does not stretch */
.slot-block .slot { flex: 1; min-height: 26px; padding: 4px 2px; }
/* Schedule view: vertical day band (one row per slot, lunch break marked) */
.day-band { display: flex; flex-direction: column; gap: 5px; }
.band-row { display: flex; gap: 8px; align-items: stretch; }
.band-time { min-width: 88px; font-size: .75rem; color: #6b8a6b; display: flex; align-items: center; }
.band-cell { flex: 1; border-radius: 6px; padding: 6px 10px; font-size: .85rem; background: #e7f1e7; display: flex; align-items: center; justify-content: center; min-height: 34px; }
.band-cell.empty { background: #f0f5f0; }
.band-cell.break-cell { background: #f0f5f0; border: 1px dashed #c4d4c4; color: #6b8a6b; font-size: .78rem; justify-content: center; }
.band-run { display: flex; gap: 8px; align-items: stretch; }
.band-time-col { display: flex; flex-direction: column; gap: 5px; padding: 5px 0; }
.band-time-col .band-time { min-height: 34px; }
.band-block { display: flex; flex-direction: column; gap: 5px; border: 2px solid #2e5d32; border-radius: 8px; padding: 3px; flex: 1; }
.band-cell.has-test { font-weight: 700; }
.slot.has-test { font-weight: 700; }
/* Schedule view: months as calendar grids; the day plan appears on hover/tap */
.sched-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 20px; align-items: start; }
.sched-card { position: relative; }
.month-cal { display: flex; flex-direction: column; }
.month-cal h3 { margin: 10px 0 4px; font-size: .8rem; color: #2e5d32; letter-spacing: .04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-head { font-size: .68rem; color: #6b8a6b; text-align: center; padding: 2px 0; }
.cal-off { min-height: 28px; }
.cal-day { position: relative; min-height: 28px; border: 1px solid transparent; border-radius: 6px; background: #fff; color: #8aa38a; font-size: .78rem; cursor: pointer; padding: 4px 0; text-align: center; }
.cal-day.teaching:hover { background: #d5ecd5; color: #1a2e1a; }
.cal-day:not(.teaching) { cursor: default; }
.cal-day.teaching { background: #e7f1e7; border-color: #9fc59f; color: #1a2e1a; font-weight: 600; }
.cal-day.sunday { background: #fbe9e4; border-color: #e5b8ac; color: #b3563e; }
.cal-day.teaching.sunday { background: #e7f1e7; border-color: #9fc59f; color: #1a2e1a; }
.cal-day.has-test::after { content: ""; position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: #e8a13c; }
/* Day plan popup: shown on hover/tap next to the day cell */
.plan-pop { position: absolute; z-index: 30; display: none; background: #fff; border: 1px solid #c4d4c4; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 12px; min-width: 250px; max-width: 340px; }
/* popup header: date over the time column, group name on the same line,
   aligned with the subject column (time column 88px + 8px gap) */
.plan-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.plan-head .unit-date { width: 88px; flex: none; }
.plan-group { flex: 1; text-align: center; font-size: .85rem; color: #2e5d32; }
.plan-pop.open { display: block; }
/* test days: orange frame + bold in addition to the dot */
.cal-day.has-test { border: 1px solid #e8a13c; font-weight: 700; }
/* current day: dark ring */
.cal-day.today { box-shadow: 0 0 0 2px #2e5d32; font-weight: 700; }
