/* Cross-page enhancements: progress hub, HLD drill, a11y, loading */

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 10000;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
}

.sheet-loading {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 0 16px;
  font-family: "JetBrains Mono", monospace;
}

/* Progress hub */
.csd-hub {
  margin: 0 24px 28px;
  padding: 20px 22px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.csd-hub__head h2 {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--fg);
  margin: 0 0 6px;
}

.csd-hub__sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}

.csd-hub__overall {
  margin-bottom: 16px;
}

.csd-hub__overall-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.csd-hub__track {
  height: 8px;
  background: var(--code-bg);
  border-radius: 4px;
  overflow: hidden;
}

.csd-hub__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  border-radius: 4px;
  transition: width 0.35s ease;
}

.csd-hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.csd-hub__row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

.csd-hub__row:hover,
.csd-hub__row:focus-visible {
  border-color: var(--accent);
  background: var(--blue-dim);
  color: var(--fg);
}

.csd-hub__row:hover .csd-hub__name,
.csd-hub__row:hover .csd-hub__meta,
.csd-hub__row:hover .csd-hub__pct {
  color: var(--fg);
}

.csd-hub__row--meta {
  grid-template-columns: 1fr auto;
}

.csd-hub__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.csd-hub__meta {
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
}

.csd-hub__pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* HLD drill */
.csd-drill {
  margin: 0 24px 32px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--blue-dim) 0%, var(--bg2) 55%);
}

.csd-drill__head h2 {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--fg);
}

.csd-drill__sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.csd-drill__prompt {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--fg);
  padding: 16px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  min-height: 4rem;
}

.csd-drill__timer {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
}

.csd-drill__timer--done {
  color: var(--green);
}

.csd-drill__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button.csd-drill__btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  cursor: pointer;
}

button.csd-drill__btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.csd-drill__btn--primary:hover,
button.csd-drill__btn--primary:focus-visible {
  background: var(--accent-hover);
  color: #fff;
}

button.csd-drill__btn:hover,
button.csd-drill__btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--blue-dim);
}

/* LLD study bar */
.lld-study-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-card, var(--bg2));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.lld-study-bar__label {
  color: var(--text-muted, var(--muted));
  font-weight: 600;
}

.lld-study-bar__time {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--accent);
}

button.lld-study-bar__btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.lld-study-bar__btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary, var(--fg));
}

button.lld-study-bar__btn:hover,
button.lld-study-bar__btn:focus-visible {
  background: var(--accent-hover);
  color: #fff;
}

button.lld-study-bar__btn--ghost:hover,
button.lld-study-bar__btn--ghost:focus-visible {
  background: var(--accent-glow, var(--blue-dim));
  color: var(--accent);
  border-color: var(--accent);
}

.lld-study-bar__hint {
  color: var(--text-dim, var(--muted));
  margin-left: auto;
}

.lld-study-bar__hint kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

@media (max-width: 768px) {
  .csd-hub,
  .csd-drill {
    margin-left: 16px;
    margin-right: 16px;
  }

  .csd-hub__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .lld-study-bar__hint {
    width: 100%;
    margin-left: 0;
  }
}

/* LLD page uses inline tokens — bridge for study bar */
.lld-study-bar {
  --fg: var(--text-primary, #e6edf3);
  --muted: var(--text-muted, #555d68);
  --bg2: var(--bg-card, #111820);
  --bg-elevated: var(--bg-card-alt, #151d28);
  --border: var(--border, #1e2a3a);
  --border-light: var(--border-light, #2a3a4e);
  --blue-dim: var(--accent-glow, rgba(49, 120, 198, 0.1));
  --accent-hover: var(--accent-hover, #4b8fdb);
}

@media (max-width: 640px) {
  .csd-drill__actions,
  .csd-hub__grid {
    flex-direction: column;
    display: flex;
  }

  .csd-hub__grid {
    display: flex;
  }
}
