/* ============================================================
   Welcome / Sign-in Landing Overlay
   Extracted from main.css to reduce override churn.
   ============================================================ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, rgba(148, 163, 184, 0.13), transparent),
    radial-gradient(ellipse 55% 48% at 88% 12%, rgba(100, 116, 139, 0.10), transparent),
    radial-gradient(ellipse 65% 50% at 78% 85%, rgba(71, 85, 105, 0.09), transparent),
    radial-gradient(ellipse 50% 42% at 20% 88%, rgba(148, 163, 184, 0.07), transparent),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, calc(env(safe-area-inset-top, 0px) + 24px)) 24px max(24px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  opacity: 1;
  transition: opacity 0.25s ease;
}
.welcome-overlay[hidden] {
  display: none !important;
}

/* Ensure [hidden] is respected inside the overlay even when display is set by other rules */
.welcome-overlay [hidden] {
  display: none !important;
}

.welcome-overlay.is-dismissing {
  opacity: 0;
  pointer-events: none;
}

.welcome-card {
  max-width: 360px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.welcome-brand-logo,
.welcome-home-brand-logo {
  width: min(112px, 32vw);
  height: min(112px, 32vw);
  min-width: 84px;
  min-height: 84px;
  border-radius: 26px;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}
.welcome-title {
  margin: 0;
  font-size: calc(var(--text-2xl) + 4px);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.welcome-subtitle {
  margin: 0;
  color: var(--text-muted, #888);
  font-size: var(--text-md);
  line-height: 1.4;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.welcome-btn {
  width: 100%;
  padding: 13px 16px;
  font-size: var(--text-md);
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  cursor: pointer;
}

.google-signin-btn {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
}

.google-signin-btn:hover,
.google-signin-btn:focus-visible {
  background: #f8f9fa;
  border-color: #c6c6c6;
}

.google-signin-btn__icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.google-signin-btn__label {
  letter-spacing: 0.01em;
}

:root:not([data-theme="light"]) .google-signin-btn {
  color: #ffffff;
}

.welcome-btn.google-signin-btn {
  width: 100%;
}

#cloudGoogleSignInBtn.google-signin-btn {
  min-height: 44px;
  width: 100%;
}

.welcome-btn-guest {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.welcome-btn-guest:hover,
.welcome-btn-guest:focus-visible {
  background: var(--panel);
}

.welcome-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted, #888);
  line-height: 1.5;
}

.welcome-version {
  font-size: var(--text-sm);
  color: var(--text-muted, #888);
  opacity: 0.82;
  letter-spacing: 0.02em;
}

.welcome-card--anon {
  min-height: min(82dvh, 620px);
}

.welcome-card--anon .welcome-version {
  margin-top: auto;
  display: block;
  width: 100%;
  text-align: center;
  padding-top: 6px;
}

/* Signed-in home panel */
.welcome-card--home {
  max-width: 440px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.welcome-home-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.welcome-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.welcome-home-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.welcome-home-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.welcome-home-avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel, #f3f3f3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.welcome-home-userinfo {
  min-width: 0;
}

.welcome-home-name {
  font-weight: 600;
  font-size: var(--text-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-home-email {
  font-size: var(--text-sm);
  color: var(--text-muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-home-signout {
  font-size: var(--text-sm);
  padding: 6px 12px;
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--text-muted, #888);
  flex-shrink: 0;
}

.welcome-home-signout:hover,
.welcome-home-signout:focus-visible {
  background: var(--panel);
  color: var(--ink);
}

.welcome-home-new-round {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: var(--text-md);
  font-weight: 600;
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
}

.welcome-home-new-round:hover,
.welcome-home-new-round:focus-visible {
  filter: brightness(1.08);
}

.welcome-home-primary-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.welcome-home-rounds-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.welcome-home-rounds-scroll {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow-x: hidden;
  width: 100%;
}

/* Default Course chip: a slim preference/setting strip, intentionally
   different from .home-round-card (the recent-rounds list below it) so a
   user reads it as a SETTING, not as another round-history item.
   Visual diffs vs. round cards:
     - Pill-shaped (fully rounded ends) vs. round cards' 10px radius
     - Accent-tinted left bar + transparent body vs. solid panel bg
     - Single-row inline layout vs. cards' two-line stacked layout
     - Smaller min-height, no shadow */
.welcome-home-default-course-btn {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  border: 1.5px dashed rgba(74, 158, 255, 0.55);
  border-radius: 18px;
  background: transparent;
  box-sizing: border-box;
  text-align: left;
  min-width: 0;
  position: relative;
  flex-wrap: wrap;
  row-gap: 4px;
}

.welcome-home-default-course-btn::before {
  /* Accent dot on the left edge — small but distinctive marker so the
     element reads as a "setting" rather than another card. */
  content: '';
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent, #4a9eff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.18);
}

.welcome-home-default-course-btn:hover,
.welcome-home-default-course-btn:focus-visible {
  border-style: solid;
  border-color: rgba(74, 158, 255, 0.85);
  background: rgba(74, 158, 255, 0.06);
}

.welcome-home-default-course-btn__title {
  flex-shrink: 0;
  font-size: var(--text-xs, 11px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
}

.welcome-home-default-course-btn__value {
  flex: 1 1 140px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-home-default-course-btn__cta {
  flex-shrink: 0;
  font-size: var(--text-xs, 11px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent, #2563eb);
  margin-left: auto;
}

/* Narrow widths: title + value + CTA can't all fit on one line at the
   large font-size scale (~19px for --text-xs). Stack the title above the
   value, keep CTA on the right of the value row — keeps the pill compact
   without clipping any of the three labels off-screen. */
@media (max-width: 480px) {
  .welcome-home-default-course-btn {
    align-items: flex-start;
    padding: 10px 14px;
    border-radius: 14px;
  }

  .welcome-home-default-course-btn__title {
    flex: 1 1 100%;
    order: 1;
    font-size: 11px;
    margin-left: 18px;
  }

  .welcome-home-default-course-btn::before {
    order: 2;
    margin-top: 2px;
  }

  .welcome-home-default-course-btn__value {
    order: 3;
    flex: 1 1 auto;
    font-size: var(--text-sm);
  }

  .welcome-home-default-course-btn__cta {
    order: 4;
    align-self: center;
  }
}

.welcome-home-rounds-label {
  font-size: var(--text-md);
  font-weight: 600;
  color: color-mix(in srgb, var(--ink) 78%, var(--text-muted, #888) 22%);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.welcome-home-rounds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow-x: hidden;
  width: 100%;
}

.welcome-home-rounds-empty,
.welcome-home-rounds-loading {
  font-size: var(--text-sm);
  color: var(--text-muted, #888);
  padding: 16px 0;
  text-align: center;
}

.home-round-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-align: left;
  overflow: hidden;
}

.home-round-card:hover,
.home-round-card:focus-visible {
  background: var(--panel-alt);
  border-color: var(--accent, #2563eb);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.home-round-card__info {
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.home-round-card__name {
  font-weight: 700;
  font-size: var(--text-md);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
  text-align: left;
}

.home-round-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: color-mix(in srgb, var(--ink) 60%, var(--text-muted, #888) 40%);
  margin-top: 2px;
  line-height: 1.35;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.home-round-card__course,
.home-round-card__date {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.home-round-card__dot {
  opacity: 0.7;
  flex: 0 0 auto;
}

.home-round-card__open {
  font-size: var(--text-sm);
  color: var(--accent, #2563eb);
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.welcome-home-skip {
  background: transparent;
  color: color-mix(in srgb, var(--ink) 62%, var(--text-muted, #888) 38%);
  border: 1.5px solid var(--line);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  min-height: 42px;
  flex: 0 0 auto;
}

.welcome-home-theme-toggle {
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 999px;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  flex: 0 0 auto;
}

.welcome-home-theme-toggle__label {
  line-height: 1;
}

.welcome-home-theme-toggle .icon-theme-moon {
  display: none;
}

:root[data-theme="light"] .welcome-home-theme-toggle .icon-theme-sun {
  display: none;
}

:root[data-theme="light"] .welcome-home-theme-toggle .icon-theme-moon {
  display: inline-block;
}

.cloud-default-course-manage-btn {
  width: 100%;
  justify-content: flex-start;
  padding-left: 10px;
  border-style: dashed;
}

#cloudDefaultCourseLabel {
  font-size: var(--text-sm);
  color: color-mix(in srgb, var(--ink) 70%, var(--text-muted, #888) 30%);
}

.welcome-home-skip:hover,
.welcome-home-skip:focus-visible {
  color: var(--ink);
  background: var(--panel);
}

.welcome-home-theme-toggle:hover,
.welcome-home-theme-toggle:focus-visible {
  filter: brightness(1.04);
}

@media (min-width: 1024px) {
  .welcome-card--home {
    max-width: min(1120px, 95vw);
    width: min(1120px, 95vw);
    text-align: left;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    grid-template-areas:
      'top top'
      'brand header'
      'actions rounds'
      'footer footer';
    column-gap: 20px;
    row-gap: 14px;
    align-items: start;
    align-content: start;
    max-height: 90dvh;
    min-height: min(76dvh, 760px);
    padding: 8px 4px 10px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-top-actions {
    grid-area: top;
    padding: 2px 0;
  }

  .welcome-card--home .welcome-home-brand {
    grid-area: brand;
    margin: 0;
    padding: 2px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-header {
    grid-area: header;
    padding: 2px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-primary-actions {
    grid-area: actions;
    gap: 12px;
    align-content: start;
    padding: 2px 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-rounds-wrap {
    grid-area: rounds;
    min-height: 0;
    padding: 0 4px 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-rounds-scroll {
    min-height: 0;
    max-height: min(72dvh, 780px);
    overflow-y: auto;
    padding-right: 2px;
  }

  .welcome-card--home .welcome-home-skip {
    justify-self: start;
  }

  .welcome-card--home .welcome-version {
    grid-area: footer;
    justify-self: end;
    align-self: center;
    margin-top: 4px;
  }

  .welcome-card--home .home-round-card {
    padding: 12px 14px;
    border-radius: 10px;
    box-shadow: none;
  }

  .welcome-card--home .welcome-home-rounds-label {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 2px 10px;
    background: linear-gradient(to bottom, var(--bg) 78%, transparent);
  }

  .welcome-card--home .welcome-home-rounds-list {
    gap: 10px;
  }

  .welcome-card--home .welcome-home-new-round {
    justify-content: flex-start;
    text-align: left;
    padding-left: 16px;
  }
}

/* Header sticky sign-in chip */
.header-signin-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: var(--text-xs, 11px);
  font-weight: 600;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 20px;
  white-space: nowrap;
  margin-left: auto;
  cursor: pointer;
}

.header-signin-chip:hover,
.header-signin-chip:focus-visible {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.header-signin-chip.is-account {
  padding: 5px 12px;
  background: #e6f4ea;
  color: #1a6632;
  border-color: #a8d5b5;
}

.header-signin-chip.is-account:hover,
.header-signin-chip.is-account:focus-visible {
  background: #d4edda;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

@media (prefers-color-scheme: dark) {
  .header-signin-chip {
    background: var(--surface, #1e1e1e);
    color: var(--ink);
    border-color: var(--line);
  }

  .header-signin-chip:hover,
  .header-signin-chip:focus-visible {
    background: var(--panel, #2a2a2a);
  }

  .header-signin-chip.is-account {
    background: rgba(52, 168, 83, 0.15);
    color: #6fcf97;
    border-color: rgba(52, 168, 83, 0.3);
  }

  .header-signin-chip.is-account:hover,
  .header-signin-chip.is-account:focus-visible {
    background: rgba(52, 168, 83, 0.22);
  }

  .home-round-card {
    background: var(--surface, #1e1e1e);
  }

  .home-round-card:hover,
  .home-round-card:focus-visible {
    background: var(--panel, #2a2a2a);
  }
}

/* =========================================================================
   Light theme overrides — moved from light-theme-overrides.css
   ========================================================================= */

:root[data-theme="light"] .welcome-overlay {
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, rgba(100, 116, 139, 0.12), transparent),
    radial-gradient(ellipse 55% 48% at 88% 12%, rgba(71, 85, 105, 0.09), transparent),
    radial-gradient(ellipse 65% 50% at 78% 85%, rgba(148, 163, 184, 0.10), transparent),
    radial-gradient(ellipse 50% 42% at 20% 88%, rgba(100, 116, 139, 0.08), transparent),
    var(--bg);
}

:root[data-theme="light"] .home-round-card {
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 0 0 0 transparent;
}

:root[data-theme="light"] .home-round-card:hover,
:root[data-theme="light"] .home-round-card:focus-visible {
  background: #f5f8ff;
  border-color: var(--accent, #18bc9c);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.09);
}

/* In app light mode, always use white cards regardless of system dark preference */
:root[data-theme="light"] .home-round-card {
  background: #ffffff;
  color: var(--ink, #212529);
  border-color: var(--line, #b7c2cd);
}

:root[data-theme="light"] .home-round-card:hover,
:root[data-theme="light"] .home-round-card:focus-visible {
  background: #f5f7f9;
  border-color: var(--accent, #18bc9c);
}