/* game388 — Phase / spectrum shell (ph-) */
:root {
  --ph-void: #05040a;
  --ph-surface: #0f0d18;
  --ph-line: rgba(245, 158, 255, 0.12);
  --ph-ink: #e8e4f0;
  --ph-muted: #8b8199;
  --ph-hot: #ff2d95;
  --ph-cool: #00e5ff;
  --ph-amber: #ffc14d;
  --ph-glow: rgba(255, 45, 149, 0.35);
  --ph-font: "Outfit", system-ui, sans-serif;
  --ph-display: "Orbitron", ui-sans-serif, sans-serif;
  --ph-rad: 16px;
  --ph-shell: min(100%, 1320px);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--ph-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ph-ink);
  background: var(--ph-void);
  min-height: 100dvh;
}

img { max-width: 100%; height: auto; display: block; }

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

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 2000;
  padding: 10px 16px; background: var(--ph-hot); color: #0a0510; font-weight: 600;
  border-radius: 8px; text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: 12px; }

/* --- App frame --- */
.ph-app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 100% 80% at 50% -20%, rgba(0, 229, 255, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 50% at 100% 50%, rgba(255, 45, 149, 0.06), transparent 45%),
    var(--ph-void);
}

.ph-top {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: var(--ph-shell);
  margin-inline: auto;
  padding: 16px clamp(16px, 4vw, 28px) 12px;
  border-bottom: 1px solid var(--ph-line);
  background: linear-gradient(180deg, rgba(15, 13, 24, 0.95), rgba(5, 4, 10, 0.4));
  backdrop-filter: blur(8px);
}

.ph-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.ph-brand img {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--ph-hot);
  box-shadow: 0 0 20px var(--ph-glow);
}

.ph-site {
  display: flex; flex-direction: column; gap: 2px;
}
.ph-site__name { font-family: var(--ph-display); font-size: 15px; font-weight: 700; letter-spacing: 0.06em; }
.ph-site__tag { font-size: 12px; color: var(--ph-muted); }

.ph-dock {
  display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: flex-end;
  align-items: center;
}

.ph-dock a {
  color: var(--ph-muted);
  text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: 999px; border: 1px solid transparent;
}
.ph-dock a:hover { color: var(--ph-ink); border-color: var(--ph-line); }
.ph-dock a[aria-current="page"] { color: var(--ph-cool); border-color: rgba(0, 229, 255, 0.35); }

.ph-search {
  display: flex; align-items: center; gap: 0; margin-left: 4px;
}
.ph-search input {
  width: min(200px, 32vw);
  background: var(--ph-surface);
  border: 1px solid var(--ph-line);
  color: var(--ph-ink);
  padding: 8px 12px; border-radius: 999px 0 0 999px; font: inherit; font-size: 13px;
  outline: none;
}
.ph-search input:focus { border-color: var(--ph-cool); }
.ph-search button {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border: 1px solid var(--ph-line);
  border-left: 0; background: var(--ph-surface);
  color: var(--ph-hot);
  border-radius: 0 999px 999px 0; cursor: pointer;
}
.ph-search button:hover { background: rgba(255, 45, 149, 0.12); }

.ph-burger {
  display: none;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--ph-line); background: var(--ph-surface);
  color: var(--ph-ink); cursor: pointer;
}

/* Mobile nav panel */
body.nav-open { overflow: hidden; }

@media (max-width: 900px) {
  .ph-dock { display: none; }
  .ph-burger { display: inline-block; }
}

.ph-panel[hidden] { display: none !important; }

