:root {
  color-scheme: dark;
  --bg: #000;
  --grid-bg: #000814;
  --panel: rgba(0, 8, 18, 0.9);
  --panel-strong: rgba(0, 14, 30, 0.96);
  --panel-soft: rgba(0, 5, 12, 0.88);
  --border: rgba(0, 255, 255, 0.42);
  --border-strong: rgba(0, 255, 255, 0.82);
  --text: #e7ffff;
  --muted: rgba(211, 255, 255, 0.68);
  --quiet: rgba(0, 255, 255, 0.45);
  --primary: #00ffff;
  --primary-strong: #9dffff;
  --green: #00ffcc;
  --accent-blue: #006dff;
  --red: #ff3030;
  --violet: #cc00ff;
  --shadow: 0 0 22px rgba(0, 255, 255, 0.32), 0 0 78px rgba(0, 102, 255, 0.18), 0 20px 64px rgba(0, 0, 0, 0.72);
  --font-display: "Courier New", Courier, monospace;
  font-family: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(0, 40, 72, 0.52) 0%, rgba(0, 8, 20, 0.76) 34%, #000 100%);
  overflow-x: hidden;
  text-transform: uppercase;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  inset: -48% -30%;
  background:
    linear-gradient(rgba(0, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(rgba(0, 115, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 115, 255, 0.18) 1px, transparent 1px);
  background-position: 0 0, 0 0, 0 0, 0 0;
  background-size: 48px 48px, 48px 48px, 240px 240px, 240px 240px;
  opacity: 0.86;
  transform: perspective(760px) rotateX(62deg) translateY(6vh);
  transform-origin: center center;
  animation: gridShift 16s linear infinite;
}

body::after {
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(0, 255, 255, 0.08), transparent 18%, transparent 82%, rgba(255, 48, 48, 0.06)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.66)),
    repeating-linear-gradient(0deg, transparent 0, transparent 2px, rgba(0, 0, 0, 0.36) 2px, rgba(0, 0, 0, 0.36) 4px);
}

@keyframes gridShift {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  to {
    background-position: 0 48px, 48px 0, 0 240px, 240px 0;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  white-space: nowrap;
}

a {
  color: var(--primary-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
}

.auth-panel,
.panel,
.modal-card {
  background:
    linear-gradient(180deg, rgba(0, 18, 34, 0.94), rgba(0, 3, 10, 0.94)),
    var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.auth-panel {
  border-radius: 8px;
  padding: 32px;
  box-shadow:
    0 0 24px rgba(0, 255, 255, 0.38),
    0 0 88px rgba(0, 102, 255, 0.24),
    inset 0 0 24px rgba(0, 255, 255, 0.14);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--accent-blue), 0 0 24px rgba(0, 109, 255, 0.62);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.auth-panel h1 {
  margin-bottom: 24px;
  font-size: 1.65rem;
}

h1,
h2,
h3,
h4,
.button,
.field span,
.field-title {
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1,
h2 {
  color: var(--primary-strong);
  text-shadow: 0 0 10px var(--primary), 0 0 34px rgba(0, 102, 255, 0.82);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field-title {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.fieldset {
  margin: 0;
  border: 0;
  padding: 0;
}

.fieldset legend {
  padding: 0;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.check-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0, 255, 255, 0.24);
  border-radius: 6px;
  background: rgba(0, 4, 12, 0.72);
  padding: 8px 10px;
  color: var(--muted);
}

.check-row input {
  width: auto;
  accent-color: var(--primary);
}

.check-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 2, 8, 0.92);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 0 14px rgba(0, 255, 255, 0.12);
  text-transform: none;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--primary) 50%),
    linear-gradient(135deg, var(--primary) 50%, transparent 50%),
    rgba(0, 2, 8, 0.92);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 11px) 50%,
    0 0;
  background-size: 6px 6px, 6px 6px, auto;
  background-repeat: no-repeat;
  padding-right: 34px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.2), 0 0 22px rgba(0, 255, 255, 0.28), inset 0 0 16px rgba(0, 255, 255, 0.16);
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary-strong);
  background: rgba(0, 8, 18, 0.8);
  box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.12), 0 0 18px rgba(0, 255, 255, 0.24);
  text-transform: uppercase;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, filter 0.16s ease;
}

.button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: inset 0 0 22px rgba(0, 255, 255, 0.22), 0 0 30px rgba(0, 255, 255, 0.46);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.primary {
  color: var(--primary-strong);
  border-color: var(--primary);
  background: rgba(0, 255, 255, 0.14);
  box-shadow: 0 0 24px rgba(0, 255, 255, 0.46), inset 0 0 24px rgba(0, 255, 255, 0.16);
}

