:root {
  --bg: #101113;
  --panel: rgba(255, 255, 255, 0.065);
  --panel-strong: rgba(255, 255, 255, 0.11);
  --line: rgba(214, 224, 255, 0.16);
  --text: #f4f5fb;
  --muted: #aeb6cb;
  --primary: #a9c3ff;
  --blue: #4d8eff;
  --green: #4edea3;
  --gold: #ffb95f;
  --red: #ff7d72;
  --radius: 14px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="ocean"] {
  --bg: #071a22;
  --panel: rgba(116, 203, 218, 0.095);
  --panel-strong: rgba(116, 203, 218, 0.16);
  --line: rgba(147, 221, 224, 0.24);
  --text: #eefcff;
  --muted: #a8c9d2;
  --primary: #8ee7ff;
  --blue: #2bb7d6;
  --green: #6ff0bf;
  --gold: #ffd166;
  --red: #ff8d8d;
}

:root[data-theme="classic"] {
  --bg: #f4f1ea;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(47, 49, 54, 0.18);
  --text: #202226;
  --muted: #666b78;
  --primary: #315fbd;
  --blue: #315fbd;
  --green: #147b56;
  --gold: #a86404;
  --red: #b94040;
  color-scheme: light;
}

:root[data-theme="cute"] {
  --bg: #20151d;
  --panel: rgba(255, 197, 221, 0.12);
  --panel-strong: rgba(255, 197, 221, 0.2);
  --line: rgba(255, 211, 229, 0.24);
  --text: #fff4fa;
  --muted: #e5bfd0;
  --primary: #ffc5dd;
  --blue: #b8c7ff;
  --green: #7cf0bb;
  --gold: #ffd166;
  --red: #ff8aa0;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(77, 142, 255, 0.18), transparent 30rem),
    linear-gradient(180deg, #171719 0%, #0c0d0f 100%);
  color: var(--text);
}

:root[data-theme="classic"] body {
  background:
    radial-gradient(circle at 50% 0%, rgba(49, 95, 189, 0.16), transparent 28rem),
    linear-gradient(180deg, #fffaf0 0%, #ebe7df 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 820px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0 12px;
  background: linear-gradient(180deg, rgba(16, 17, 19, 0.98), rgba(16, 17, 19, 0.72));
  backdrop-filter: blur(18px);
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-status {
  position: sticky;
  top: 70px;
  z-index: 6;
  margin: 0 0 10px;
  border: 1px solid rgba(78, 222, 163, 0.34);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(78, 222, 163, 0.11);
  color: var(--green);
}

.app-status.error {
  border-color: rgba(255, 125, 114, 0.42);
  background: rgba(255, 125, 114, 0.11);
  color: var(--red);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  letter-spacing: 0;
}

h1 {
  font-size: 1.12rem;
}

h2 {
  font-size: 1.65rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-button,
.language-select,
.logout-button {
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--primary);
}

.logout-button {
  padding: 0 12px;
  font-weight: 800;
}

.language-select {
  padding: 0 10px;
}

.view {
  display: none;
  animation: rise 180ms ease-out;
}

.view.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-view {
  padding-top: 36px;
  text-align: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border: 1px solid rgba(169, 195, 255, 0.38);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(169, 195, 255, 0.16), rgba(78, 222, 163, 0.07));
  color: var(--primary);
  font-weight: 800;
}

.auth-view p {
  max-width: 23rem;
  margin: 10px auto 22px;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.segmented button {
  border: 0;
  border-radius: 9px;
  padding: 12px 10px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--primary);
  color: #082756;
  font-weight: 800;
}

.form-card,
.staff-panel,
.metric-card,
.exercise-card,
.notice-card,
.profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  text-align: left;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(174, 182, 203, 0.34);
  border-radius: 10px;
  padding: 0 13px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
}

.hidden {
  display: none;
}

.primary-button,
.ghost-button {
  min-height: 50px;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: linear-gradient(180deg, #bcd0ff, #8db0ff);
  color: #082756;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

.full {
  width: 100%;
}

.helper {
  font-size: 0.84rem;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.metric-card {
  padding: 15px;
}

.metric-card span,
.readouts span {
  display: block;
  color: var(--muted);
  font-size: 0.77rem;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 7px;
  color: var(--green);
  font-size: 1.55rem;
}

.staff-panel {
  padding: 16px;
}

.staff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.status-pill {
  border: 1px solid rgba(78, 222, 163, 0.36);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(78, 222, 163, 0.1);
  color: var(--green);
  font-size: 0.76rem;
}

.staff {
  position: relative;
  height: 44vh;
  min-height: 300px;
  max-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    linear-gradient(to bottom, transparent 18%, rgba(255,255,255,0.12) 18.4%, transparent 18.8%),
    linear-gradient(to bottom, transparent 34%, rgba(255,255,255,0.12) 34.4%, transparent 34.8%),
    linear-gradient(to bottom, transparent 50%, rgba(255,255,255,0.12) 50.4%, transparent 50.8%),
    linear-gradient(to bottom, transparent 66%, rgba(255,255,255,0.12) 66.4%, transparent 66.8%),
    linear-gradient(to bottom, transparent 82%, rgba(255,255,255,0.12) 82.4%, transparent 82.8%),
    rgba(0, 0, 0, 0.18);
}

.target-band {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 49%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(78, 222, 163, 0.55), transparent);
}

.pitch-dot {
  position: absolute;
  left: calc(50% - 18px);
  top: calc(50% - 18px);
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 22px rgba(78, 222, 163, 0.72);
  transition: top 160ms ease-out, background 160ms ease-out, box-shadow 160ms ease-out;
}

.note-label {
  position: absolute;
  right: 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.n1 { top: 18%; }
.n2 { top: 49%; }
.n3 { top: 78%; }

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 10px;
  margin-top: 12px;
}

.readouts article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.readouts strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
}

.action-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.exercise-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.training-runner {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--panel);
}

.exercise-timer {
  color: var(--green);
  font-size: 2.2rem;
  font-weight: 900;
}

.exercise-progress {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.exercise-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 120ms linear;
}

#exerciseFeedback {
  color: var(--muted);
}

