/* ============================================================
   vn_tool — neobrutalism design system
   ============================================================ */

:root {
  --ink: #141414;
  --paper: #fff7e6;
  --paper-2: #ffefc2;
  --white: #fffdf6;
  --yellow: #ffd93d;
  --yellow-deep: #f5c400;
  --pink: #ff8fab;
  --cyan: #77e4f1;
  --lime: #c6f68d;
  --orange: #ffa45b;
  --violet: #c7a6ff;
  --red: #ff6b6b;
  --muted: #6f6a5e;

  --border: 3px solid var(--ink);
  --border-thin: 2px solid var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-lg: 10px 10px 0 var(--ink);
  --radius: 6px;

  --font-display: "Archivo Black", "Arial Black", "Helvetica Neue", sans-serif;
  --font-body: "Space Grotesk", "Trebuchet MS", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --header-h: 76px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(20, 20, 20, 0.14) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(20, 20, 20, 0.08);
  border: 1.5px solid rgba(20, 20, 20, 0.25);
  border-radius: 3px;
  padding: 1px 5px;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(20, 20, 20, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 20, 20, 0.05) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

/* ============================ TYPOGRAPHY ============================ */

.eyebrow,
.kicker {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  background: var(--ink);
  color: var(--yellow);
  padding: 5px 10px;
  transform: rotate(-1deg);
  margin-bottom: 12px;
}

.kicker {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 6.5vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* ============================ MARQUEE ============================ */

.marquee {
  position: relative;
  z-index: 3;
  overflow: hidden;
  background: var(--ink);
  color: var(--yellow);
  border-bottom: var(--border);
}

.marquee-track {
  display: flex;
  gap: 22px;
  width: max-content;
  padding: 9px 0;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
}

.marquee-track--slow {
  animation-duration: 38s;
}

.marquee--mini {
  position: relative;
  border-bottom: var(--border);
}

.marquee--mini .marquee-track {
  padding: 5px 0;
  font-size: 0.64rem;
  background: var(--yellow);
  color: var(--ink);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============================ BRAND ============================ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  width: max-content;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--ink);
  color: var(--white);
  border: var(--border);
  padding: 8px 13px 9px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-1.5deg);
}

.brand-slash {
  color: var(--yellow);
}

.brand-sticker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--pink);
  border: var(--border-thin);
  padding: 4px 7px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(4deg);
}

.brand--small .brand-text {
  font-size: 1.28rem;
  padding: 6px 10px 7px;
  box-shadow: 3px 3px 0 var(--ink);
}

/* ============================ BUTTONS ============================ */

.btn {
  --btn-bg: var(--white);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 17px;
  box-shadow: var(--shadow-sm);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn:focus-visible {
  outline: 3px dashed var(--ink);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: 2px 2px 0 var(--ink);
  transform: none;
}

.btn--primary { --btn-bg: var(--yellow); }
.btn--danger { --btn-bg: var(--red); }
.btn--ghost { --btn-bg: var(--white); }
.btn--discord { --btn-bg: #5865f2; --btn-fg: #ffffff; }
.btn--sm { padding: 8px 13px; font-size: 0.72rem; }
.btn--tiny { padding: 6px 10px; font-size: 0.66rem; box-shadow: 2px 2px 0 var(--ink); }
.btn--block { width: 100%; padding: 15px 18px; font-size: 0.92rem; }

.oauth-discord-mark {
  font-size: 1.15rem;
  line-height: 1;
}

.oauth-block {
  margin: 4px 0 2px;
}

.oauth-hint {
  margin-top: 10px;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--ink);
}

.oauth-linked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin: 0 0 18px;
  border: var(--border-thin);
  background: var(--lime);
  box-shadow: 3px 3px 0 var(--ink);
  border-radius: var(--radius);
}

.oauth-linked p {
  margin: 0;
  font-size: 0.9rem;
}

.oauth-linked .card-kicker {
  margin-bottom: 2px;
  color: var(--ink);
}

.btn-arrow {
  font-size: 1.25rem;
  line-height: 1;
}

.spinner-dot {
  display: inline-block;
  animation: spin-dot 900ms linear infinite;
}

@keyframes spin-dot {
  to { transform: rotate(360deg); }
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

/* ============================ CHIPS / TAGS / PILLS ============================ */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 26px 0 30px;
}