.button.secondary {
  color: #8fc4ff;
  border-color: rgba(0, 109, 255, 0.78);
  background: rgba(0, 109, 255, 0.14);
  box-shadow: 0 0 20px rgba(0, 109, 255, 0.36), inset 0 0 18px rgba(0, 109, 255, 0.14);
}

.button.subtle {
  color: var(--primary-strong);
  border-color: var(--border-strong);
  background: transparent;
}

.button.ghost {
  color: var(--red);
  border-color: rgba(255, 48, 48, 0.58);
  background: rgba(255, 48, 48, 0.08);
  box-shadow: 0 0 16px rgba(255, 48, 48, 0.22);
}

.button.danger {
  color: var(--red);
  border-color: rgba(255, 48, 48, 0.72);
  background: rgba(255, 48, 48, 0.12);
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.status-message,
.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-message.error,
.notice.error {
  color: var(--red);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-strong);
  background: rgba(0, 3, 10, 0.92);
  padding: 18px 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 38px rgba(0, 255, 255, 0.18);
}

.app-header::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: -1px;
  left: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), rgba(0, 109, 255, 0.95), transparent);
  opacity: 0.8;
}

.app-header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.app-header .eyebrow {
  margin-bottom: 4px;
  color: var(--primary-strong);
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 0.95;
  text-shadow: 0 0 10px var(--primary), 0 0 34px rgba(0, 102, 255, 0.82);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(0, 255, 255, 0.32);
  border-radius: 6px;
  background: rgba(0, 4, 12, 0.72);
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.26);
}

.nav-link:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  text-decoration: none;
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.22);
}

.nav-link.active {
  border-color: var(--primary);
  background: rgba(0, 255, 255, 0.12);
  color: var(--primary-strong);
  box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.12), 0 0 22px rgba(0, 255, 255, 0.24);
}

.user-label {
  max-width: min(40vw, 320px);
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
}

.dashboard-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 18px;
}

.inline-search {
  flex: 1 1 320px;
  max-width: 520px;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: rgba(0, 8, 18, 0.92);
  padding: 12px 14px;
  color: var(--muted);
  box-shadow: inset 0 0 18px rgba(0, 255, 255, 0.1);
}

.overview-panel {
  display: grid;
  gap: 16px;
}

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

.stat-card {
  min-width: 0;
  border: 1px solid rgba(0, 255, 255, 0.34);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(0, 109, 255, 0.12), transparent),
    rgba(0, 4, 12, 0.78);
  padding: 12px;
  box-shadow: inset 0 0 16px rgba(0, 255, 255, 0.08), 0 0 18px rgba(0, 109, 255, 0.12);
}

.stat-card strong {
  display: block;
  overflow: hidden;
  color: var(--primary-strong);
  font-size: 1.34rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.62);
  white-space: nowrap;
}

.stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.search-field {
  max-width: 520px;
}

.panel {
  margin-bottom: 18px;
  border-radius: 8px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 20px rgba(0, 255, 255, 0.26),
    0 0 72px rgba(0, 92, 255, 0.2),
    inset 0 0 24px rgba(0, 255, 255, 0.12);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 255, 255, 0.2), transparent 22%, transparent 78%, rgba(0, 109, 255, 0.14)),
    linear-gradient(180deg, rgba(0, 255, 255, 0.1), transparent 38%);
  opacity: 0.72;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel-header,
.item-header,
.item-actions,
.semester-actions,
.game-layout {
  display: flex;
  gap: 14px;
}

