/* System Info: one screen of topic tiles (same glass cards as the timelines); a tile opens a
   pop-up that fits the window. Only the History pop-up scrolls, as a vertical timeline. */
.system {
  --warm: #ffd2a8;
  --g: var(--warm);
}

.system.view--fit .view__header {
  margin: clamp(6px, 2vh, 24px) 0 clamp(10px, 2.5vh, 24px);
}

/* ---------- Tiles ---------- */
.tiles {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: clamp(8px, 1.4vw, 16px);
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
}

.tile--overview { --g: #ffd2a8; }
.tile--history { --g: #ff9a4d; }
.tile--era { --g: #9cc6ff; }
.tile--prototypes { --g: #f6d97a; }
.tile--colors { --g: #9be8b8; }
.tile--icons { --g: #e2b8ff; }

.tile {
  min-height: 0;
  animation: hero-in 0.5s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 30ms);
}

.tile__btn {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  padding: clamp(10px, 1.6vh, 16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03));
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s var(--ease-out), border-color 0.2s, box-shadow 0.25s;
}

.tile__btn:hover,
.tile__btn:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--g) 70%, transparent);
  box-shadow: 0 14px 30px rgba(12, 4, 50, 0.4);
}

.tile__group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-pixel);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--g);
}

.tile__group::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g);
}

.tile__visual {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 2px;
}

.tile__title {
  font-weight: 600;
  font-size: clamp(0.85rem, 1.8vh, 1.02rem);
  line-height: 1.2;
}

.tile__big,
.tile__mid {
  font-family: 'Michroma', var(--font);
  line-height: 1.1;
  color: #fff;
}

.tile__big {
  font-size: clamp(1rem, 3.4vh, 1.75rem);
}

.tile__mid {
  font-size: clamp(0.8rem, 2.2vh, 1.1rem);
}

.tile__sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.tile__quote {
  font-family: 'Michroma', var(--font);
  font-size: clamp(2rem, 7vh, 3.6rem);
  line-height: 0.8;
  color: var(--g);
}

.tile__blocks {
  display: grid;
  grid-template-columns: repeat(4, 16px);
  gap: 4px;
}

.tile__blocks i {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.tile__blocks i.is-used {
  background: linear-gradient(145deg, var(--gc-indigo-3), var(--gc-indigo));
}

.tile__strip {
  display: flex;
  width: 100%;
  height: clamp(18px, 4vh, 34px);
  overflow: hidden;
  border-radius: 6px;
}

.tile__strip i {
  flex: 1;
  background: var(--c);
}

.tile__logo {
  justify-self: center;
  height: 100%;
  min-height: 0;
  --logo-a: #6b56c9;
  --logo-b: #8f7ae8;
  --logo-c: #4c3c9e;
  --logo-hole: #241a5c;
}

.tile__logo svg {
  height: 100%;
  max-height: 90px;
  width: auto;
}

.tile__icons {
  display: flex;
  gap: 8px;
  color: var(--g);
}

.tile__icons svg {
  width: clamp(22px, 4vh, 32px);
  height: clamp(22px, 4vh, 32px);
}

.tile__faces {
  display: flex;
}

.tile__faces img {
  width: clamp(28px, 5.5vh, 44px);
  height: clamp(28px, 5.5vh, 44px);
  margin-right: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  object-fit: cover;
  object-position: center 35%;
}

.tile .war {
  width: 100%;
  gap: 5px;
}

.tile .war__row {
  grid-template-columns: 1fr;
  padding: 0;
}

.tile .war__track {
  height: 8px;
}

@media (max-width: 1000px) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(0, 1fr));
  }

  .tile__group {
    display: none;
  }
}

@media (max-height: 760px) {
  .system.view--fit .view__intro {
    display: none;
  }
}

@media (max-height: 640px), (max-width: 640px) {
  .tile__sub {
    display: none;
  }
}