.chip,
.tag,
.pill,
.count-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--border-thin);
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip {
  font-size: 0.68rem;
  padding: 6px 12px;
  box-shadow: 2px 2px 0 var(--ink);
  transform: rotate(-0.5deg);
}

.chip--lime { background: var(--lime); }
.chip--cyan { background: var(--cyan); }
.chip--pink { background: var(--pink); transform: rotate(0.7deg); }

.tag {
  font-size: 0.62rem;
  padding: 4px 9px;
  border-radius: 4px;
  background: var(--white);
}

.tag--lime { background: var(--lime); }
.tag--cyan { background: var(--cyan); }
.tag--pink { background: var(--pink); }
.tag--yellow { background: var(--yellow); }

.pill {
  font-size: 0.62rem;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--lime);
  box-shadow: 2px 2px 0 var(--ink);
}

.pill--muted {
  background: var(--paper-2);
  color: var(--muted);
}

.count-badge {
  min-width: 38px;
  height: 32px;
  padding: 0 9px;
  border-radius: 4px;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 0.82rem;
}

.status-chip {
  font-size: 0.68rem;
  padding: 7px 12px;
  border-radius: 4px;
  background: var(--paper-2);
  box-shadow: 2px 2px 0 var(--ink);
}

.status-chip--running {
  background: var(--yellow);
  animation: blink 1.4s steps(2, start) infinite;
}

.status-chip--done { background: var(--lime); }
.status-chip--error { background: var(--red); color: var(--white); }
.status-chip--cancelled { background: var(--orange); }

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

/* ============================ CONNECT VIEW ============================ */

.connect-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.connect-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px clamp(18px, 5vw, 64px) 10px;
}

.version-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  border: var(--border-thin);
  background: var(--paper-2);
  padding: 6px 10px;
  box-shadow: 2px 2px 0 var(--ink);
}

.hero {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 54px) clamp(18px, 5vw, 64px) 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: clamp(30px, 5vw, 64px);
  align-items: start;
}

.hero-sub {
  max-width: 620px;
  margin-top: 22px;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  font-weight: 500;
  color: #3d3a33;
}

.highlight {
  display: inline-block;
  background: var(--yellow);
  padding: 0 12px 4px;
  border: var(--border);
  box-shadow: var(--shadow-sm);
  transform: rotate(-1.2deg);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.feature-card {
  position: relative;
  border: var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.feature-card:nth-child(1) { transform: rotate(-0.8deg); }
.feature-card:nth-child(2) { transform: rotate(0.8deg); }
.feature-card:nth-child(3) { transform: rotate(0.6deg); }
.feature-card:nth-child(4) { transform: rotate(-0.6deg); }

.feature-card:hover {
  transform: translate(-3px, -3px) rotate(0deg);
  box-shadow: 8px 8px 0 var(--ink);
}

.feature-card--yellow { background: var(--yellow); }
.feature-card--pink { background: var(--pink); }
.feature-card--cyan { background: var(--cyan); }
.feature-card--lime { background: var(--lime); }

.feature-num {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  opacity: 0.35;
}

.feature-card h3 {
  font-size: 0.98rem;
  margin-bottom: 5px;
}

.feature-card p {
  font-size: 0.82rem;
  font-weight: 500;
  color: #2b2924;
}

.connect-card {
  position: relative;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(22px, 3vw, 32px);
  transform: rotate(0.8deg);
}

.sticker {
  position: absolute;
  top: -18px;
  right: 18px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 7px 12px;
  border: var(--border);
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(4deg);
}

.sticker--yellow { background: var(--yellow); }

.card-kicker {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

.connect-card h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin-bottom: 8px;
}

.connect-card-head p {
  font-size: 0.88rem;
  color: #4a463d;
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.token-shell {
  display: flex;
  gap: 0;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: inset 3px 3px 0 rgba(20, 20, 20, 0.06);
}

.token-shell:focus-within {
  background: var(--white);
  box-shadow: 4px 4px 0 var(--ink);
}

.token-shell input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  outline: none;
}

.token-shell .btn {
  margin: 5px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
}

.field-hint {
  font-size: 0.74rem;
  color: #5d584e;
  margin-top: 8px;
}

.turnstile-wrap {
  margin: 18px 0 4px;
  padding: 12px;
  border: 2px dashed var(--ink);
  background: var(--paper-2);
  border-radius: var(--radius);
}

.turnstile-note {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
}

.check-row,
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.check-row input,
.switch-row input,
.checkbox-field input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--ink);
  border: var(--border-thin);
}

