/* The sign-in screen.
 *
 * An eight-year-old opens this every practice day, so it is warm rather than
 * administrative: daylight blue, a rounded card, a trail climbing a hill towards a
 * flag. Nothing bounces or demands attention — the page a child sees before working
 * should feel calm, not like a game asking to be played.
 *
 * Everything is drawn in CSS and inline SVG. No image files, no web fonts, nothing
 * fetched: the page appears at once on a phone on mobile data, and the Content-
 * Security-Policy can stay as tight as it is.
 */
:root {
  color-scheme: light;
  --ink: #163259;
  --muted: #5c7290;
  --sky-top: #cfe6ff;
  --sky-bottom: #eaf4ff;
  --card: #ffffff;
  --line: #dbe7f6;
  --sun: #ffd166;
  --hill: #7cc4a4;
  --hill-dark: #55a583;
  --trail: #f6b352;
  --warn-bg: #fff2e2;
  --warn-ink: #8a4b12;
  --shadow: 0 18px 40px rgba(22, 50, 89, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eaf2ff;
    --muted: #a8bdd8;
    --sky-top: #1b2c47;
    --sky-bottom: #12203a;
    --card: #1c2f4d;
    --line: #2b4468;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --ink: #eaf2ff;
  --muted: #a8bdd8;
  --sky-top: #1b2c47;
  --sky-bottom: #12203a;
  --card: #1c2f4d;
  --line: #2b4468;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: linear-gradient(170deg, var(--sky-top), var(--sky-bottom) 62%);
  color: var(--ink);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

/* Three soft clouds drifting behind the card. Slow enough to be scenery. */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

.cloud {
  position: absolute;
  background: #fff;
  border-radius: 999px;
  opacity: 0.55;
  filter: blur(0.3px);
  animation: drift linear infinite;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 999px;
}
.c1 { width: 130px; height: 40px; top: 12%; left: -180px; animation-duration: 90s; }
.c1::before { width: 62px; height: 62px; top: -26px; left: 26px; }
.c1::after  { width: 44px; height: 44px; top: -16px; left: 74px; }
.c2 { width: 96px; height: 30px; top: 34%; left: -140px; animation-duration: 130s;
      animation-delay: -40s; opacity: 0.4; }
.c2::before { width: 46px; height: 46px; top: -20px; left: 18px; }
.c2::after  { width: 34px; height: 34px; top: -12px; left: 54px; }
.c3 { width: 150px; height: 46px; top: 72%; left: -200px; animation-duration: 160s;
      animation-delay: -90s; opacity: 0.3; }
.c3::before { width: 70px; height: 70px; top: -30px; left: 30px; }
.c3::after  { width: 50px; height: 50px; top: -18px; left: 86px; }

@keyframes drift { to { transform: translateX(calc(100vw + 240px)); } }

@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; }
  .trail { stroke-dasharray: none; animation: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cloud { opacity: 0.08; }
}

main {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 34px 30px 30px;
  width: min(420px, 100%);
  text-align: center;
  box-shadow: var(--shadow);
}

/* The trail draws itself once, in a little over a second, then stays put. */
.mark { width: 132px; height: 132px; display: block; margin: 0 auto 6px; }
.sun   { fill: var(--sun); }
.hill  { fill: var(--hill); }
.trail {
  fill: none;
  stroke: var(--trail);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 150;
  stroke-dashoffset: 150;
  animation: draw 1.4s 0.2s ease-out forwards;
}
.pole  { stroke: var(--hill-dark); stroke-width: 3.5; stroke-linecap: round; }
.cloth { fill: #ef6f6c; }
.flag  { opacity: 0; animation: appear 0.4s 1.5s ease-out forwards; }

@keyframes draw   { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

h1 {
  margin: 0;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tagline {
  margin: 2px 0 26px;
  color: var(--muted);
  font-size: 1.05rem;
}

.signin-button {
  display: flex;
  justify-content: center;
  min-height: 40px;
  /* Google renders its own markup here and sizes it in px. Scaling the result keeps
     it modest without fighting the widget's internals, which change without notice. */
  transform: scale(0.94);
  transform-origin: center;
}

.signin-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.status {
  margin: 22px 0 0;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  text-align: start;
  font-size: 0.98rem;
}

.dev-login {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.dev-label {
  width: 100%;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
}
.dev-login button { margin-top: 0; }

.account-id { margin-top: 14px; text-align: start; }
.account-label { margin: 0 0 6px; color: var(--muted); font-size: 0.9rem; }

code {
  display: block;
  direction: ltr;
  text-align: left;
  background: var(--sky-bottom);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font: 0.95rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

button {
  margin-top: 10px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  min-height: 44px;
}
button:hover { background: var(--sky-bottom); }
button:focus-visible { outline: 3px solid var(--trail); outline-offset: 2px; }

@media (max-width: 380px) {
  main { padding: 26px 20px 24px; border-radius: 22px; }
  .mark { width: 108px; height: 108px; }
  h1 { font-size: 2.2rem; }
}
