:root { color-scheme: dark; }

body {
  margin: 0; padding: .5rem 1rem 2rem; background: #ffffff; color: #1a1a1a;
  font: 15px/1.6 ui-sans-serif, system-ui, sans-serif;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}

h1 {
  max-width: 100%; text-align: left; font-size: 1.1rem; margin: 0 0 0 .25rem;
  font-weight: 600; line-height: 1.2;
}

#status, .hint { max-width: 100%; text-align: center; }
#device { width: 100%; }

#screen {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated; background: #000;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; width: 100%; max-width: 68rem; margin: 0 auto;
}

#about > summary {
  list-style: none; cursor: pointer; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: #f7931a; color: #ffffff;
  display: grid; place-items: center;
  font: 600 .9rem/1 ui-sans-serif, system-ui, sans-serif;
  font-style: normal; border: none;
}
#about > summary::-webkit-details-marker { display: none; }
#about > summary:hover { background: #ffa733; }

#about > div {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 10;
  margin-top: .5rem; max-width: min(46rem, calc(100vw - 2rem));
  background: #12151a; border: 1px solid #2a2f36; border-radius: 10px;
  padding: 1rem 1.25rem; font-size: .88rem; color: #b6bec8; text-align: left;
}
#about > div a { color: #f7931a; }
#about ul { padding-left: 1.1rem; }
#about li { margin: .35rem 0; }

#status.ready { color: #22c55e; }
#status.err { color: #ef4444; white-space: pre-wrap; max-width: 70ch; }
.hint { color: #666; font-size: .8rem; }

.warn {
  color: #8a5a00; font-size: .9em; text-align: center; margin: 0;
  max-width: 60ch; border: 1px solid #d4a24a; background: #fff8e6;
  border-radius: 8px; padding: .5rem .9rem;
}

.mainnet-banner {
  box-sizing: border-box; width: 100%; max-width: 46rem; margin: 0 auto;
  padding: 1rem 1.25rem; background: #7f1d1d; color: #ffffff;
  border: 3px solid #ef4444; border-radius: 10px;
  font-size: 1rem; line-height: 1.5; text-align: center;
  font-weight: 500; box-shadow: 0 0 0 1px #ef4444, 0 8px 24px rgba(239, 68, 68, .35);
}
.mainnet-banner strong {
  display: block; font-size: 1.1rem; font-weight: 700;
  margin-bottom: .35rem; color: #ffffff;
  text-transform: uppercase; letter-spacing: .04em;
}

.note { color: #666; font-size: .9em; text-align: center; margin: 0; max-width: 60ch; }
.note a { color: #f7931a; }
.hint a { color: #7c848f; }

#running {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  max-width: 100%; font-size: .8rem;
}
#running p { margin: 0; color: #666; text-align: center; }
.running-row {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: .5rem .9rem;
}

#build { width: 100%; text-align: center; font-size: .9em; }
#build > summary {
  list-style: none; display: inline-block; cursor: pointer;
  font: inherit; color: #8b939e; background: #1d2026; border: 1px solid #2a2e35;
  border-radius: 5px; padding: .2rem .6rem;
}
#build > summary::-webkit-details-marker { display: none; }
#build > summary:hover { color: #d7dbe0; border-color: #3a3f47; }
#build[open] > summary { color: #f7931a; border-color: #f7931a; background: #16181c; }
#build > summary:focus-visible { outline: 2px solid #f7931a; outline-offset: 2px; }
#build > div {
  box-sizing: border-box; width: min(46rem, 100%);
  margin: .6rem auto 0; text-align: left;
  background: #12151a; border: 1px solid #2a2f36; border-radius: 10px;
  padding: 1rem 1.25rem; color: #b6bec8;
}
#build a { color: #f7931a; }
#build h3 { font-size: 1em; font-weight: 600; color: #d7dbe0; margin: 1.2rem 0 .5rem; }
#build dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: 0; }
#build dt { color: #7c848f; }
#build dd { margin: 0; }
#build .hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em; word-break: break-all;
}
#build .deps {
  display: flex; flex-wrap: wrap; gap: .15rem .9rem;
  list-style: none; padding: 0; margin: .5rem 0 0;
}
#build .deps li { overflow-wrap: anywhere; }
#build .deps b { color: #d7dbe0; font-weight: 500; }
#build .verdict {
  margin: .8rem 0 0; border: 1px solid #2a2f36; border-radius: 6px; padding: .45rem .7rem;
}
#build .verdict[data-state=match] { color: #f7931a; border-color: #f7931a; background: #16181c; }
#build .verdict[data-state=differs] { color: #ef4444; border-color: #7f1d1d; background: #1b0f10; }
#build .limit, #build .links { margin: .6rem 0 0; color: #9aa3ae; }

body.mainnet .warn { color: #f3c08a; border-color: #7b4a1e; background: #2b1a09; }

/* LOADER */
#boot {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  line-height: 1.35; pointer-events: none; position: relative;
}
#boot-load {
  display: none; align-items: center; justify-content: center; gap: .45rem; margin: 0;
}
#boot.loading {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); z-index: 10;
}
#boot.loading #boot-load { display: flex; }

