/* Host start page: login, quiz list, games, account */

/* Footer sits at the bottom of the window on short pages and after the content on long ones. */
body.start {
  display: flex;
  flex-direction: column;
}

/* The header and the footer are .page-header and .page-footer from sha.css (006). The logo sits
   where --page-width puts it on every page; the content below keeps its own column. */
.start-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.start-main > .view {
  flex-direction: column;
}

.login {
  gap: 12px;
  max-width: 380px;
  margin: 10vh auto 0;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.dashboard {
  gap: 48px;
}

.section {
  display: grid;
  gap: 16px;
}

.section__head {
  display: grid;
  gap: 4px;
}

.section h1 {
  font-size: 2rem;
}

code {
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: var(--grey);
  font-size: 0.9em;
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* The hint «Noch keine Quizze …» spans the grid instead of wrapping in one column. */
.quiz-grid > p {
  grid-column: 1 / -1;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}

.quiz-card h3 {
  font-size: 1.25rem;
}

.quiz-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.quiz-card__more {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.quiz-card__errors {
  color: var(--rose);
  font-size: 0.85rem;
}

.quiz-card__errors ul {
  margin: 4px 0 0;
  padding-left: 1.1em;
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.games {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.games th,
.games td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.games th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status {
  display: inline-block;
  padding: 0.15em 0.7em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--grey-light);
}

.status--done {
  background: var(--rose);
  color: var(--ink);
}

.games__actions {
  display: flex;
  gap: 16px;
}

/* ---------- Account & login ---------- */

/* Dangerous action (delete account) */
.btn--danger {
  background: var(--wrong);
  color: var(--white);
}

.btn--danger:hover {
  background: #bb5649;
}

.dialog {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 24px;
  overflow-y: auto;
  border: 0;
  border-radius: var(--radius);
  background: var(--grey);
  color: var(--white);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dialog__form {
  display: grid;
  gap: 16px;
}

/* A long e-mail address without a hyphen must wrap instead of widening the dialog or the page. */
.dialog__form > p,
#account-section-email {
  overflow-wrap: anywhere;
}

/* On phones, save space so that both buttons stay in view. With the newsletter notice the dialog
   is taller than a small phone (360 × 640) and scrolls vertically. */
@media (max-width: 480px) {
  .dialog {
    padding: 16px;
  }

  .dialog__form {
    gap: 12px;
  }
}

.dialog__hint {
  font-size: 0.85rem;
  line-height: 1.5;
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dialog__actions .btn {
  flex: 1 1 auto;
}

/* E-mail address and «Abmelden» in the header: on a phone the address is cut short, the button stays. */
.account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account .btn {
  flex: none;
}

.account__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.login-google {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}

.login-links {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: 4px;
}

.form-info:empty,
.form-error:empty {
  display: none;
}

/* The confirmation above the list (e.g. after an import): its live region stays rendered while
   empty (no display: none, or screen readers may miss it). Out of the flow it is no grid item of
   .section, so the grid adds no gap for it and the head of «Meine Quizze» keeps its spacing. */
#start-info:empty {
  display: block;
  position: absolute;
}

/* Confirmations are white and bold; errors (.form-error) stay rosé. */
.form-info {
  color: var(--white);
  font-weight: 600;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--rose);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.link-button--danger {
  color: var(--muted);
}

.section__head--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Terms checkbox (sign-up) and note (login) */

.terms {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  cursor: pointer;
}

.terms input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--rose);
  cursor: pointer;
}

.terms span {
  padding-top: 1px;
}

/* The section «Konto»: one surface each for the newsletter and for deleting the account, one under
   the other, as wide as the section and so as the other blocks of the page (no max-width). They are
   at least 32px apart from each other and from «Angemeldet als …». A hidden newsletter leaves no
   gap behind. Long words and addresses wrap instead of widening the page. */
.section--account {
  gap: 32px;
}

.account-card,
.newsletter__state {
  display: grid;
  gap: 12px;
  min-width: 0;
}

/* The confirmation after unsubscribing, white and bold like .form-info. Its live region stays
   rendered while empty (no display: none, or screen readers may miss it) and then takes no space. */
.newsletter__status {
  color: var(--white);
  font-weight: 600;
}

.newsletter__status:not(:empty) {
  margin-top: 12px;
}

.account-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.account-card p {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .account-card {
    padding: 20px;
  }
}

/* Security check (Turnstile): as wide as the inputs; its height stays reserved while it loads. */
.captcha {
  min-width: 0;
  min-height: 65px;
}

.captcha iframe {
  display: block;
}

/* Hints in the sign-up form: under the password field and above the terms checkbox. */
.login-hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.login-note {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Confirm the e-mail address (link from the sign-up mail): no inputs, one large button. */
.confirm-email__text {
  line-height: 1.5;
}

.confirm-email__button {
  min-height: 48px;
  margin-top: 12px;
}

/* ---------- Instructions «So funktioniert es» ----------
   The white box is the one of the landing page (.how in sha.css); only its place and its size in
   the overview are set here: colours, corners, lines and texts stay. The box stands in two places
   (see placeGuide in start.js), so the size rules start at .dashboard, which holds both. They are
   more specific than the rules of sha.css, including its media query, so no !important is needed.

   Sizes follow the content of the overview (computed values, px):
     heading   = «Ergebnisse» / «Konto»:        h2, 1.5em = 24, weight 500 (unchanged)
     step title = «Newsletter»:                  .account-card h3, 1.1rem = 17.6, weight stays 500
     index, step text = text of «Konto löschen»: 1rem = 16
     padding   = .card:                          24, up to 480px wide 20
   The gaps shrink by 0.85, the ratio of the step text (18.88px, from 1.18rem, to 16px). */

/* Below the hint «Noch keine Quizze …»: 16px more than the gap of the section. */
.section > .how {
  margin-top: 16px;
}

.dashboard .how {
  padding: 24px;
}

.dashboard .how h2 {
  margin-bottom: 24px;
  font-size: 1.5rem;
}

.dashboard .steps {
  gap: clamp(19px, 2.8vw, 46px);
}

.dashboard .steps li {
  padding-top: 14px;
}

.dashboard .step-index,
.dashboard .steps p {
  font-size: 1rem;
}

.dashboard .steps h3 {
  margin: 3px 0 7px;
  font-size: 1.1rem;
}

@media (max-width: 760px) {
  .dashboard .how h2 {
    margin-bottom: 17px;
  }

  .dashboard .steps {
    gap: 17px;
  }

  .dashboard .steps li {
    padding-top: 12px;
  }
}

@media (max-width: 480px) {
  .dashboard .how {
    padding: 20px;
  }
}
