:root {
  --bg: #070b14;
  --panel: #101a2c;
  --line: #2b3d5d;
  --text: #ecf2ff;
  --muted: #93a6c9;
  --accent: #46d3ff;
  --accent-2: #8c66ff;
  --success: #31d98b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top right, #101a36, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(70, 211, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(70, 211, 255, 0.06) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
  z-index: -1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.brand {
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 10px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  padding: 8px 12px;
  border-radius: 10px;
  transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--line);
  color: var(--text);
  background: rgba(70, 211, 255, 0.08);
}

.page {
  width: min(1100px, 92%);
  margin: 28px auto 40px;
  display: grid;
  gap: 20px;
}

.home-page {
  grid-template-columns: 1fr;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 26, 44, 0.94), rgba(16, 26, 44, 0.78));
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02), 0 12px 40px rgba(0, 0, 0, 0.35);
}

h1,
h2 {
  margin: 0 0 12px;
}

.muted {
  margin-top: 0;
  color: var(--muted);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 20px;
}

.time-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  padding: 26px 14px;
  background: rgba(140, 102, 255, 0.08);
}

.time-box span {
  display: block;
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
}

.time-box small {
  color: var(--muted);
  font-size: 1.05rem;
}

.countdown-panel {
  min-height: calc(100vh - 210px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.countdown-panel h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  text-align: center;
}

.xp-panel {
  margin-top: -4px;
}

.xp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.level-tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent);
  font-size: 0.9rem;
}

.progress {
  width: 100%;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(70, 211, 255, 0.6);
}

.button {
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  display: inline-block;
  background: linear-gradient(90deg, rgba(70, 211, 255, 0.2), rgba(140, 102, 255, 0.2));
  cursor: pointer;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.task-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #15223a;
  color: var(--text);
  text-align: left;
  padding: 12px;
  min-height: 90px;
}

.task-card .task-title {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.task-card .task-state {
  color: var(--muted);
}

.task-card.open {
  background: linear-gradient(140deg, rgba(70, 211, 255, 0.22), rgba(140, 102, 255, 0.22));
}

.task-card.passed {
  border-color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(49, 217, 139, 0.5);
}

.task-card.locked {
  filter: grayscale(1);
  opacity: 0.7;
}

.task-card--locked-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}

.task-card-locked-label {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.task-card.final-task {
  grid-column: 1 / -1;
  min-height: 140px;
  border-color: #ff7f3f;
  background: linear-gradient(135deg, rgba(255, 127, 63, 0.28), rgba(255, 60, 60, 0.26));
  box-shadow: 0 0 24px rgba(255, 127, 63, 0.24);
  animation: final-pulse 2s ease-in-out infinite;
}

.task-card.final-task .task-title {
  font-size: 1.25rem;
}

@keyframes final-pulse {
  0% {
    box-shadow: 0 0 16px rgba(255, 127, 63, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 34px rgba(255, 127, 63, 0.45);
    transform: scale(1.01);
  }
  100% {
    box-shadow: 0 0 16px rgba(255, 127, 63, 0.2);
    transform: scale(1);
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 12, 0.66);
}

.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 92%);
  background: #101a2f;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 18px;
  position: relative;
}

.modal-card--wide {
  width: min(760px, 94%);
}

.day1-text {
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 16px;
}

.day1-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.day1-photo-btn {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.day1-photo-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(70, 211, 255, 0.22);
}

.day1-photo-btn img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.input-label {
  display: block;
  margin: 10px 0 8px;
}

input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #09101f;
  color: var(--text);
  padding: 10px 12px;
  margin-bottom: 10px;
}

select,
textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #09101f;
  color: var(--text);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-family: inherit;
}

.message {
  min-height: 24px;
}

#appRoot {
  display: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 12, 0.92);
  padding: 18px;
}

.auth-cli {
  width: min(560px, 92%);
  border-radius: 18px;
  border: 1px solid rgba(43, 61, 93, 1);
  background: linear-gradient(180deg, rgba(8, 17, 37, 0.95), rgba(6, 12, 26, 0.82));
  box-shadow: 0 0 70px rgba(70, 211, 255, 0.12);
  padding: 18px 18px 16px;
}

.auth-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.auth-prompt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  color: var(--text);
  margin-bottom: 12px;
  font-size: 0.98rem;
}

.auth-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #09101f;
  color: var(--text);
  padding: 12px 12px;
  font-size: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.auth-button {
  margin-top: 12px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(70, 211, 255, 0.22), rgba(140, 102, 255, 0.22));
  color: var(--text);
  padding: 12px 14px;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.12s ease;
}

.auth-button:hover {
  transform: translateY(-1px);
}

.auth-error {
  margin-top: 10px;
  min-height: 22px;
  color: #ff9f7a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.profile-page {
  grid-template-columns: 1fr 1fr;
}

.character-card {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(70, 211, 255, 0.25), rgba(140, 102, 255, 0.25));
  font-weight: 700;
}

.achievements {
  display: grid;
  gap: 10px;
}

.achievement {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}

.achievement.unlocked {
  border-color: var(--success);
}

/* --- Персонаж: сцена с пузырьками достижений --- */
.profile-page-v2 {
  grid-template-columns: 1fr;
  max-width: 960px;
}

.profile-scene-panel {
  overflow: hidden;
}

.scene-hint {
  margin-bottom: 16px;
}

.character-scene {
  position: relative;
  width: 100%;
  min-height: min(72vh, 560px);
  margin: 8px 0 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(70, 211, 255, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 50% at 70% 30%, rgba(140, 102, 255, 0.1), transparent 50%),
    rgba(8, 14, 28, 0.6);
  overflow: hidden;
}

.achievement-bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.achievement-bubble {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  max-width: min(85vw, 260px);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1.25;
  color: var(--text);
  border: 1px solid rgba(70, 211, 255, 0.35);
  background: linear-gradient(135deg, rgba(16, 26, 44, 0.92), rgba(70, 211, 255, 0.12));
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  will-change: transform;
  white-space: normal;
  text-align: center;
}

.character-portrait-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.character-portrait-placeholder {
  pointer-events: auto;
  width: min(52vw, 280px);
  aspect-ratio: 3 / 4;
  max-height: 85%;
  border-radius: 20px;
  border: 2px dashed rgba(70, 211, 255, 0.45);
  background: linear-gradient(160deg, rgba(70, 211, 255, 0.12), rgba(140, 102, 255, 0.1));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 16px;
  box-shadow: 0 0 40px rgba(70, 211, 255, 0.12);
}

.portrait-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.portrait-sub {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-meta {
  text-align: center;
}

.profile-name {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

@media (max-width: 1100px) {
  .roadmap-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .roadmap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day1-photos {
    grid-template-columns: 1fr;
  }

  .profile-page {
    grid-template-columns: 1fr;
  }

  .countdown {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
    gap: 12px;
  }

  .countdown-panel {
    min-height: auto;
  }
}