/* ---------- Pop-up ---------- */
.sdialog {
  width: min(1120px, calc(100vw - 24px));
  height: min(760px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  color: var(--text);
  background: linear-gradient(160deg, #3a2a9c, #1c1060);
  box-shadow: 0 40px 80px rgba(5, 2, 30, 0.6);
}

.sdialog[open] {
  animation: view-in 0.35s var(--ease-out);
}

.sdialog::backdrop {
  background: rgba(6, 3, 24, 0.7);
  backdrop-filter: blur(4px);
}

.sdialog__inner {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(12px, 2.5vh, 24px);
  padding: 14px clamp(16px, 3vw, 36px) clamp(16px, 3vh, 28px);
}

.sdialog__head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-right: 48px;
}

.sdialog__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sdialog__title {
  margin-top: 4px;
  font-family: 'Michroma', var(--font);
  font-size: clamp(1rem, 2.8vh, 1.5rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Content is laid out to fit; on very small screens it can scroll on its own as a last resort. */
.sdialog__body {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.sdialog__body--scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

/* ---------- Pop-up content ---------- */
.s-lede {
  margin-bottom: clamp(10px, 2vh, 18px);
  color: var(--muted);
  line-height: 1.5;
}

.s-note,
.s-sources {
  margin-top: clamp(10px, 2vh, 18px);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.s-sources a {
  color: var(--warm);
}

.s-tag,
.s-stat__label,
.s-specs dt,
.s-table caption,
.s-table thead th {
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
}

.s-tag--demo { color: #9cc6ff; }
.s-tag--beta { color: #f6d97a; }
.s-tag--cancelled { color: #ff9aa8; }

.s-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(10px, 2vh, 20px) clamp(16px, 2.5vw, 32px);
}

.s-entries--4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: clamp(14px, 3vh, 26px);
}

.s-entry {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.s-entry h3 {
  margin: 2px 0 4px;
  font-size: clamp(0.95rem, 2vh, 1.1rem);
  font-weight: 600;
}

.s-entry p {
  font-size: clamp(0.82rem, 1.75vh, 0.95rem);
  line-height: 1.5;
  color: var(--muted);
}

.s-entry.is-gc h3 {
  color: var(--accent);
}

/* Numbers */
.s-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 3vh, 28px) clamp(16px, 2.5vw, 32px);
}

.s-stat {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.s-stat__value {
  font-family: 'Michroma', var(--font);
  font-size: clamp(1.3rem, 4vh, 2.2rem);
  line-height: 1.1;
  color: #fff;
}

.s-stat__note {
  font-size: 0.9rem;
  color: var(--muted);
}

.s-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2.2vh, 20px) clamp(16px, 2.5vw, 32px);
  margin: 0;
}

.s-specs div {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.s-specs dd {
  margin: 4px 0 0;
  font-size: clamp(0.9rem, 1.9vh, 1.02rem);
  line-height: 1.45;
}

.s-ranked,
.s-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2vh, 18px) clamp(16px, 2.5vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: item;
}

.s-ranked li,
.s-facts li {
  counter-increment: item;
  position: relative;
  padding: 10px 0 0 44px;
  border-top: 1px solid var(--line);
}

.s-ranked li::before,
.s-facts li::before {
  position: absolute;
  left: 0;
  top: 10px;
  font-family: 'Michroma', var(--font);
  color: var(--accent);
}

.s-ranked li::before {
  content: counter(item);
  font-size: 1.6rem;
  line-height: 1;
}

.s-facts li::before {
  content: counter(item, decimal-leading-zero);
  top: 13px;
  font-size: 0.8rem;
}

.s-ranked h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: clamp(0.95rem, 2vh, 1.08rem);
}

.s-regions {
  display: inline-flex;
  gap: 4px;
}

.s-ranked p,
.s-facts li {
  font-size: clamp(0.82rem, 1.75vh, 0.95rem);
  line-height: 1.5;
  color: var(--muted);
}

.s-ranked p {
  margin-top: 3px;
}

/* Memory card easter egg */
.memory__blocks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 8px;
  max-width: 620px;
}

.memory__blocks span,
.memory__secret {
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.memory__blocks span.is-used {
  background: linear-gradient(145deg, var(--gc-indigo-3), var(--gc-indigo));
}

/* Looks like any other free block; warms up as it's tapped. */
.memory__secret {
  padding: 0;
  cursor: pointer;
  background: color-mix(in srgb, var(--gc-orange) calc(var(--taps, 0) * 100%), rgba(255, 255, 255, 0.03));
  transition: background 0.2s, transform 0.15s;
}

.memory__secret:active {
  transform: scale(0.9);
}

.memory__caption {
  margin-top: 14px;
  color: var(--muted);
}

/* History */
.s-toggle {
  margin: 0 0 14px;
}

.hist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hist__item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
}

.hist__date {
  padding-top: 14px;
  text-align: right;
  font-family: var(--font-pixel);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--warm);
}

.hist__body {
  position: relative;
  padding: 12px 0 14px 24px;
  border-left: 2px solid rgba(255, 255, 255, 0.25);
}

.hist__body::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 17px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 111, 0, 0.25);
}

.hist__body h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.hist__body p {
  margin-top: 4px;
  line-height: 1.5;
  color: var(--muted);
}

.hist__item--world .hist__date {
  color: var(--muted);
}

.hist__item--world .hist__body::before {
  background: #cfc8f5;
  box-shadow: none;
  transform: scale(0.7);
}