.ph-panel {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(5, 4, 10, 0.88);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px 80px;
  overflow: auto;
}
.ph-panel-inner {
  width: 100%; max-width: 360px;
  background: var(--ph-surface);
  border: 1px solid var(--ph-line);
  border-radius: var(--ph-rad);
  padding: 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.ph-panel-inner a {
  color: var(--ph-ink); text-decoration: none; padding: 12px 8px; border-radius: 8px; font-weight: 500;
}
.ph-panel-inner a:hover { background: rgba(255, 45, 149, 0.1); }

/* Main */
.ph-main {
  flex: 1;
  width: 100%;
  max-width: var(--ph-shell);
  margin-inline: auto;
  padding: 0 clamp(16px, 4vw, 28px) max(48px, env(safe-area-inset-bottom, 0px));
}

/* Sweep lines */
.ph-sweep {
  display: flex; height: 4px; margin: 0 0 28px; border-radius: 2px; overflow: hidden;
  background: var(--ph-surface);
}
.ph-sweep__bar { flex: 1; }
.ph-sweep__bar--a { background: linear-gradient(90deg, var(--ph-hot), transparent); }
.ph-sweep__bar--b { background: linear-gradient(90deg, var(--ph-cool), var(--ph-amber)); }
.ph-sweep__bar--c { background: linear-gradient(90deg, transparent, var(--ph-hot)); }

/* Orbit spotlight */
.ph-orbit-wrap {
  display: grid;
  gap: 28px;
  margin-bottom: 40px;
  align-items: center;
}

@media (min-width: 900px) {
  .ph-orbit-wrap {
    grid-template-columns: 1fr minmax(260px, 0.95fr);
    gap: 32px 40px;
  }
}

.ph-copy { max-width: 420px; }
.ph-kicker {
  font-family: var(--ph-display);
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--ph-cool); margin: 0 0 8px;
}
.ph-h1 {
  font-family: var(--ph-display);
  font-size: clamp(1.6rem, 3.5vw, 2.35rem);
  line-height: 1.12; margin: 0 0 12px; font-weight: 700;
  text-shadow: 0 0 40px var(--ph-glow);
}
.ph-lead { margin: 0; color: var(--ph-muted); font-size: 1rem; }
.ph-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.ph-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; font: inherit;
}
.ph-btn--glow {
  background: linear-gradient(135deg, var(--ph-hot), #c21d7a);
  color: #fff; box-shadow: 0 8px 32px var(--ph-glow);
}
.ph-btn--glow:hover { filter: brightness(1.08); }
.ph-btn--line {
  background: transparent; color: var(--ph-ink);
  border-color: var(--ph-line);
}
.ph-btn--line:hover { border-color: var(--ph-cool); color: var(--ph-cool); }

/* Circular portal */
.ph-portal {
  position: relative;
  justify-self: center;
  width: min(100%, 340px);
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    conic-gradient(from 180deg at 50% 50%, rgba(255, 45, 149, 0.2), rgba(0, 229, 255, 0.15), rgba(255, 193, 77, 0.12), rgba(255, 45, 149, 0.2));
  padding: 3px; box-shadow: 0 0 60px rgba(255, 45, 149, 0.25);
}
.ph-portal__inner {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--ph-void);
  position: relative;
}
.ph-portal__inner img { width: 100%; height: 100%; object-fit: cover; }
.ph-portal__link { display: block; width: 100%; height: 100%; text-decoration: none; color: inherit; }
.ph-portal__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 16px 16px;
  background: linear-gradient(transparent, rgba(5, 4, 10, 0.95));
  text-align: center;
}
.ph-portal__label { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ph-amber); }
.ph-portal__title { font-family: var(--ph-display); font-size: 1rem; font-weight: 600; margin: 4px 0 0; }
.ph-portal__type { font-size: 12px; color: var(--ph-muted); margin: 2px 0 0; }

/* Satellites (decorative) */
.ph-sat { position: absolute; border-radius: 50%; pointer-events: none; }
.ph-sat--1 { width: 8px; height: 8px; background: var(--ph-cool); top: 12%; right: 4%; box-shadow: 0 0 12px var(--ph-cool); }
.ph-sat--2 { width: 5px; height: 5px; background: var(--ph-amber); bottom: 20%; left: 2%; }
.ph-sat--3 { width: 4px; height: 4px; background: var(--ph-hot); top: 40%; left: 0; }

