:root {
  color-scheme: dark;
  --bg: #06160f;
  --panel: rgba(7, 30, 23, 0.94);
  --line: rgba(209, 239, 190, 0.2);
  --text: #eff9e4;
  --muted: #bad0bd;
  --primary: #aee66f;
  --primary-ink: #14351d;
  --danger: #ffaea7;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
a { font: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

a-scene {
  position: fixed !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #fff;
  color: #111;
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.loading-screen,
.fade-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.loading-screen {
  overflow-y: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 10%, rgba(174, 230, 111, .16), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(71, 153, 126, .19), transparent 32%),
    linear-gradient(145deg, #04110c, #0a2c23 56%, #123b2e);
  transition: opacity .45s ease, visibility .45s ease;
}

.loading-screen::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
  content: "";
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  position: relative;
  width: min(590px, 100%);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(218, 244, 199, .2);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(8, 34, 26, .94), rgba(5, 24, 18, .9));
  box-shadow: 0 30px 100px rgba(0, 0, 0, .48), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(22px);
}

.entry-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.leaf-mark,
.brand-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7bcf6d, #d3ed75);
  color: #163b20;
  font-weight: 900;
  box-shadow: 0 9px 30px rgba(118, 207, 108, .25);
}

.leaf-mark {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 28px 12px 28px 12px;
}

.loading-card h1 {
  max-width: 420px;
  margin: 3px 0 0;
  font-size: clamp(1.7rem, 5vw, 2.55rem);
  line-height: 1.04;
}

.loading-card p { color: var(--muted); }

.entry-intro {
  max-width: 510px;
  margin: 24px 0 20px;
  line-height: 1.55;
}

.entry-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 12px;
}

.entry-field {
  display: grid;
  gap: 8px;
  text-align: left;
}

.entry-field span {
  color: #dcebd7;
  font-size: .84rem;
  font-weight: 800;
}

.entry-field input,
.entry-field select {
  width: 100%;
  min-height: 50px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  outline: 0;
  color: var(--text);
  background: rgba(255, 255, 255, .055);
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.entry-field select {
  cursor: pointer;
  color-scheme: dark;
}

.entry-field input:focus,
.entry-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(174, 230, 111, .12);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary) !important;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.asset-progress {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  background: rgba(1, 13, 9, .34);
}

.progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 11px;
  font-size: .87rem;
}

.progress-heading span { color: var(--primary); font-variant-numeric: tabular-nums; }

.asset-progress progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: rgba(255, 255, 255, .09);
}

.asset-progress progress::-webkit-progress-bar { border-radius: 999px; background: rgba(255, 255, 255, .09); }
.asset-progress progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #70c96b, #d0eb74); transition: width .18s ease; }
.asset-progress progress::-moz-progress-bar { border-radius: 999px; background: linear-gradient(90deg, #70c96b, #d0eb74); }

#loadingDetail {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.entry-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 18px;
}

.entry-button { min-height: 50px; }
.entry-button:only-child { grid-column: 1 / -1; }

.button:disabled {
  cursor: wait;
  filter: grayscale(.25);
  opacity: .5;
}

.entry-note {
  margin: 13px 0 0;
  font-size: .76rem;
  line-height: 1.45;
}

.loading-screen.is-ready .asset-progress {
  border-color: rgba(174, 230, 111, .28);
  background: rgba(61, 111, 61, .13);
}

.loading-screen.is-error .asset-progress {
  border-color: rgba(255, 174, 167, .32);
  background: rgba(121, 45, 39, .12);
}

.fade-overlay {
  z-index: 45;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 46%, rgba(18, 54, 40, .96), rgba(7, 23, 17, .995) 68%),
    #071711;
  opacity: 0;
  transition: opacity .2s ease-out;
  will-change: opacity;
}

.fade-overlay.is-active { opacity: 1; }

.topbar,
.glass-panel {
  position: fixed;
  z-index: 20;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1040px, calc(100% - 24px));
  min-height: 64px;
  padding: 9px 12px;
  border-radius: 18px;
  transform: translateX(-50%);
}