.check-row small,
.switch-row small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.72rem;
}

.check-row--strong {
  font-size: 0.92rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  align-self: end;
}

.security-note {
  text-align: center;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 16px;
}

.connect-footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  padding: 20px clamp(18px, 5vw, 64px);
  border-top: var(--border);
  background: var(--paper-2);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}

/* ============================ APP SHELL ============================ */

.app-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: var(--header-h);
  padding: 0 clamp(14px, 3vw, 34px);
  background: var(--paper);
  border-bottom: var(--border);
  box-shadow: 0 4px 0 rgba(20, 20, 20, 0.08);
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  border: var(--border-thin);
  background: var(--white);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  box-shadow: 2px 2px 0 var(--ink);
}

.user-chip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper-2);
  object-fit: cover;
}

.user-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  max-width: 150px;
}

.user-chip-text strong {
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-text span {
  font-size: 0.62rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-toggle {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(18px, 2.5vw, 34px);
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: var(--border);
  background: var(--white);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 10px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 0.83rem;
  transition: background 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.nav-item:hover {
  background: var(--paper-2);
  border-color: var(--ink);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: var(--yellow);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-size: 1rem;
}

.nav-label {
  flex: 1;
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  opacity: 0.6;
}

.sidebar-token {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--cyan);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-0.6deg);
}

.mini-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(20, 20, 20, 0.65);
  margin-bottom: 4px;
}

.sidebar-token strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  line-height: 1.2;
  word-break: break-word;
}

.sidebar-token small {
  display: block;
  font-size: 0.68rem;
  margin-top: 5px;
  color: #30302c;
}

.sidebar-tip {
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--paper-2);
  font-size: 0.72rem;
  font-weight: 500;
}

.workspace {
  min-width: 0;
}

.tab-panel {
  display: none;
  animation: panel-in 220ms ease both;
}

.tab-panel.is-active {
  display: block;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head .eyebrow {
  margin-bottom: 10px;
}

/* ============================ PANELS & CARDS ============================ */

.panel {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 2.4vw, 26px);
  margin-bottom: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-note {
  font-size: 0.8rem;
  color: #4d4940;
  margin-top: 14px;
}

.account-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px clamp(18px, 2.5vw, 28px);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.account-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(20, 20, 20, 0.16) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.35;
}

.account-avatar-wrap {
  position: relative;
  flex: none;
  z-index: 1;
}

.account-avatar-wrap img {
  width: 76px;
  height: 76px;
  border: var(--border);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
  object-fit: cover;
}

.online-dot {
  position: absolute;
  right: 1px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: #38e078;
}

.account-info {
  position: relative;
  z-index: 1;
  min-width: 180px;
  flex: 1;
}

.account-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  opacity: 0.7;
}

.account-info h3 {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  margin: 2px 0;
}

.account-info p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.75;
}

.account-tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 14px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.stat-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.stat-card--yellow { background: var(--yellow); }
.stat-card--cyan { background: var(--cyan); }
.stat-card--pink { background: var(--pink); }
.stat-card--lime { background: var(--lime); }

.stat-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  line-height: 1.05;
  margin: 8px 0 4px;
  word-break: break-word;
}

.stat-card small {
  font-size: 0.68rem;
  font-weight: 500;
  color: rgba(20, 20, 20, 0.7);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  background: var(--white);
  transition: transform 130ms ease, box-shadow 130ms ease;
}

.quick-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 var(--ink);
}

.quick-card span {
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: 6px;
}

.quick-card strong {
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.quick-card small {
  font-size: 0.7rem;
  color: rgba(20, 20, 20, 0.68);
}

.quick-card--yellow { background: var(--yellow); }
.quick-card--pink { background: var(--pink); }
.quick-card--cyan { background: var(--cyan); }
.quick-card--lime { background: var(--lime); }

.security-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 20px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--paper-2);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ============================ FIELDS & FORMS ============================ */

