@font-face {
  font-family: "Cubic 11";
  src:
    url("/assets/fonts/Cubic_11.woff2") format("woff2"),
    url("/assets/fonts/Cubic_11.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #effafe;
  --muted-ink: #8caec2;
  --panel: #0f1721;
  --panel-raised: #172431;
  --grid-line: #293742;
  --cyan: #24d1ff;
  --green: #66ff73;
  --yellow: #ffd13a;
  --red: #ff515c;
  --bg: #060910;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 20% 5%, #112031 0%, var(--bg) 42%), var(--bg);
  font-family: "Cubic 11", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  min-height: 100vh;
  position: relative;
}

.pixel-grid {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(41, 55, 66, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(41, 55, 66, 0.45) 1px, transparent 1px);
  background-size: 12px 12px;
  opacity: 0.45;
  z-index: -1;
}

.wrapper {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.hero {
  display: grid;
  gap: 1.2rem;
  padding: 2.3rem 0 1.2rem;
  grid-template-columns: 1.3fr 0.8fr;
}

.brand-box,
.hero-stat-panel,
.panel,
.footer {
  background: var(--panel);
  border: 1px solid rgba(239, 250, 254, 0.18);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(18px);
  animation: boxFadeIn 0.7s ease-out forwards;
}

.brand-box {
  animation-delay: 0.12s;
}

.hero-stat-panel {
  animation-delay: 0.24s;
}

.sections .panel:nth-child(1) {
  animation-delay: 0.36s;
}

.sections .panel:nth-child(2) {
  animation-delay: 0.48s;
}

.sections .panel:nth-child(3) {
  animation-delay: 0.6s;
}

.sections .panel:nth-child(4) {
  animation-delay: 0.72s;
}

.sections .panel:nth-child(5) {
  animation-delay: 0.84s;
}

.footer {
  animation-delay: 0.96s;
}

.brand-box {
  padding: 1.1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 138px 1fr;
  align-items: center;
}

.brand-logo {
  width: 100%;
  max-width: 138px;
  aspect-ratio: 1;
  transform-origin: center;
  animation: logoSpinIn 1.8s cubic-bezier(0.2, 0.85, 0.25, 1) 1 both;
}

@keyframes logoSpinIn {
  0% {
    transform: rotate(0deg);
  }
  75% {
    transform: rotate(-1080deg);
  }
  100% {
    transform: rotate(-1080deg);
  }
}

@keyframes boxFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kicker,
.panel-tag,
h1,
h2,
.score,
.flow span {
  font-family: "Cubic 11", system-ui, sans-serif;
}

.kicker {
  margin: 0;
  color: var(--muted-ink);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--cyan);
  line-height: 1;
}

.subtitle {
  margin: 0.4rem 0 0.75rem;
  color: var(--yellow);
  font-weight: 700;
}

.brand-copy p:last-child {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
}

.hero-stat-panel {
  padding: 1rem;
  background: linear-gradient(150deg, #112233 0%, #0f1721 55%, #121f2c 100%);
  border-top: 3px solid var(--cyan);
}

.panel-tag {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink);
}

.score {
  margin: 0.6rem 0 1rem;
  font-size: clamp(2.5rem, 8vw, 4.2rem);
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(36, 209, 255, 0.35);
  line-height: 1;
}

.panel-meta {
  margin: -0.5rem 0 0.8rem;
  color: var(--muted-ink);
  font-size: 0.82rem;
}

.rank-btn {
  font-family: "Cubic 11", system-ui, sans-serif;
  font-size: 0.72rem;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(255, 209, 58, 0.8);
  background: rgba(15, 23, 33, 0.85);
  color: var(--yellow);
  cursor: pointer;
}

.rank-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.mono,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mono {
  margin: 0;
  color: var(--muted-ink);
  font-size: 0.82rem;
}

code {
  display: block;
  margin-top: 0.52rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 81, 92, 0.5);
  color: var(--green);
  padding: 0.65rem;
  overflow-x: auto;
}

.sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: 1.3rem;
}

.panel {
  padding: 1rem;
  position: relative;
}

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

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.panel-cyan::before {
  background: var(--cyan);
}

.panel-yellow::before {
  background: var(--yellow);
}

.panel-green::before {
  background: var(--green);
}

.panel-red::before {
  background: var(--red);
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}

ul {
  margin: 0;
  padding-left: 1.1rem;
  line-height: 1.7;
  color: var(--ink);
}

li::marker {
  color: var(--cyan);
}

.panel-yellow p,
.panel-green p,
.panel p {
  margin: 0.35rem 0;
  line-height: 1.7;
}