/* Detail: lazy iframe game stage */
.ph-game-stage {
  margin: 0 0 40px;
  border: 1px solid var(--ph-line);
  border-radius: var(--ph-rad);
  background: var(--ph-surface);
  overflow: hidden;
}
.ph-game-stage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ph-line);
  background: rgba(5, 4, 10, 0.6);
}
.ph-game-mobile-exit {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--ph-line);
  background: var(--ph-void);
  color: var(--ph-ink);
  cursor: pointer;
}
.ph-game-stage-traffic { display: inline-flex; gap: 5px; margin-right: auto; }
.ph-game-stage-dot { width: 9px; height: 9px; border-radius: 50%; }
.ph-game-stage-dot--close { background: #ff5f57; }
.ph-game-stage-dot--min { background: #febc2e; }
.ph-game-stage-dot--max { background: #28c840; }
.ph-game-stage-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ph-muted); }
.ph-game-stage-viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: min(70vh, 640px);
  background: var(--ph-void);
}
.ph-play-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ph-poster-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}
.ph-play-poster-overlay {
  position: relative;
  z-index: 1;
  max-width: 320px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--ph-line);
  background: rgba(5, 4, 10, 0.82);
  backdrop-filter: blur(6px);
}
.ph-play-poster-text { margin: 0; font-size: 14px; color: var(--ph-ink); line-height: 1.45; }
.ph-game-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.ph-game-stage-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 12px;
  border-top: 1px solid var(--ph-line);
}
body.ph-game-detail-no-scroll { overflow: hidden; }
.ph-game-stage.is-mobile-theater {
  position: fixed;
  inset: 0;
  z-index: 2000;
  margin: 0;
  border-radius: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}
.ph-game-stage.is-mobile-theater .ph-game-stage-viewport {
  flex: 1;
  max-height: none;
  aspect-ratio: auto;
}