.field,
.field--wide {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span,
.field-label > span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
textarea {
  width: 100%;
  border: var(--border-thin);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 11px 12px;
  font-size: 0.86rem;
  font-weight: 500;
  outline: none;
  transition: box-shadow 120ms ease, background 120ms ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
textarea:focus {
  background: var(--white);
  box-shadow: 3px 3px 0 var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 78px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

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

.form-grid--nested {
  padding: 15px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 16px;
}

.field--wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  justify-content: flex-end;
  margin-top: 18px;
}

.inline-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.voice-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px dashed var(--ink);
}

.info-strip {
  border: var(--border-thin);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.78rem;
  box-shadow: 3px 3px 0 var(--ink);
  margin-bottom: 22px;
}

.info-strip--yellow { background: var(--yellow); }
.info-strip--cyan { background: var(--cyan); }
.info-strip--pink { background: var(--pink); }
.info-strip--lime { background: var(--lime); }

/* ============================ QUEST ============================ */

.quest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.progress-block {
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--paper-2);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-track {
  height: 20px;
  border: var(--border-thin);
  border-radius: 3px;
  background: var(--white);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(
    -45deg,
    var(--yellow) 0 10px,
    var(--yellow-deep) 10px 20px
  );
  border-right: 2px solid var(--ink);
  transition: width 320ms ease;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 3px;
}

.quest-item {
  border: var(--border-thin);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 12px 13px;
}

.quest-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.quest-item h4 {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.quest-item .quest-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 7px;
  font-size: 0.67rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.quest-item .quest-bar {
  margin-top: 9px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--white);
  overflow: hidden;
}

.quest-item .quest-bar div {
  height: 100%;
  background: var(--cyan);
}

.quest-status {
  flex: none;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 7px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  text-transform: uppercase;
}

.quest-status--claimed { background: var(--lime); }
.quest-status--completed { background: var(--yellow); }
.quest-status--in_progress { background: var(--cyan); }
.quest-status--not_started { background: var(--paper-2); }
.quest-status--expired { background: #d8d4c8; color: #777; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 38px 18px;
  text-align: center;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-icon {
  font-size: 2rem;
}

.panel--terminal {
  background: var(--ink);
  color: var(--white);
}

.panel--terminal .kicker {
  color: var(--yellow);
}

.panel--terminal h3 {
  color: var(--white);
}

.panel-head--terminal {
  align-items: center;
  margin-bottom: 10px;
}

.terminal {
  min-height: 240px;
  max-height: 440px;
  overflow: auto;
  background: #0d0d0d;
  border: 2px solid #3a3a3a;
  border-radius: 4px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
}

.log-line {
  display: flex;
  gap: 8px;
  padding: 2px 0;
  word-break: break-word;
}

.log-time {
  flex: none;
  color: #777;
}

.log-text { white-space: pre-wrap; }
.log-line--info .log-text { color: #d8ffd0; }
.log-line--success .log-text { color: #a7ff8a; }
.log-line--warn .log-text { color: #ffd166; }
.log-line--error .log-text { color: #ff8585; }
.log-line--system .log-text { color: var(--cyan); }

.log-text strong { color: var(--yellow); font-weight: 700; }

.terminal-empty {
  color: #777;
  font-style: italic;
}

/* ============================ HYPESQUAD ============================ */

.houses-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.house-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 18px;
  background: var(--white);
  text-align: left;
  transition: transform 150ms ease, box-shadow 150ms ease;
  overflow: hidden;
}

.house-card:hover {
  transform: translate(-3px, -3px) rotate(-0.5deg);
  box-shadow: 10px 10px 0 var(--ink);
}

.house-card:disabled {
  opacity: 0.6;
  cursor: wait;
}

.house-card--1 { background: var(--violet); }
.house-card--2 { background: var(--yellow); }
.house-card--3 { background: var(--cyan); }

.house-emoji {
  font-size: 2.4rem;
  line-height: 1;
  filter: drop-shadow(2px 2px 0 rgba(20, 20, 20, 0.25));
}

.house-card h3 {
  font-size: 1.25rem;
}

.house-card p {
  font-size: 0.78rem;
  color: rgba(20, 20, 20, 0.7);
  max-width: 230px;
}

.house-cta {
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-top: 2px solid var(--ink);
  padding-top: 8px;
  width: 100%;
}

.house-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  opacity: 0.28;
}

.result-panel {
  background: var(--lime);
}

.result-panel p {
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ============================ AFK ============================ */

.afk-status-panel {
  background: var(--white);
}

.afk-status-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 16px;
  border-bottom: 2px dashed var(--ink);
}

.status-orb {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: var(--border);
  background: #cfcabe;
  box-shadow: 3px 3px 0 var(--ink);
  flex: none;
  position: relative;
}

.status-orb::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.18);
}

.status-orb.is-online {
  background: #38e078;
}

.status-orb.is-online::after {
  background: #0e8d40;
  animation: orb-pulse 1.8s ease infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.65; }
}

.afk-status-main h3 {
  font-size: 1.5rem;
  text-transform: uppercase;
}

.afk-status-main p {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.afk-metrics,
.badge-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.afk-metrics div,
.badge-metrics div {
  border: var(--border-thin);
  border-radius: 4px;
  background: var(--paper);
  padding: 10px;
}

.afk-metrics span,
.badge-metrics span {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

.afk-metrics strong,
.badge-metrics strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.1;
  word-break: break-word;
}

#afk-form .form-grid {
  margin-bottom: 16px;
}

/* ============================ BADGE ============================ */

.panel--badge {
  background: var(--lime);
}

.badge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.badge-layout .panel--terminal {
  background: var(--ink);
}

/* ============================ SETTINGS ============================ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 22px;
}

.settings-grid .panel {
  margin-bottom: 0;
}

.kv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.kv-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1.5px dashed rgba(20, 20, 20, 0.25);
  padding-bottom: 7px;
  font-size: 0.78rem;
}

.kv-list span {
  color: var(--muted);
}

.kv-list strong {
  text-align: right;
  word-break: break-word;
}

.switch-row {
  align-items: center;
  padding: 12px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin: 14px 0 4px;
}

.settings-copy {
  font-size: 0.82rem;
  color: #4d4940;
  margin: 10px 0;
}

.turnstile-status-box {
  border: var(--border-thin);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
}

.guide-details {
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 10px 12px;
  margin-top: 10px;
}

.guide-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.guide-details ol {
  margin: 10px 0 2px;
  padding-left: 20px;
  font-size: 0.76rem;
  color: #4d4940;
}

.guide-details li {
  margin-bottom: 5px;
}

/* ============================ TOASTS ============================ */

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--white);
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.toast--success { background: var(--lime); }
.toast--error { background: var(--red); color: var(--white); }
.toast--warn { background: var(--yellow); }
.toast--info { background: var(--cyan); }