.appstore-link {
  margin-top: 0.8rem;
  display: inline-block;
  width: 50%;
  text-decoration: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.appstore-image {
  width: 100%;
  display: block;
  aspect-ratio: 1566 / 559;
  object-fit: cover;
}

.appstore-link:hover {
  opacity: 0.9;
}

.store-link {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  border: 1px solid rgba(36, 209, 255, 0.55);
  background: linear-gradient(180deg, rgba(13, 20, 29, 0.95), rgba(7, 12, 18, 0.95));
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  padding: 0.62rem;
}

.store-icon {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 1px;
  background: rgba(18, 28, 41, 0.9);
  border: 1px solid rgba(36, 209, 255, 0.45);
  padding: 3px;
  flex: 0 0 auto;
}

.store-icon span {
  display: block;
  background: #2dbbff;
}

.store-icon span:nth-child(1),
.store-icon span:nth-child(5),
.store-icon span:nth-child(21),
.store-icon span:nth-child(25) {
  background: transparent;
}

.store-copy {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.store-copy strong {
  margin: 0;
  font-family: "Cubic 11", system-ui, sans-serif;
  font-size: 0.86rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.store-copy small {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  color: var(--muted-ink);
}

.store-link:hover {
  border-color: var(--yellow);
}

.store-link:hover .store-copy strong {
  color: var(--yellow);
}

.watch-sell {
  max-width: 72ch;
}

.device-art {
  width: min(100%, 760px);
  margin: 0.9rem auto 0.35rem;
  border: 1px solid rgba(36, 209, 255, 0.3);
  background: rgba(9, 18, 30, 0.7);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.device-art-image {
  width: 100%;
  display: block;
}

.flow {
  display: grid;
  gap: 0.5rem;
}

.flow span {
  background: var(--panel-raised);
  border: 1px solid rgba(36, 209, 255, 0.35);
  color: var(--cyan);
  padding: 0.68rem;
  text-align: center;
  position: relative;
}

.flow span:not(:last-child)::after {
  content: "▼";
  color: var(--yellow);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -1.25rem;
  font-size: 0.8rem;
}

.footer {
  margin-bottom: 1.4rem;
  padding: 0.72rem 0.8rem;
  border-top: 3px solid var(--cyan);
  font-family: "Cubic 11", system-ui, sans-serif;
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.footer-left {
  display: grid;
  gap: 0.1rem;
}

.footer p {
  margin: 0.22rem 0;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.footer-links {
  margin: 0;
  font-size: 0.8rem;
  padding-top: 0.1rem;
}

.terms-link {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dashed rgba(36, 209, 255, 0.6);
  padding-bottom: 0.05rem;
  letter-spacing: 0.02em;
}

.terms-link:hover {
  color: #8be8ff;
}

.byross {
  margin-top: 0.2rem;
  max-width: 64px;
  width: 100%;
  height: auto;
  transform-origin: left center;
  transition: transform 160ms ease, filter 160ms ease;
}

.byross:hover {
  filter: drop-shadow(0 0 10px rgba(36, 209, 255, 0.28));
  transform: scale(1.12);
}

.small {
  margin-top: 0.45rem;
  color: var(--muted-ink);
  font-size: 0.68rem;
  line-height: 1.45;
  font-family: system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 16, 0.86);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 40;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.terms-modal {
  width: min(760px, 100%);
  max-height: min(84vh, 760px);
  overflow-y: auto;
  background: linear-gradient(180deg, #0b1724 0%, #0a111b 100%);
  border: 1px solid rgba(36, 209, 255, 0.42);
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.5);
}

.terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(36, 209, 255, 0.42);
}

.terms-header h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--cyan);
}

.terms-close {
  font-family: "Cubic 11", system-ui, sans-serif;
  font-size: 0.7rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255, 209, 58, 0.75);
  color: var(--yellow);
  background: #0f1721;
  cursor: pointer;
}

.terms-content {
  padding: 1rem;
  line-height: 1.8;
}

.terms-content p {
  margin: 0 0 0.65rem;
}

.terms-content a {
  color: var(--cyan);
}

.rank-modal {
  width: min(900px, 100%);
}

.rank-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.rank-toolbar label {
  color: var(--muted-ink);
  font-size: 0.85rem;
}

.rank-toolbar select {
  background: #0f1721;
  color: var(--ink);
  border: 1px solid rgba(36, 209, 255, 0.45);
  padding: 0.35rem 0.45rem;
}

.rank-note {
  color: var(--muted-ink);
  font-size: 0.82rem;
}

.rank-table-wrap {
  margin-top: 0.5rem;
  border: 1px solid rgba(36, 209, 255, 0.24);
  overflow-x: auto;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.rank-table th,
.rank-table td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(36, 209, 255, 0.18);
  font-size: 0.86rem;
}

.rank-table th {
  color: var(--cyan);
  font-family: "Cubic 11", system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

.rank-table td {
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .brand-logo,
  .brand-box,
  .hero-stat-panel,
  .panel,
  .footer {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 960px) {
  .hero,
  .sections {
    grid-template-columns: 1fr;
  }

  .brand-box {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .brand-logo {
    max-width: 116px;
  }

  .brand-copy {
    text-align: center;
  }

  .terms-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .rank-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .wrapper {
    width: min(1100px, calc(100% - 1.1rem));
  }

  .hero {
    padding-top: 1.2rem;
  }

  .hero-stat-panel {
    text-align: center;
  }

  .hero-stat-panel .panel-meta {
    margin-inline: auto;
  }

  .hero-stat-panel .rank-btn {
    display: inline-flex;
    justify-content: center;
    margin: 0.8rem auto 0;
  }

  .brand-box,
  .hero-stat-panel,
  .panel,
  .footer {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  }

  .footer {
    margin-bottom: 1rem;
    padding: 0.62rem 0.7rem;
  }

  .footer-top {
    align-items: center;
  }

  h2 {
    font-size: 0.88rem;
  }

  ul,
  .panel p {
    font-size: 0.92rem;
  }

  .appstore-link {
    width: 70%;
  }

  .footer-links {
    font-size: 0.72rem;
    padding-top: 0;
  }
}