/* Ad slots (shared) */
.ad-slot { margin: 32px 0; padding: 12px; border: 1px dashed var(--ph-line); border-radius: var(--ph-rad); }
.ad-slot-hint { margin: 0 0 8px; text-align: center; font-size: 11px; color: var(--ph-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.ad-slot-inner {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Spectrum genres */
.ph-spec { margin: 0 0 40px; }
.ph-spec h2 { font-family: var(--ph-display); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ph-muted); margin: 0 0 20px; }
.ph-spec__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  justify-content: center;
}
@media (max-width: 600px) {
  .ph-spec__grid { justify-content: center; }
}

.ph-spec__link {
  flex: 1 1 88px;
  min-width: 72px;
  max-width: 140px;
  display: flex; flex-direction: column; align-items: center; text-decoration: none; color: inherit;
  padding: 8px 4px; border-radius: 12px; border: 1px solid transparent; transition: border-color 0.2s, transform 0.2s;
}
.ph-spec__link:hover { border-color: var(--ph-line); transform: translateY(-2px); }
.ph-spec__bar {
  width: 100%; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--ph-hot), #5c1038);
  min-height: 24px; margin-bottom: 8px; opacity: 0.9;
}
.ph-spec__link:nth-child(2) .ph-spec__bar { background: linear-gradient(180deg, var(--ph-cool), #083844); }
.ph-spec__link:nth-child(3) .ph-spec__bar { background: linear-gradient(180deg, #f472b6, #5b1a4a); }
.ph-spec__link:nth-child(4) .ph-spec__bar { background: linear-gradient(180deg, var(--ph-amber), #6b3d0a); }
.ph-spec__link:nth-child(5) .ph-spec__bar { background: linear-gradient(180deg, #a78bfa, #3b1f6b); }
.ph-spec__name { font-size: 12px; font-weight: 600; text-align: center; }
.ph-spec__n { font-size: 11px; color: var(--ph-muted); }

/* Channel bands */
.ph-band { margin-bottom: 32px; }
.ph-band__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ph-band__label {
  font-family: var(--ph-display); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0;
  color: var(--ph-cool);
}
.ph-band--drift .ph-band__label { color: var(--ph-amber); }
.ph-band--void .ph-band__label { color: var(--ph-hot); }
.ph-band__tools { display: flex; gap: 4px; }
.ph-band__tools button {
  width: 36px; height: 32px; border-radius: 8px; font: inherit; font-size: 16px; line-height: 1;
  border: 1px solid var(--ph-line); background: var(--ph-surface); color: var(--ph-ink);
  cursor: pointer;
}
.ph-band__tools button:hover { background: rgba(0, 229, 255, 0.1); }

/* Home catalog grid (replaces stacked narrow rails) */
.ph-catalog {
  margin-bottom: 36px;
}

.ph-catalog__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ph-catalog__title {
  font-family: var(--ph-display);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ph-muted);
  margin: 0;
}

.ph-catalog__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--ph-cool);
}

.ph-catalog__more:hover {
  text-decoration: underline;
}

.ph-catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .ph-catalog__grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 14px;
  }
}

@media (min-width: 1100px) {
  .ph-catalog__grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.ph-catalog .ph-card a {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ph-catalog .ph-card__body {
  flex: 1;
}

.ph-rail {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px 2px 16px; margin: 0 -4px; scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.ph-rail::-webkit-scrollbar { height: 6px; }
.ph-rail::-webkit-scrollbar-thumb { background: var(--ph-line); border-radius: 3px; }

.ph-card { flex: 0 0 200px; scroll-snap-align: start; }

.ph-card.ph-card--grid,
.ph-catalog__grid .ph-card {
  flex: unset;
  min-width: 0;
  scroll-snap-align: none;
}

.ph-card a {
  display: block; text-decoration: none; color: inherit;
  background: var(--ph-surface);
  border: 1px solid var(--ph-line);
  border-radius: 14px; overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.ph-card a:hover { border-color: rgba(0, 229, 255, 0.4); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); }
.ph-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.ph-card__body { padding: 10px 10px 12px; }
.ph-card__title { font-size: 14px; font-weight: 600; margin: 0; line-height: 1.25; }
.ph-card__type { font-size: 11px; color: var(--ph-muted); margin: 4px 0 0; }

/* Mesh grid (dense) */
.ph-mesh h2 { font-family: var(--ph-display); font-size: 14px; margin: 0 0 16px; letter-spacing: 0.1em; }
.ph-mesh__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}

@media (min-width: 640px) {
  .ph-mesh__grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
  }
}

@media (min-width: 900px) {
  .ph-mesh__grid {
    grid-template-columns: repeat(9, 1fr);
  }
}

.ph-cell a {
  display: block; text-decoration: none; color: inherit;
  position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--ph-line);
  aspect-ratio: 1; background: var(--ph-surface);
}
.ph-cell a:hover { border-color: var(--ph-hot); }
.ph-cell img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.ph-cell a:hover img { opacity: 1; }
.ph-cell__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px;
  font-size: 9px; line-height: 1.2; text-align: center;
  background: linear-gradient(transparent, rgba(5, 4, 10, 0.92));
  color: #fff; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Footer */
.ph-foot {
  margin-top: auto;
  width: 100%;
  max-width: var(--ph-shell);
  margin-inline: auto;
  padding: 24px clamp(16px, 4vw, 28px) max(32px, calc(16px + env(safe-area-inset-bottom, 0px)));
  border-top: 1px solid var(--ph-line);
  text-align: center; font-size: 12px; color: var(--ph-muted);
}
.ph-foot__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin: 0 0 8px; }
.ph-foot__nav a { color: var(--ph-muted); text-decoration: none; }
.ph-foot__nav a:hover { color: var(--ph-cool); }
.ph-foot__copy { margin: 0; }