.panel-header {
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.panel h2 {
  margin: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.panel h3 {
  margin-bottom: 8px;
  font-size: 0.96rem;
}

.panel-meta,
.item-meta,
.muted {
  color: var(--muted);
}

.panel-meta {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.item-list {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.attention-list {
  display: grid;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.empty-state {
  margin: 0;
  color: var(--quiet);
}

.item-card,
.semester-card,
.docs-card,
.notes-card,
.attention-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 3, 10, 0.78);
  box-shadow: inset 0 0 18px rgba(0, 255, 255, 0.1);
}

.item-card {
  padding: 14px;
  border-left-color: var(--primary);
}

.attention-card {
  padding: 14px;
  border-left-color: var(--red);
}

.item-header {
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.attention-detail {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-transform: none;
}

.item-title {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--text);
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.36);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(0, 255, 255, 0.34);
  border-radius: 4px;
  background: rgba(0, 255, 255, 0.08);
  padding: 3px 8px;
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.42);
}

.tag.info {
  border-color: rgba(0, 109, 255, 0.52);
  background: rgba(0, 109, 255, 0.14);
  color: #8fc4ff;
}

.tag.success {
  border-color: rgba(0, 255, 204, 0.48);
  background: rgba(0, 255, 204, 0.12);
  color: var(--green);
}

.tag.danger {
  border-color: rgba(255, 48, 48, 0.62);
  background: rgba(255, 48, 48, 0.12);
  color: var(--red);
}

.item-actions,
.semester-actions {
  flex-wrap: wrap;
  align-items: center;
}

.progress-list,
.semester-list,
.docs-list,
.leaderboard {
  margin: 0;
  padding-left: 1.2rem;
}

.progress-list {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.progress-list li {
  color: var(--muted);
}

.progress-list li.done {
  color: var(--green);
  text-decoration: line-through;
  text-shadow: 0 0 8px rgba(0, 255, 204, 0.42);
}

.progress-list li.active {
  color: var(--primary-strong);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.58);
}

.meta-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.meta-box {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 2, 8, 0.72);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 0.86rem;
  box-shadow: inset 0 0 12px rgba(0, 255, 255, 0.08);
}

.meta-box strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
}

.semester-card,
.docs-card,
.notes-card {
  margin-top: 10px;
  padding: 12px;
}

.semester-card h4,
.docs-card h4,
.notes-card h4 {
  margin-bottom: 8px;
}

.semester-list {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

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

.notes-header h4 {
  margin: 0;
}

.notes-list {
  display: grid;
  gap: 8px;
}

.note-card {
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(0, 2, 8, 0.72);
  padding: 10px;
  box-shadow: inset 0 0 14px rgba(0, 255, 255, 0.08);
}

.note-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.note-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.note-body {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-transform: none;
  white-space: pre-wrap;
}

.note-action {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border-left: 2px solid var(--primary);
  background: rgba(0, 255, 255, 0.08);
  padding: 8px 10px;
}

.note-action strong {
  color: var(--primary-strong);
  font-size: 0.76rem;
}

.note-action span {
  color: var(--text);
  overflow-wrap: anywhere;
  text-transform: none;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.game-layout {
  align-items: flex-start;
  flex-wrap: wrap;
}

.game-canvas {
  width: min(100%, 520px);
  aspect-ratio: 13 / 8;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background:
    linear-gradient(rgba(0, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.16) 1px, transparent 1px),
    #000510;
  background-size: 20px 20px;
  box-shadow: 0 0 28px rgba(0, 255, 255, 0.42), inset 0 0 34px rgba(0, 255, 255, 0.16);
}

.leaderboards {
  display: grid;
  min-width: min(100%, 260px);
  flex: 1;
  gap: 16px;
}

.leaderboard {
  display: grid;
  gap: 6px;
  color: var(--muted);
  list-style: none;
  padding-left: 0;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(0, 4, 12, 0.76);
  padding: 4px 8px 4px 4px;
  box-shadow: inset 0 0 14px rgba(0, 255, 255, 0.08);
}

.leaderboard-rank {
  display: inline-grid;
  width: 24px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(0, 255, 255, 0.62);
  border-radius: 4px;
  color: var(--primary-strong);
  font-family: var(--font-display);
  font-size: 0.78rem;
  text-shadow: 0 0 8px var(--primary);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.14), 0 0 12px rgba(0, 255, 255, 0.2);
}

.leaderboard-pilot {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: #8fc4ff;
  font-family: var(--font-display);
  text-shadow: 0 0 8px rgba(0, 109, 255, 0.78), 0 0 22px rgba(0, 109, 255, 0.36);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(100%, 640px);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 8px;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border-strong);
  background: rgba(0, 6, 14, 0.96);
  padding: 16px 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 18px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.file-input {
  display: none;
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .header-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }

  .app-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-link {
    flex: 1 1 96px;
    justify-content: center;
  }

  .user-label {
    flex: 1 1 180px;
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-shell {
    padding: 16px;
  }

  .toolbar .button {
    flex: 1 1 150px;
  }

  .inline-search {
    flex-basis: 100%;
    max-width: none;
  }

  .panel,
  .auth-panel {
    padding: 18px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .search-field {
    max-width: none;
  }

  .button {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .stat-card strong {
    font-size: 1.16rem;
  }
}
