/* Student pages (Mitmachen, names, practice link, example) in the style of Umfrage's student page:
   white, one column, logo top left, large code field, pill buttons, answer-like name cards.
   The playing field itself comes from the game (templates/<id>/style.css). */
body.student {
  --ink: #15182c; --muted: #65697d; --line: #e4e6ef; --surface: #ffffff; --page: #f4f5f9;
  /* The student side operates in the tool's own blue, so the shared accent tokens point at it
     here. Only the closing celebration below keeps its gold, violet and orange: that is a
     reward, not a control. The teacher app keeps the violet of all Mentio tools. */
  --accent: var(--tool); --accent-dark: var(--tool-dark); --accent-soft: var(--tool-soft); --accent-ink: var(--tool-ink);
  --good: #10a37f; --good-soft: #e2f6f0; --bad: #c93643; --bad-soft: #fdeced;
  --tool: #3b6fd8; --tool-dark: #2f5bb0; --tool-soft: #e8eefb; --tool-ink: #2b5399;
  /* Without this the browser's own 8px margin stays and the page never reaches the screen edge. */
  margin: 0;
  min-height: 100vh; min-height: 100dvh; background: #fff; overscroll-behavior-y: none;
  font: 17px/1.5 "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased;
}
body.student *, body.student *::before, body.student *::after { box-sizing: border-box; }
.student-app { --app-gutter: 20px; display: flex; flex-direction: column; max-width: 560px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); }
.student-app.is-wide { max-width: 800px; }
.student-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 12px; }
/* Name and the path ring belong together on the right, whatever else the header holds. */
.student-top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.student-top-slot:empty { display: none; }
/* Inside that group flexbox decides the width; the 60% cap would cut the name short. */
.student-top-right .who { max-width: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); font-size: 18px; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.teacher-login { color: var(--muted); font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.teacher-login:hover { color: var(--ink); }
.who { max-width: 60%; overflow: hidden; padding: 4px 12px; border-radius: 999px; background: var(--tool-soft); color: var(--tool-ink); font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.student-main { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.eyebrow { color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere; }
.student-title { margin: 0; font-size: clamp(24px, 6.5vw, 32px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }

.student .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 24px; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
/* Student side: the step forward wears the tool's own blue, not the violet of the teacher's side. */
.student .button.primary { border-color: transparent; background: var(--tool); color: #fff; }
.student .button.primary:hover { background: var(--tool-dark); }
.student .button.block { width: 100%; }
.student .button:disabled { opacity: .45; cursor: not-allowed; }
.student .button.example-back { flex: none; min-height: 44px; padding-inline: 14px; font-size: 14px; font-weight: 650; }
.example-back svg { flex: none; width: 18px; height: 18px; }
.student :focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Code entry. */
.join-form { display: grid; gap: 16px; margin: auto 0; text-align: center; }
.join-form h1 { margin: 0; font-size: 30px; font-weight: 800; }
.code-input { width: 100%; min-height: 72px; padding: 0 16px; border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink);
  font: inherit; font-size: 36px; font-weight: 800; letter-spacing: .12em; text-align: center; }
.code-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.code-input[aria-invalid="true"] { border-color: var(--bad); }
.form-message { min-height: 1.5em; margin: 0; font-size: 14px; color: var(--muted); }
.form-message.error { color: var(--bad); font-weight: 600; }

/* Own name in an open round: one field, as prominent as the code field but for text. */
.name-form { display: grid; gap: 16px; }
.name-input { width: 100%; min-height: 60px; padding: 0 18px; border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink);
  font: inherit; font-size: 22px; font-weight: 700; }
.name-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.name-input[aria-invalid="true"] { border-color: var(--bad); }

/* Names as large option cards (like Umfrage's answers). */
.name-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.name-option { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 12px 16px 12px 22px;
  border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); font: inherit; font-size: 18px; font-weight: 650; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.name-option::before { content: ""; position: absolute; left: -2px; top: -2px; bottom: -2px; width: 8px; border-radius: 16px 0 0 16px; background: var(--accent); }
.name-option:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.name-option:disabled { cursor: not-allowed; color: var(--muted); background: var(--page); }
.name-option:disabled::before { background: #c9ccda; }
.name-option small { flex: none; font-size: 14px; font-weight: 600; }
.join-hint { font-size: 14px; color: var(--muted); }
.join-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--bad-soft); color: #9b1c26; font-weight: 600; }

/* Centered messages: confirm, ended, signed out. */
.center-screen { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px 0; text-align: center; }
.center-screen h1 { margin: 0; font-size: 28px; font-weight: 800; overflow-wrap: anywhere; }
.center-screen p { margin: 0; color: var(--muted); }
.center-screen .button { width: min(320px, 100%); }
.big-mark { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.big-mark svg { width: 44px; height: 44px; }
.big-mark.ok { background: var(--good-soft); color: var(--good); }
.join-offline { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff5dd; color: #5c4300; font-size: 15px; }

/* Waiting for the start (join.mjs waitForStart): the round's games "Zum Aufwärmen", then one of them. */
.join-wait, .join-wait-body { flex: 1; display: flex; flex-direction: column; gap: 12px; }
/* Room for the two lines of the waiting text, so the games below stay put when the countdown replaces it. */
.join-wait-text.has-warmups { min-height: 3em; }
.center-screen .join-wait-text.is-counting { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.student .game-tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--game-soft, #ececfe); color: var(--game, #5b5bf6); }
.student .game-tile svg { width: 56%; height: 56%; }
.warmups { display: grid; gap: 10px; width: min(360px, 100vw - 40px); margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.warmups h2 { margin: 0; font-size: 15px; font-weight: 700; text-align: left; }
.warmup-options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.warmup-option { display: grid; grid-template-columns: 40px minmax(0, 1fr) 24px; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 12px;
  border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.warmup-option:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, #fff); }
.warmup-option-text { display: grid; min-width: 0; line-height: 1.3; }
.warmup-option-text strong { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.warmup-option-text small { color: var(--muted); font-size: 14px; }
.warmup-option-check { display: grid; color: var(--good); }
.warmup-option-check[hidden] { display: none; }
.warmup-option-check svg { width: 22px; height: 22px; }
.warmup-play { display: flex; flex-direction: column; gap: 14px; }
.warmup-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.student .button.warmup-back { flex: none; min-height: 44px; padding-inline: 14px; font-size: 14px; font-weight: 650; }
.warmup-back svg { flex: none; width: 18px; height: 18px; }
.warmup-bar .join-wait-text { margin: 0; padding: 6px 14px; border-radius: 999px; background: var(--tool-soft); color: var(--tool-ink); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.warmup-bar .join-wait-text.is-counting { background: var(--tool); color: #fff; }
.warmup-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.warmup-title .game-tile { width: 32px; height: 32px; border-radius: 9px; }

/* Shared final screen: a compact, premium celebration for student phones. */
.student-final { display: grid; gap: 24px; padding-bottom: 28px; }
.student-final-hero { position: relative; isolation: isolate; display: grid; justify-items: center; gap: 5px; padding: 28px 18px 24px; overflow: hidden; border: 1px solid #eee8d4; border-radius: 26px; background:
  radial-gradient(circle at 50% 12%, rgb(255 214 77 / 32%), transparent 34%),
  linear-gradient(145deg, #f7f4ff, #fff8dc); box-shadow: 0 16px 38px rgb(50 41 94 / 10%); text-align: center; }
.student-final-hero::before, .student-final-hero::after { position: absolute; z-index: -1; width: 7px; height: 15px; border-radius: 3px; content: ''; background: #6e8ff4; transform: rotate(28deg); box-shadow: 68px 15px #f5bc1d, 134px -4px #ed63ad, 204px 19px #55cdb6, 270px -7px #8d68ec; }
.student-final-hero::before { top: 22px; left: 18px; }
.student-final-hero::after { right: 23px; bottom: 46px; transform: rotate(-31deg); box-shadow: -62px 10px #f5bc1d, -129px -7px #ed63ad, -196px 13px #55cdb6; }
.student-final-hero p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.student-final-hero h1 { margin: 3px 0; font-size: clamp(30px, 8vw, 44px); line-height: 1.05; letter-spacing: -.045em; }
.student-final-hero > span:last-child { color: #4f5265; font-weight: 750; }
.student-final-trophy { display: grid; place-items: center; width: 78px; height: 78px; margin-bottom: 8px; border: 1px solid #efc849; border-radius: 24px; background: linear-gradient(145deg, #ffe77c, #f5b91e); color: #755000; box-shadow: 0 14px 28px rgb(123 82 0 / 22%), inset 0 1px rgb(255 255 255 / 70%); }
.student-final-trophy svg { width: 42px; height: 42px; stroke-width: 1.7; }
.student-own-medals { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.student-own-medals span { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; box-shadow: inset 0 1px rgb(255 255 255 / 55%); }
.student-own-medals .perfect { background: #dff6e9; color: #176b3f; }
.student-own-medals .points { background: #e8e5fb; color: #4b3fa5; }
.student-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 7px; padding-top: 10px; }
.student-podium.groups-1 { grid-template-columns: minmax(0, 1fr); }
.student-podium.groups-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-podium-place strong em { color: var(--muted); font-size: .86em; font-style: normal; white-space: nowrap; }
/* One exercise only: "Spiele" and "Fehlerfrei" would say nothing. */
.student-final.is-single :is(.games, .perfect):not(.student-own-medals *) { display: none; }
.student-final.is-single :is(.student-final-table-head, .student-final-table-row) .points { grid-column: -2 / -1; }
.student-podium-place { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-content: end; gap: 6px; min-height: 138px; padding: 11px 6px 9px; border: 0; border-radius: 20px 20px 8px 8px; background: linear-gradient(145deg, #a496fa, #7763dd); box-shadow: 0 12px 22px rgb(64 50 139 / 20%), inset 0 1px rgb(255 255 255 / 45%); text-align: center; }
.student-podium-place.place-1 { min-height: 162px; background: linear-gradient(145deg, #ffdd63, #efac16); box-shadow: 0 15px 27px rgb(151 98 0 / 24%), inset 0 1px rgb(255 255 255 / 60%); }
.student-podium-place.place-3 { min-height: 126px; background: linear-gradient(145deg, #ffb781, #e47b3a); box-shadow: 0 12px 22px rgb(132 63 22 / 20%), inset 0 1px rgb(255 255 255 / 48%); }
.student-podium-cup { position: relative; display: grid; place-items: center; width: 48px; height: 48px; color: #f8f8ff; filter: drop-shadow(0 6px 5px rgb(36 26 88 / 18%)); }
.place-1 .student-podium-cup { width: 60px; height: 60px; color: #fff4b2; } .place-3 .student-podium-cup { color: #ffe0ca; }
.student-podium-cup svg { width: 100%; height: 100%; stroke-width: 1.55; }
.student-podium-cup b { position: absolute; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgb(255 255 255 / 88%); color: #33275c; font-size: 11px; }
.place-1 .student-podium-cup b { color: #735000; } .place-3 .student-podium-cup b { color: #743716; }
.student-podium-place strong { display: grid; place-items: center; align-self: stretch; width: 100%; padding: 6px 3px; border: 1px solid rgb(255 255 255 / 65%); border-radius: 10px; background: rgb(255 255 255 / 86%); font-size: clamp(11px, 3.2vw, 15px); line-height: 1.12; overflow-wrap: break-word; word-break: normal; hyphens: auto; }
.student-podium-place small { color: rgb(31 32 54 / 72%); font-size: 10px; font-weight: 800; }
.student-final-section { display: grid; gap: 8px; padding: 16px; border: 1px solid #eeeef5; border-radius: 21px; background: #fbfbfe; box-shadow: 0 12px 30px rgb(44 40 78 / 7%); }
.student-final-section h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.025em; }
.student-final-rule { margin: -2px 0 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.student-final-table-head, .student-final-table-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) 44px 58px 48px; align-items: center; gap: 5px; }
.student-final-table-head { min-height: 16px; padding: 0 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; }
.student-final-table-head > span:nth-child(n + 3) { justify-self: end; text-align: right; }
.student-final-table-head .games::before, .student-final-table-head .perfect::before { display: inline-block; width: 6px; height: 6px; margin-right: 2px; border-radius: 50%; content: ''; }
.student-final-table-head .games::before { background: #aab0bf; } .student-final-table-head .perfect::before { background: #63c78e; }
.student-final-table-row, .student-final-place-row { min-height: 48px; padding: 6px 8px; border: 1px solid #ececf4; border-radius: 12px; background: #f6f7fb; }
.student-final-table-row.place-1, .student-final-place-row.place-1 { border-color: #f2d574; background: linear-gradient(90deg, #fff9dc, #fffdfa); }
.student-final-table-row.is-mine, .student-final-place-row.is-mine { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent); }
.student-final-table-row > span:first-child, .student-final-place-row > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #e4e6ef; color: #555b70; font-weight: 850; text-align: center; }
.student-final-table-row.place-1 > span:first-child, .student-final-place-row.place-1 > span { background: #ffcf3c; color: #624500; }
.student-final-table-row.place-3 > span:first-child, .student-final-place-row.place-3 > span { background: #eca16d; color: #653215; }
.student-final-table-row strong, .student-final-place-row strong { min-width: 0; line-height: 1.18; overflow-wrap: anywhere; }
.student-final-table-row i { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; font-style: normal; font-size: 11px; font-weight: 850; }
.student-final-table-row i.games { background: #eef0f6; color: #4f5668; }
.student-final-table-row i.perfect { background: #dff6e9; color: #176b3f; }
.student-final-table-row i.games, .student-final-table-row i.perfect { justify-self: end; }
.student-final-table-row i.points { justify-self: end; width: auto; min-width: 0; height: auto; padding: 0; border-radius: 0; background: transparent; color: #4b3fa5; font-size: 16px; font-variant-numeric: tabular-nums; }
.student-final-place-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.student-final-place-row small { color: var(--muted); font-size: 12px; text-align: right; }
.student-awards { display: grid; gap: 8px; }
.student-award { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 13px; border: 1.5px solid #ded8fb; border-radius: 15px; background: linear-gradient(90deg, #faf8ff, #f6f4ff); }
.student-award.is-mine { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent); }
.student-award > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: #e7defe; color: #713fe6; }
.student-award.is-clean > span { background: #e4e7ff; color: #4355d8; } .student-award.is-comeback > span { background: #d9f6e5; color: #17894b; }
.student-award > span svg { width: 24px; height: 24px; }
.student-award small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.student-award h3 { margin: 0; font-size: 18px; }
.student-award strong { display: block; line-height: 1.25; }
.student-award p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
@keyframes student-final-enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.student-podium-place { animation: student-final-enter .38s cubic-bezier(.2,.8,.2,1) both; }
.student-podium-place:nth-child(2) { animation-delay: .05s; } .student-podium-place:nth-child(3) { animation-delay: .1s; }
@media (max-width: 440px) {
  .student-app.is-wide { --app-gutter: 14px; padding-inline: 14px; }
  .student-final-section { padding-inline: 12px; }
  .student-podium-place { padding-inline: 4px; }
  .student-podium-place strong { font-size: 10.5px; }
  .student-final-table-head, .student-final-table-row { grid-template-columns: 26px minmax(0, 1fr) 32px 44px 40px; gap: 4px; }
  /* Narrow: the headings no longer sit over their columns – "Fehlerfrei" is wider than the column it
     names, and on a phone that renders its text a little larger it reached into "Spiele". They become
     one legend above the table instead, which wraps instead of overlapping, as on the projector. The
     colours of the dots tie them to the chips in the rows. */
  .student-final-table-head { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 10px; padding-bottom: 2px; text-align: right; }
  .student-final-table-head > span:nth-child(-n + 2) { display: none; }
  .student-final-table-row i { width: 27px; height: 27px; }
}
@media (max-width: 360px) {
  .student-final-table-head { display: none; }
  .student-final-table-row { grid-template-columns: 26px 34px 42px minmax(42px, 1fr); grid-template-rows: auto auto; row-gap: 5px; min-height: 58px; }
  .student-final-table-row > span:first-child { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .student-final-table-row > strong { grid-column: 2 / -1; grid-row: 1; }
  .student-final-table-row i { grid-row: 2; }
  .student-final-table-row i.games { grid-column: 2; }
  .student-final-table-row i.perfect { grid-column: 3; }
  .student-final-table-row i.points { grid-column: 4; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { .student-podium-place { animation: none; } }