.hist__item--world h3 {
  font-weight: 500;
  font-style: italic;
  color: rgba(255, 255, 255, 0.8);
}

.hist__item--world p {
  font-style: italic;
}

/* Console war bars */
.war {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.war__row {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  align-items: center;
  gap: 12px;
  padding: 2px 4px;
  border-radius: 6px;
}

.war__row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.war__name {
  font-weight: 600;
}

.war__track {
  height: 14px;
}

/* Thin bar from the baseline, rounded only at the data end. */
.war__bar {
  display: block;
  width: var(--w);
  min-width: 3px;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: rgba(255, 255, 255, 0.42);
  animation: war-grow 0.8s var(--ease-out) backwards;
}

.war__row.is-gc .war__bar {
  background: var(--accent);
}

@keyframes war-grow {
  from { width: 0; }
}

.war__value {
  font-family: var(--font-pixel);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Prices table */
.s-table {
  width: 100%;
  border-collapse: collapse;
}

.s-table caption {
  padding-bottom: 12px;
  text-align: left;
  color: var(--muted);
}

.s-table th,
.s-table td {
  padding: clamp(6px, 1.3vh, 11px) 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.s-table thead th {
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.s-table th[scope='row'],
.s-table thead th:first-child {
  text-align: left;
}

.s-table th[scope='row'] {
  font-weight: 500;
}

.s-table td {
  padding-left: 16px;
  font-family: var(--font-pixel);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.s-table__now {
  color: var(--accent);
}

/* Pull quote */
.s-quote {
  margin: 0 0 clamp(14px, 3vh, 26px);
}

.s-quote blockquote {
  position: relative;
  margin: 0;
  padding-left: 44px;
  font-size: clamp(1.05rem, 2.6vh, 1.45rem);
  font-style: italic;
  font-weight: 600;
  line-height: 1.3;
}

.s-quote blockquote::before {
  content: '\201C';
  position: absolute;
  left: 0;
  top: -6px;
  font-family: 'Michroma', var(--font);
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
}

.s-quote figcaption {
  margin-top: 8px;
  padding-left: 44px;
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
}

/* Paint chips */
.paints {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: clamp(10px, 2vh, 16px) 14px;
}

.paint {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: copy;
}

.paint__chip {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: transform 0.2s var(--ease-out);
}

.paint:hover .paint__chip {
  transform: translateY(-3px);
}

.paint__chip img {
  width: 78%;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
}

.paint__name {
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.paint code {
  font-family: var(--font-pixel);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--warm);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(10, 6, 30, 0.9);
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Logo & menu & characters */
.s-brand {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 0;
  --logo-a: #6b56c9;
  --logo-b: #8f7ae8;
  --logo-c: #4c3c9e;
  --logo-hole: #241a5c;
}

.logo-mark {
  width: clamp(90px, 20vh, 150px);
  filter: drop-shadow(0 12px 24px rgba(10, 4, 50, 0.6));
}

.brand .logo-mark {
  animation: logo-float 5s ease-in-out infinite;
}

@keyframes logo-float {
  50% { transform: translateY(-6px) rotate(-2deg); }
}

.brand figcaption {
  text-align: center;
  font-family: 'Michroma', var(--font);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.6;
}

.brand strong {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
}

.s-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(12px, 2.5vh, 24px) clamp(16px, 2.5vw, 32px);
}

.menu-glyph {
  display: grid;
  place-items: center;
  width: clamp(48px, 9vh, 72px);
  height: clamp(48px, 9vh, 72px);
  margin: 4px 0 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(160, 150, 255, 0.45), rgba(76, 60, 117, 0.6));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 18px var(--glow);
}

.menu-glyph svg {
  width: 60%;
  height: 60%;
}

.s-chars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: clamp(10px, 2vh, 16px) 16px;
}

.s-char {
  display: grid;
  grid-template-columns: clamp(40px, 7vh, 54px) 1fr;
  align-items: center;
  gap: 12px;
}

.s-char__avatar {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.s-char__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transform: scale(1.4);
}

.s-char h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.s-char p {
  font-size: 0.8rem;
  color: var(--muted);
}

.debut {
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  vertical-align: middle;
  background: linear-gradient(135deg, #ff8a2a, var(--gc-orange));
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .sdialog__head {
    flex-wrap: wrap;
    gap: 10px;
  }

  .s-stats,
  .s-specs,
  .s-ranked,
  .s-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .s-ranked,
  .s-facts,
  .s-brand {
    grid-template-columns: 1fr;
  }

  .hist__item {
    grid-template-columns: 70px 1fr;
    gap: 12px;
  }

  .war__row {
    grid-template-columns: 90px 1fr 52px;
  }
}
