/* ── Reset & VRChat variables ─────────────────────────────────────────────── */

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

img { -webkit-user-drag: none; user-drag: none; user-select: none; }

:root {
  /* Backgrounds */
  --bg:       #050c0f;
  --surface:  rgb(7, 36, 43);
  --surface2: rgb(5, 25, 30);

  /* Borders */
  --border:      rgb(5, 60, 72);
  --border-btn:  rgb(6, 75, 92);

  /* Button */
  --btn-bg:      rgb(6, 75, 92);
  --btn-text:    rgb(106, 227, 249);
  --btn-bg-sec:  rgb(5, 45, 55);

  /* Accent / status */
  --accent:      #1fd1ed;
  --accent-glow: rgba(31, 209, 237, .35);
  --success:     #67d781;
  --danger:      #ff5767;

  /* Text */
  --text:  #d2deea;
  --muted: #798897;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Background grid ─────────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(31,209,237,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,209,237,.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem 2.25rem 2.25rem;
  max-width: 460px;
  width: 100%;
  overflow: hidden;
  position: relative;
  z-index: 10;
  box-shadow: 0 0 60px rgba(31,209,237,.05), 0 24px 48px rgba(0,0,0,.6);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.vrc-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.vrc-icon {
  width: 46px;
  height: 46px;
  background: var(--btn-bg);
  border: 2px solid var(--border-btn);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 9px;
}

.vrc-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(82%) sepia(45%) saturate(400%) hue-rotate(155deg) brightness(108%);
}

.vrc-header-text small {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: .15rem;
}

.vrc-header-text strong {
  font-size: .95rem;
  color: var(--text);
  font-weight: 600;
}

/* ── Status row ──────────────────────────────────────────────────────────── */

.status-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.25rem;
}

.status-row-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
}
.status-row-icon.loading {
  filter: brightness(0) saturate(100%) invert(82%) sepia(45%) saturate(400%) hue-rotate(155deg) brightness(108%);
}
.status-row-icon.error {
  filter: brightness(0) saturate(100%) invert(50%) sepia(90%) saturate(600%) hue-rotate(315deg) brightness(110%);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.loading {
  background: var(--accent);
  box-shadow: 0 0 7px var(--accent-glow);
  animation: pulse 1.4s ease-in-out infinite;
}
.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 7px rgba(255,87,103,.4);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

.status-label {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── Title / description ─────────────────────────────────────────────────── */

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: .45rem;
  line-height: 1.3;
}

.description {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.description code {
  font-size: .82em;
  color: var(--btn-text);
  background: var(--btn-bg-sec);
  padding: .1em .35em;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
}

/* ── Instance chip ───────────────────────────────────────────────────────── */

.instance-chip {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: .7rem 1rem;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.instance-chip-icon {
  width: 18px;
  height: 18px;
  opacity: .4;
  flex-shrink: 0;
  margin-top: 3px;
  filter: brightness(0) invert(1);
}

.instance-chip-content small {
  display: block;
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .3rem;
}

.instance-chip-content code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: .73rem;
  color: var(--btn-text);
  word-break: break-all;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */

.progress-wrap {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--border-btn), var(--accent));
  border-radius: 2px;
  transform-origin: left;
  animation: drain 4s linear forwards;
}

@keyframes drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn-group {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  outline: none;
  transition: filter .15s, transform .1s;
  box-sizing: border-box;
}
.btn:hover  { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }

.btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.btn-primary {
  border: 2px solid var(--border-btn);
  background: var(--btn-bg);
  color: var(--btn-text);
}
.btn-primary img {
  filter: brightness(0) saturate(100%) invert(82%) sepia(45%) saturate(400%) hue-rotate(155deg) brightness(108%);
}

.btn-secondary {
  border: 2px solid var(--border);
  background: var(--btn-bg-sec);
  color: var(--btn-text);
  opacity: .75;
}
.btn-secondary:hover { opacity: 1; filter: none; }
.btn-secondary img {
  filter: brightness(0) saturate(100%) invert(82%) sepia(45%) saturate(400%) hue-rotate(155deg) brightness(108%);
  opacity: .7;
}

/* ── Error box ───────────────────────────────────────────────────────────── */

.error-box {
  background: rgba(255,87,103,.07);
  border: 2px solid rgba(255,87,103,.25);
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .82rem;
  color: #ff9aa4;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.error-box code {
  background: rgba(255,87,103,.12);
  padding: .1em .35em;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: .88em;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  position: relative;
  z-index: 1;
  border-top: 2px solid var(--border);
  padding: .85rem 1.5rem;
}

.footer-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.footer-warning {
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: .3rem;
  opacity: .75;
}

.footer-info {
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer-info a, .footer-warning a {
  color: var(--btn-text);
  text-decoration: none;
  opacity: .7;
}
.footer-info a:hover, .footer-warning a:hover { opacity: 1; text-decoration: underline; }

.sep { margin: 0 .45rem; opacity: .3; }