.toast-icon {
  font-size: 1rem;
  line-height: 1.2;
}

.toast.is-leaving {
  animation: toast-out 160ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(24px); }
}

/* ============================ SCROLLBARS ============================ */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--ink);
  border: 2px solid var(--paper);
  border-radius: 5px;
}

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1150px) {
  .stat-grid,
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quest-layout,
  .badge-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
    max-width: 720px;
  }

  .connect-card {
    transform: none;
    max-width: 560px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: wrap;
    display: none;
  }

  .sidebar.is-open {
    display: flex;
  }

  .side-nav {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-token,
  .sidebar-tip {
    flex: 1 1 240px;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 760px) {
  :root {
    --header-h: 66px;
  }

  body {
    font-size: 15px;
  }

  .connect-header {
    padding-top: 18px;
  }

  .version-tag {
    display: none;
  }

  .hero {
    padding-top: 18px;
  }

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

  .connect-footer {
    flex-direction: column;
  }

  .app-header {
    padding: 0 12px;
    gap: 8px;
  }

  .brand--small .brand-text {
    font-size: 1.05rem;
    padding: 5px 8px 6px;
  }

  .app-header-right {
    gap: 7px;
  }

  .app-header-right .pill {
    display: none;
  }

  .user-chip-text {
    display: none;
  }

  .user-chip {
    padding: 3px;
  }

  .user-chip img {
    width: 32px;
    height: 32px;
  }

  .app-shell {
    padding: 14px;
  }

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

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .head-actions {
    justify-content: flex-start;
  }

  .stat-grid,
  .quick-grid,
  .badge-metrics,
  .afk-metrics,
  .form-grid,
  .settings-grid,
  .houses-grid {
    grid-template-columns: 1fr;
  }

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

  .account-banner {
    align-items: flex-start;
  }

  .account-tags {
    justify-content: flex-start;
  }

  .sticker {
    right: 12px;
  }

  .security-strip {
    flex-direction: column;
    gap: 6px;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    flex: 1 1 100%;
  }

  .toast-stack {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 2.55rem;
  }

  .brand-text {
    font-size: 1.45rem;
  }

  .app-header .btn--danger {
    padding: 7px 9px;
    font-size: 0.62rem;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }
}

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

  .marquee-track {
    animation: none;
  }
}