#boot-pixels { display: grid; grid-template-columns: repeat(3, 4px); gap: 1.5px; }
#boot-pixels span {
  width: 4px; height: 4px; border-radius: 50%;
  background: #e6eaef; opacity: .1;
}

#boot-label {
  color: transparent;
  background-image: linear-gradient(90deg, #8b939e 30%, #ffffff 50%, #8b939e 70%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: shimmer-text 1.6s linear infinite;
  font-size: 1rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}

#boot-elapsed {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9rem; font-variant-numeric: tabular-nums; color: #767d87;
  display: inline-block; animation: elapsed-pulse 1s ease-in-out infinite;
}

#boot-logo {
  display: block; width: 40%; max-width: 40%; margin: 0 auto .3rem;
  opacity: .95; animation: logo-glow 3s ease-in-out infinite;
}

#status { color: #888; margin: 0; font-size: .9rem; text-align: center; }
#status:empty { display: none; }
#status.err { color: #ef4444; }

@media (prefers-reduced-motion: no-preference) {
  #boot-pixels span { animation: pixel-on 650ms ease-in-out infinite; }
  #boot-pixels span:nth-child(1) { animation-delay: 0ms; }
  #boot-pixels span:nth-child(2) { animation-delay: 100ms; }
  #boot-pixels span:nth-child(3) { animation-delay: 200ms; }
  #boot-pixels span:nth-child(6) { animation-delay: 300ms; }
  #boot-pixels span:nth-child(9) { animation-delay: 400ms; }
  #boot-pixels span:nth-child(8) { animation-delay: 500ms; }
  #boot-pixels span:nth-child(7) { animation-delay: 600ms; }
  #boot-pixels span:nth-child(4) { animation-delay: 700ms; }
}

@keyframes pixel-on {
  0%, 100% { opacity: .1; background: #e6eaef; box-shadow: none; }
  18%, 42% { opacity: 1; background: #f7931a; box-shadow: 0 0 6px rgba(247,147,26,.8); }
  62% { opacity: .1; background: #e6eaef; }
}
@keyframes shimmer-text {
  from { background-position: 150%; }
  to { background-position: -50%; }
}
@keyframes elapsed-pulse {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.2); }
  100% { transform: scale(0.9); }
}
@keyframes logo-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(247,147,26,.4)); }
  50% { filter: drop-shadow(0 0 12px rgba(247,147,26,.8)); }
}

/* RIGA INFO */
#info-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .75rem 2rem; width: 100%; max-width: 46rem; margin: .5rem auto;
}
#info-row .note {
  flex: 1 1 22rem; margin: 0; max-width: none;
  text-align: left; font-size: .8rem; line-height: 1.45;
}
#info-row .buy { flex: 0 0 auto; margin: 0; }

@media (max-width: 40rem) {
  #info-row { flex-direction: column; gap: .6rem; }
  #info-row .note { text-align: center; }
}

/* PULSANTE ACQUISTO */
.buy { margin: .25rem auto .5rem; text-align: center; }
.buy a {
  display: inline-block; padding: .55rem 1.1rem;
  background: #f7931a; color: #ffffff;
  font-weight: 600; font-size: .95rem;
  border-radius: 8px; text-decoration: none;
  border: 1px solid #d97b0a;
  box-shadow: 0 2px 6px rgba(247, 147, 26, .25);
  transition: background .15s ease, transform .1s ease;
}
.buy a:hover { background: #ffa733; }
.buy a:active { transform: translateY(1px); }
.buy a:focus-visible { outline: 2px solid #f7931a; outline-offset: 3px; }

@media (max-width: 30rem) {
  .buy a { font-size: .9rem; padding: .5rem .9rem; }
}

@media (max-width: 40rem) {
  body { padding: .75rem .75rem; gap: .5rem; }
  header {
    flex-direction: column; align-items: center; justify-content: center;
    gap: .35rem; text-align: center;
  }
  header > a { order: 1; }
  header > div { order: 2; justify-content: center; }
  #firmware-line-footer { order: 3; font-size: .75rem; margin: 0; }
  h1 { text-align: center; margin: 0; font-size: 1rem; color: #1a1a1a; }
  .hint { font-size: .8rem; color: #666; }
  #info-row { flex-direction: column; margin: .25rem auto; gap: .5rem; }
  #info-row .note { flex: none; text-align: center; }
  #info-row .buy { flex: none; }
  #running { margin: 0; gap: .25rem; }
  #running p { margin: 0; }
  #build { margin-top: .25rem; }
  #build dl { grid-template-columns: 1fr; gap: 0; }
  #build dd { margin: 0 0 .5rem; }
  #boot { font-size: .9em; }
  .warn { margin-top: .25rem; }
}

#tutorial-slot:empty { display: none; }
#device { position: relative; }

#case-logo {
  position: absolute; top: 6%; left: 6%; width: 12%;
  pointer-events: none; z-index: 5;
}