/* Reset */
* {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  background: #05060a;
  color: #d6d9e8;
  line-height: 1.6;
  min-height: 100vh;
  font-size: 14px;
  position: relative;
  overflow-x: hidden;
}

/* CRT scanlines overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.015) 0,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 100;
}

/* Glow line at the top */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #818cf8, transparent);
  opacity: 0.4;
  pointer-events: none;
  z-index: 99;
}

/* Headings */
h1 {
  margin: 0;
  font-weight: 600;
  font-size: 1.5rem;
}

h1::before {
  content: "$ ";
  color: #818cf8;
}

h1::after {
  content: "▊";
  color: #818cf8;
  margin-left: 4px;
  animation: blink 1.2s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

h2 {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

h2::before {
  content: "// ";
  color: #6b7088;
}

p {
  margin: 0;
}

.muted {
  color: #6b7088;
  font-size: 0.9rem;
}

.page-intro p.muted::before {
  content: "// ";
  color: #818cf8;
  opacity: 0.7;
}

/* Login page */
.Login-box {
  max-width: 400px;
  margin: 10vh auto;
  padding: 32px;
  background: #0b0d14;
  border: 1px solid #1f2433;
  border-radius: 4px;
  position: relative;
}

.Login-box::before {
  content: "┌─ auth.sh ──────────────────────";
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 0 8px;
  background: #05060a;
  font-size: 0.7rem;
  color: #818cf8;
  white-space: nowrap;
}

.Login-box h1 {
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.Login-box > p {
  color: #6b7088;
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.Login-box > p::before {
  content: "# ";
  color: #818cf8;
}

.Login-box input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #05060a;
  color: #a5b4fc;
  border: 1px solid #1f2433;
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.95rem;
}

.Login-box input::placeholder {
  color: #6b7088;
}

.Login-box input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 1px #818cf8, 0 0 16px rgba(99, 102, 241, 0.2);
}

.Login-box button {
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  background: transparent;
  color: #818cf8;
  border: 1px solid #818cf8;
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.Login-box button::before {
  content: "[ ";
  opacity: 0.6;
}

.Login-box button::after {
  content: " ]";
  opacity: 0.6;
}

.Login-box button:hover {
  background: #818cf8;
  color: #05060a;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.5);
}

#error-msg {
  color: #ef4444;
  min-height: 1.25rem;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* Site header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #1f2433;
  background: #05060a;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #818cf8, transparent);
  opacity: 0.3;
}

.brand {
  font-weight: 700;
  color: #818cf8;
  text-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.brand::before {
  content: "[ ";
  color: #6b7088;
}

.brand::after {
  content: " ]";
  color: #6b7088;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.greeting {
  color: #6b7088;
  font-size: 0.9rem;
}

.greeting::before {
  content: "user@reboot01:~$ ";
  color: #84cc16;
}

.greeting span {
  color: #a5b4fc;
  font-weight: 600;
}

/* Avatar */
.avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #818cf8;
  background: #0b0d14;
  border: 1px solid #818cf8;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
  user-select: none;
}

/* Skeleton shimmer */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, #11141d 0%, #2a3360 50%, #11141d 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  pointer-events: none;
}

.skeleton-text {
  min-width: 5ch;
}

.item-value.skeleton {
  display: block;
  height: 1.4rem;
  width: 70%;
}

/* Buttons */
.btn {
  padding: 6px 14px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-ghost {
  background: transparent;
  color: #d6d9e8;
  border: 1px solid #1f2433;
}

.btn-ghost::before {
  content: "[";
  color: #6b7088;
  margin-right: 5px;
}

.btn-ghost::after {
  content: "]";
  color: #6b7088;
  margin-left: 5px;
}

.btn-ghost:hover {
  border-color: #818cf8;
  color: #818cf8;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.btn-danger {
  background: transparent;
  color: #ef4444;
  border: 1px solid #ef4444;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-danger::before {
  content: "[ ";
  color: #ef4444;
  opacity: 0.6;
}

.btn-danger::after {
  content: " ]";
  color: #ef4444;
  opacity: 0.6;
}

.btn-danger:hover {
  background: #ef4444;
  color: #05060a;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.5);
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.page-intro {
  margin-bottom: 32px;
}

.page-intro h1 {
  margin-bottom: 4px;
}

/* Account card */
.account-card {
  background: #0b0d14;
  border: 1px solid #1f2433;
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 48px;
  position: relative;
}

.account-card::before {
  content: "┌─ account.json ─────────────────────────";
  position: absolute;
  top: -10px;
  left: 16px;
  padding: 0 8px;
  background: #05060a;
  font-size: 0.7rem;
  color: #818cf8;
  white-space: nowrap;
  overflow: hidden;
  max-width: 90%;
}

.card-label {
  font-size: 0.75rem;
  color: #6b7088;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card-label::before {
  content: "▶ ";
  color: #818cf8;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px 32px;
  margin-top: 16px;
}

.account-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-label {
  font-size: 0.75rem;
  color: #6b7088;
}

.item-label::before {
  content: "» ";
  color: #818cf8;
}

.item-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: #a5b4fc;
}

/* Stats / charts */
.stats-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.stats-header h2 {
  margin: 0;
}

.stats-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #1f2433;
}

.carousel-controls {
  display: flex;
  gap: 8px;
}

.carousel-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0d14;
  color: #818cf8;
  border: 1px solid #1f2433;
  border-radius: 2px;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.carousel-btn:hover {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #0b0d14;
  border-color: #1f2433;
  box-shadow: none;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.dot {
  width: 10px;
  height: 10px;
  border: 1px solid #1f2433;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.dot:hover {
  border-color: #818cf8;
}

.dot.active {
  background: #818cf8;
  border-color: #818cf8;
  width: 24px;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.chart-grid {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 24px;
  padding: 8px 8px 24px;
  margin: 0 -8px;
}

.chart-grid::-webkit-scrollbar {
  height: 8px;
}

.chart-grid::-webkit-scrollbar-thumb {
  background: #1f2433;
  border-radius: 4px;
}

.chart-grid::-webkit-scrollbar-thumb:hover {
  background: #4f46e5;
}

.chart-card {
  background: #0b0d14;
  border: 1px solid #1f2433;
  border-radius: 4px;
  padding: 24px;
  flex: 0 0 560px;
  max-width: 92%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.chart-card:hover {
  border-color: #818cf8;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.15);
}

.chart-card.compact {
  flex: 0 0 360px;
  max-width: 80%;
}

.chart-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chart-title::before {
  content: "> ";
  color: #6b7088;
}

.chart-desc {
  margin: 4px 0 16px;
  color: #6b7088;
  font-size: 0.85rem;
}

.chart-desc::before {
  content: "# ";
  color: #818cf8;
  opacity: 0.6;
}

.chart-area {
  margin-top: 16px;
  min-height: 280px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7088;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #1f2433;
  border-radius: 2px;
  padding: 16px;
  text-align: center;
  font-size: 0.9rem;
}

.chart-area.is-empty {
  border-style: dashed;
}

.chart-area.is-error {
  color: #ef4444;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.06);
}

.chart-area.is-loading {
  background: #11141d;
}

.chart-area svg {
  width: 100%;
  height: auto;
  max-height: 320px;
  display: block;
}

/* Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #1f2433;
  border-top-color: #818cf8;
  animation: spin 0.8s linear infinite;
}

/* Error banner */
.error-banner {
  margin-bottom: 24px;
  padding: 16px 24px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 2px;
  color: #fecaca;
  font-size: 0.95rem;
}

/* Focus outline */
:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}


/* ========== Tablet ========== */
@media (max-width: 900px) {
  .account-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========== Mobile ========== */
@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  .site-header {
    padding: 8px 16px;
    gap: 8px;
  }

  .header-right {
    gap: 8px;
  }

  .greeting {
    display: none;
  }

  .brand {
    font-size: 0.85rem;
  }

  .avatar {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .btn {
    padding: 8px 12px;
    font-size: 0.8rem;
    min-height: 36px;
  }

  .container {
    padding: 24px 16px 32px;
  }

  h1 {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 0.9rem;
  }

  .page-intro {
    margin-bottom: 24px;
  }

  .account-card {
    padding: 24px 16px;
    margin-bottom: 32px;
  }

  .account-card::before {
    content: "┌─ account.json";
    font-size: 0.65rem;
    left: 8px;
  }

  .account-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .item-value {
    font-size: 0.95rem;
  }

  .item-value.skeleton {
    width: 80%;
  }

  .chart-grid {
    gap: 16px;
    padding-bottom: 16px;
  }

  .chart-card,
  .chart-card.compact {
    padding: 16px;
    flex: 0 0 92vw;
    max-width: 480px;
  }

  .chart-area {
    min-height: 240px;
  }

  .chart-title {
    font-size: 0.95rem;
  }

  .chart-desc {
    font-size: 0.78rem;
  }

  .stats-header {
    gap: 8px;
  }

  .stats-header h2 {
    font-size: 0.85rem;
  }

  .carousel-btn {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .carousel-dots {
    gap: 10px;
    padding: 8px;
  }

  .dot {
    width: 12px;
    height: 12px;
  }

  .dot.active {
    width: 28px;
  }

  .Login-box {
    margin: 4vh 16px;
    padding: 24px 16px;
    max-width: none;
  }

  .Login-box::before {
    content: "┌─ auth.sh";
    font-size: 0.65rem;
    left: 8px;
  }

  .Login-box h1 {
    font-size: 1.15rem;
  }

  .Login-box input,
  .Login-box button {
    min-height: 44px;
    padding: 12px 14px;
  }

  .error-banner {
    font-size: 0.85rem;
    padding: 8px 16px;
  }
}

/* ========== Very small phones ========== */
@media (max-width: 420px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .brand {
    font-size: 0.75rem;
  }

  .account-card::before,
  .Login-box::before {
    content: "┌─";
  }

  h1 {
    font-size: 1.05rem;
  }

  h1::before {
    content: "$";
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