.exercise-card {
  padding: 16px;
}

.exercise-card span {
  color: var(--gold);
  font-weight: 900;
}

.exercise-card p,
.exercise-card small,
.notice-card p,
.profile-card p {
  margin-top: 6px;
  color: var(--muted);
}

.exercise-card.active {
  border-color: rgba(78, 222, 163, 0.5);
}

.notice-card {
  display: flex;
  gap: 12px;
  margin: 14px 0;
  padding: 16px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--green);
  box-shadow: 0 0 14px rgba(78, 222, 163, 0.75);
}

.leaderboard {
  display: grid;
  gap: 10px;
}

.leader-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.profile-card {
  padding: 22px 16px;
  text-align: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  background-position: center;
  background-size: cover;
  color: #051019;
  font-weight: 900;
  overflow: hidden;
}

.compact-form {
  margin-top: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-users {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-user-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-user-card p {
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-user-card .two-col {
  align-items: end;
}

.history-panel {
  margin-top: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.small-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.history-item p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 820px);
  transform: translateX(-50%);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(25, 25, 27, 0.92);
  backdrop-filter: blur(18px);
}

.bottom-nav.admin-enabled {
  grid-template-columns: repeat(6, 1fr);
}

.bottom-nav button {
  display: grid;
  gap: 3px;
  place-items: center;
  min-height: 58px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.bottom-nav button.active {
  background: rgba(78, 222, 163, 0.14);
  color: var(--green);
}

.bottom-nav span {
  font-weight: 800;
}

.help-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.help-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--panel);
}

.help-card p {
  margin-top: 8px;
  color: var(--muted);
}

@media (min-width: 760px) {
  .app-shell {
    padding-inline: 28px;
  }

  main {
    display: block;
  }

  .action-grid {
    grid-template-columns: 1fr 1fr;
  }

  .staff {
    height: 420px;
  }
}