.brand-lockup,
.status-cluster,
.hud-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-icon {
  flex: 0 0 auto;
  width: 41px;
  height: 41px;
  border-radius: 14px 7px 14px 7px;
}

.brand-lockup strong,
.brand-lockup span { display: block; }
.brand-lockup span { color: var(--muted); font-size: .77rem; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 31px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .055);
  font-size: .78rem;
  white-space: nowrap;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e6bf60;
}

.status-pill.is-online i { background: #8fe181; }
.status-pill.is-offline i { background: var(--danger); }

.button,
.icon-button {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.button {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 12px;
  font-weight: 750;
}

.button-primary {
  color: var(--primary-ink);
  background: var(--primary);
}

.button-secondary { background: rgba(255, 255, 255, .085); }
.button:hover { filter: brightness(1.09); }

.glass-panel {
  top: 90px;
  right: max(12px, env(safe-area-inset-right));
  width: min(410px, calc(100% - 24px));
  max-height: calc(100vh - 112px);
  padding: 24px;
  overflow: auto;
  border-radius: 22px;
}

.glass-panel h2 { margin: 0 30px 12px 0; line-height: 1.15; }
.glass-panel p { color: var(--muted); line-height: 1.5; }

.panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  font-size: 1.25rem;
}

.help-panel dl { margin: 0; }
.help-panel dl div { padding: 12px 0; border-top: 1px solid var(--line); }
.help-panel dt { font-weight: 800; }
.help-panel dd { margin: 4px 0 0; color: var(--muted); line-height: 1.42; }

.stores-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.store-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, .065);
  cursor: pointer;
  text-align: left;
}

.store-shortcut::after {
  content: "Entrar →";
  color: var(--primary);
  font-size: .78rem;
  font-weight: 800;
}

.store-shortcut:hover { background: rgba(255, 255, 255, .11); }

.profile-panel fieldset { border: 0; padding: 9px 0 18px; }
.profile-panel legend { margin-bottom: 10px; font-weight: 750; }
.color-choices { display: flex; gap: 10px; }
.color-choices button {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, .17);
  border-radius: 50%;
  background: var(--swatch);
  cursor: pointer;
}
.color-choices button.is-selected { border-color: #fff; box-shadow: 0 0 0 3px var(--primary); }
.text-link { color: var(--primary); }

.store-info-panel { width: min(500px, calc(100% - 24px)); }
.store-info-content { display: grid; gap: 13px; }
.info-section { padding-top: 12px; border-top: 1px solid var(--line); }
.info-section h3 { margin: 0 0 6px; font-size: 1rem; }
.info-section p,
.info-section li { color: var(--muted); line-height: 1.48; }
.info-section p { margin: 0; white-space: pre-line; }
.info-section ul { margin: 7px 0 0; padding-left: 20px; }
.error-text { color: var(--danger) !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .topbar { gap: 8px; }
  .performance-pill { display: none; }
  .hud-actions { gap: 6px; }
  .button { padding-inline: 10px; font-size: .85rem; white-space: nowrap; }
}

@media (max-width: 760px) {
  .loading-card { padding: 24px 20px; }
  .entry-brand { align-items: flex-start; }
  .leaf-mark { width: 58px; height: 58px; border-radius: 20px 9px 20px 9px; }
  .entry-actions { grid-template-columns: 1fr; }
  .entry-fields { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .status-cluster { order: 3; width: 100%; }
  .performance-pill { display: none; }
  .button { min-height: 38px; padding: 7px 10px; font-size: .8rem; }
  .brand-lockup span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .glass-panel { top: 132px; max-height: calc(100vh - 148px); }
}

@media (max-width: 440px) {
  .brand-lockup { width: 100%; }
  .hud-actions { position: absolute; top: 10px; right: 10px; }
  .hud-actions .button { max-width: 95px; }
  .status-cluster { overflow-x: auto; }
}

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