/* ==========================================================================
   Pixel Arcade — old-school "virtual playworld" look in orange / yellow /
   black / white, matching the yellow-hat channel logo.
   ========================================================================== */

:root {
  --black: #111;
  --ink: #1c1c1c;
  --muted: #5a5a5a;
  --white: #fff;
  --paper: #fffdf6;
  --line: #b9b9b9;
  --line-dark: #7a7a7a;

  --orange: #ff8a00;
  --orange-dark: #d86a00;
  --orange-deep: #a34f00;
  --yellow: #ffcc00;
  --yellow-light: #ffe873;
  --yellow-pale: #fff6cc;

  --font: Verdana, Tahoma, Geneva, Arial, sans-serif;
  --font-display: "Luckiest Guy", "Arial Black", Impact, sans-serif;

  --side: 172px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font: 13px/1.5 var(--font);
  color: var(--ink);
  background-color: var(--black);
  background-image:
    radial-gradient(circle at 50% -20%, rgba(255, 138, 0, 0.35), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255, 204, 0, 0.05) 0 12px, transparent 12px 24px);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: #0a4fb3; }
a:hover { color: var(--orange-dark); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 0.8em; }

.skip-link {
  position: absolute; left: 8px; top: -40px; z-index: 100;
  background: var(--yellow); color: var(--black); padding: 6px 10px; font-weight: bold;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */
/* Fills the whole browser window; the page grows with the screen. */
.page {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  background: var(--white);
}
.layout { flex: 1; }

/* --------------------------------------------------------------------------
   Ads
   -------------------------------------------------------------------------- */
.ad-slot {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  background: repeating-linear-gradient(-45deg, #f4f4f4 0 8px, #ececec 8px 16px);
  border: 1px dashed var(--line-dark);
  color: #888;
  overflow: hidden;
}
.ad-slot::after {
  content: "Ad space";
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.ad-slot.is-live { background: none; border: 0; }
.ad-slot.is-live::after { content: none; }
.ad-slot:not(.is-live) ins { display: none !important; }
.ad-label {
  position: absolute; top: 2px; left: 6px;
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: #999;
}

.ad-leaderboard { width: 728px; max-width: calc(100% - 16px); height: 90px; margin: 8px auto; }
.ad-skyscraper { width: 160px; height: 600px; margin-top: 10px; }
.ad-banner { width: 100%; min-height: 90px; margin: 0 0 12px; }

/* --------------------------------------------------------------------------
   Masthead (logo strip)
   -------------------------------------------------------------------------- */
.masthead {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 50%),
    var(--black);
  border-top: 3px solid var(--orange);
  border-bottom: 3px solid var(--yellow);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
/* The hat is transparent, so it sits on an orange disc like the channel icon. */
.brand-logo {
  width: 88px; height: 88px; padding: 8px; border-radius: 50%;
  object-fit: contain;
  background: radial-gradient(circle at 40% 35%, #ffb24d, var(--orange) 60%, var(--orange-dark));
  border: 3px solid var(--black);
  box-shadow: 0 0 0 3px var(--yellow);
}
.brand-word {
  font-family: var(--font-display);
  font-size: 46px; line-height: 1;
  color: var(--yellow);
  white-space: nowrap;
  -webkit-text-stroke: 2px var(--black);
  text-shadow: 3px 3px 0 var(--orange-dark), 5px 5px 0 var(--black);
}
/* Wobbly hand-placed letters, like the old toy-brick logos */
.brand-word span { display: inline-block; }
.brand-word span:nth-child(odd) { transform: rotate(-6deg) translateY(2px); }
.brand-word span:nth-child(even) { transform: rotate(5deg) translateY(-2px); }
.brand-word span:nth-child(3n) { color: var(--white); }

.tagline {
  margin: 0 0 0 auto;
  color: var(--white);
  font-size: 18px; font-weight: bold; font-style: italic;
}
.tagline strong { color: var(--yellow); }

/* --------------------------------------------------------------------------
   Buttons — glossy 2000s style
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px;
  font: bold 13px var(--font);
  color: var(--black);
  text-decoration: none;
  border: 2px solid var(--black);
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 2px 0 var(--black);
  transition: transform 0.06s, filter 0.1s;
}
.btn:hover { filter: brightness(1.08); color: var(--black); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-yellow { background: linear-gradient(180deg, #fff3a0 0%, var(--yellow) 48%, #f0b400 52%, #ffd23a 100%); }
.btn-orange { background: linear-gradient(180deg, #ffc277 0%, var(--orange) 48%, var(--orange-dark) 52%, #ff9a22 100%); color: var(--white); text-shadow: 0 1px 0 var(--orange-deep); }
.btn-orange:hover { color: var(--white); }
.btn-gray { background: linear-gradient(180deg, #fff 0%, #e6e6e6 48%, #d2d2d2 52%, #ececec 100%); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-playnow { font-size: 20px; padding: 8px 22px; font-family: var(--font-display); letter-spacing: 0.04em; font-weight: normal; }

/* --------------------------------------------------------------------------
   Nav bar (orange strip with | separators)
   -------------------------------------------------------------------------- */
.navbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px;
  min-height: 34px;
  background: linear-gradient(180deg, #ffb24d 0%, var(--orange) 50%, var(--orange-dark) 100%);
  border-bottom: 2px solid var(--black);
}
.nav-links { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav-links li + li::before { content: "|"; color: rgba(0, 0, 0, 0.45); padding: 0 10px; }
.nav-links a {
  color: var(--white); font-weight: bold; font-size: 14px; text-decoration: none;
  text-shadow: 0 1px 0 var(--orange-deep);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--yellow-light); text-decoration: underline; }

.nav-toggle { display: none; }

.auth-area { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--white); font-weight: bold; }
.auth-area .user-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 0 var(--orange-deep); }

/* --------------------------------------------------------------------------
   3-column layout: member box + ad | content | ad
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr) var(--side);
  gap: 12px;
  padding: 12px;
  align-items: start;
}
.side { display: flex; flex-direction: column; align-items: center; }
.side > .box { width: 100%; }
.content { min-width: 0; }

/* --------------------------------------------------------------------------
   Boxes (panels with a gradient title bar)
   -------------------------------------------------------------------------- */
.box {
  background: var(--paper);
  border: 1px solid var(--line-dark);
  margin-bottom: 12px;
}
.box-head {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  font-size: 15px; font-weight: bold;
  color: var(--black);
  background: linear-gradient(180deg, var(--yellow-light) 0%, var(--yellow) 55%, var(--orange) 100%);
  border-bottom: 1px solid var(--line-dark);
}
.box-head-note { margin-left: auto; font-size: 11px; font-weight: normal; color: #3a2a00; }
.box-sub { margin: 8px 10px; color: var(--muted); }

/* ---- Member login box ---- */
.member-box { font-size: 11px; }
.member-box .box-head { font-size: 12px; }
.member-body { padding: 8px; }
.member-box label { display: block; font-weight: bold; margin-bottom: 6px; }
.member-box input {
  display: block; width: 100%; margin-top: 2px; padding: 3px 4px;
  font: 12px var(--font);
  border: 1px dashed var(--line-dark); background: var(--white);
}
.member-box .btn { margin-top: 4px; }
.member-box .member-links { margin: 8px 0 0; text-align: center; }
.member-box .member-links a { display: block; margin-top: 3px; }
.member-hello { text-align: center; }
.member-hello img { width: 72px; height: 72px; padding: 6px; margin: 0 auto 6px; object-fit: contain; border-radius: 50%; border: 2px solid var(--black); background: var(--orange); }
.member-hello strong { display: block; font-size: 13px; word-break: break-word; }
.member-msg { color: #b00020; margin: 6px 0 0; }

/* ---- Welcome panel ---- */
.welcome-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; padding: 12px; }
.welcome-free { font-weight: bold; font-size: 14px; }
.feature-list { list-style: none; margin: 0; padding: 0; }
.feature-list li { display: flex; gap: 10px; margin-bottom: 12px; }
.feature-list strong { color: #0a4fb3; font-size: 13px; }
.feature-list p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.feature-icon {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 20px; color: var(--black);
  background: radial-gradient(circle at 35% 30%, #fff6b0, var(--yellow) 55%, var(--orange) 100%);
  border: 2px solid var(--black);
}

.featured {
  display: flex; flex-direction: column;
  background: var(--black);
  border: 2px solid var(--black);
  text-decoration: none;
  overflow: hidden;
}
.featured-title {
  padding: 10px 12px 6px;
  font-family: var(--font-display); font-size: 34px; line-height: 1;
  color: var(--white); letter-spacing: 0.02em;
}
.featured-thumb { display: block; aspect-ratio: 16 / 9; background: #222; }
.featured-thumb img { width: 100%; height: 100%; object-fit: cover; }
.featured-cta {
  margin: 8px; padding: 8px;
  text-align: center; font-weight: bold; font-size: 15px; color: var(--black);
  background: linear-gradient(180deg, #fff3a0 0%, var(--yellow) 48%, #f0b400 52%, #ffd23a 100%);
  border: 2px solid var(--orange-dark); border-radius: 4px;
}
.featured:hover .featured-cta { filter: brightness(1.08); }

/* ---- Game grid ---- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  padding: 0 10px 12px;
}
.game-card {
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
  transition: border-color 0.1s, box-shadow 0.1s;
}
.game-card:hover { border-color: var(--orange); box-shadow: 0 0 0 2px var(--yellow); color: var(--ink); }
.game-card-thumb { position: relative; aspect-ratio: 16 / 9; background: #222; overflow: hidden; }
.game-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play-badge {
  position: absolute; right: 6px; bottom: 6px;
  padding: 2px 8px; font-size: 11px; font-weight: bold;
  background: var(--yellow); color: var(--black); border: 1px solid var(--black); border-radius: 3px;
  opacity: 0; transition: opacity 0.1s;
}
.game-card:hover .play-badge { opacity: 1; }
.game-card-body { padding: 6px 8px 8px; }
.game-card-body h3 { font-size: 13px; color: #0a4fb3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card-body p { margin: 2px 0 4px; font-size: 11px; color: var(--muted); }
.game-stats { display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.game-stats .stat-like { color: var(--orange-dark); font-weight: bold; }

.empty { padding: 10px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Game page
   -------------------------------------------------------------------------- */
.breadcrumb { margin: 0 0 8px; font-size: 12px; }

.player { padding: 10px; }
.game-frame-wrap {
  position: relative;
  aspect-ratio: var(--aspect, 4 / 3);
  max-height: 72vh;
  margin: 0 auto;
  background: var(--black);
  border: 3px solid var(--black);
  box-shadow: 0 0 0 2px var(--yellow);
}
.game-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.game-frame-wrap:fullscreen { max-height: none; border: 0; box-shadow: none; }
.game-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--yellow); font-weight: bold; }

.player-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.player-spacer { flex: 1; }

.like-btn { font-size: 14px; }
.like-heart { color: var(--orange-deep); font-size: 16px; }
.like-count {
  min-width: 24px; padding: 0 6px; margin-left: 4px;
  background: var(--black); color: var(--yellow); border-radius: 3px; font-size: 12px;
}
.like-btn[aria-pressed="true"] { background: linear-gradient(180deg, #ffc277 0%, var(--orange) 48%, var(--orange-dark) 52%, #ff9a22 100%); color: var(--white); }
.like-btn[aria-pressed="true"] .like-heart { color: var(--white); }

.game-info { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; padding: 10px; }
.game-meta {
  align-self: start;
  padding: 8px 10px;
  background: var(--yellow-pale);
  border: 1px solid var(--orange);
}
.game-meta strong { display: block; margin-bottom: 2px; }

/* ---- Comments ---- */
.comment-form { padding: 10px; border-bottom: 1px solid var(--line); }
.comment-form textarea {
  display: block; width: 100%; min-height: 70px; resize: vertical;
  padding: 6px; margin-bottom: 6px;
  font: 13px var(--font);
  border: 1px solid var(--line-dark); background: var(--white);
}
.comment-form-row { display: flex; align-items: center; gap: 8px; }
.comment-form-row small { color: var(--muted); margin-right: auto; }
.comments-locked { padding: 10px; border-bottom: 1px solid var(--line); background: var(--yellow-pale); }
.comments-locked p { margin: 0 0 6px; }

.comment-list { list-style: none; margin: 0; padding: 0; }
.comment { display: flex; gap: 10px; padding: 10px; }
.comment:nth-child(even) { background: #f6f1e2; }
.comment-avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  font-weight: bold; font-size: 16px; color: var(--black);
  background: var(--yellow); border: 2px solid var(--black);
}
.comment-main { min-width: 0; flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-head strong { color: #0a4fb3; }
.comment-head time { font-size: 11px; color: var(--muted); }
.comment-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-delete {
  margin-left: auto; padding: 0; border: 0; background: none;
  font: 11px var(--font); color: #b00020; cursor: pointer; text-decoration: underline;
}
.comment-empty { padding: 10px; color: var(--muted); }

/* ---- More games ---- */
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 10px; }
.mini-card { display: block; text-decoration: none; font-size: 12px; font-weight: bold; }
.mini-card img { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; border: 1px solid var(--line); margin-bottom: 4px; }
.mini-card:hover img { border-color: var(--orange); }

.not-found { padding: 24px; text-align: center; }
.not-found h1 { margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */
.about { display: flex; gap: 18px; padding: 14px; align-items: flex-start; }
.about-avatar { flex: none; width: 160px; height: 160px; padding: 16px; object-fit: contain; border-radius: 50%; background: var(--black); border: 4px solid var(--black); box-shadow: 0 0 0 4px var(--orange); }
.about h2 { font-size: 20px; margin-bottom: 8px; }
.about-facts { border-collapse: collapse; margin: 4px 0 14px; }
.about-facts th, .about-facts td { padding: 4px 10px; border: 1px solid var(--line); text-align: left; }
.about-facts th { background: var(--yellow-pale); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  padding: 12px 16px 16px;
  text-align: center; font-size: 11px;
  color: #ddd; background: var(--black);
  border-top: 3px solid var(--orange);
}
.site-footer p { margin: 0 0 4px; }
.site-footer a { color: var(--yellow); }
.footer-fine { color: #888; }

/* --------------------------------------------------------------------------
   Login / signup modal
   -------------------------------------------------------------------------- */
.modal {
  width: min(380px, calc(100% - 32px));
  padding: 0;
  border: 3px solid var(--black);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--yellow), 0 10px 40px rgba(0, 0, 0, 0.6);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal .box-head { font-size: 16px; padding-right: 36px; }
.modal-close {
  position: absolute; top: 4px; right: 6px;
  width: 26px; height: 26px; border: 2px solid var(--black); border-radius: 50%;
  background: var(--white); font: bold 16px/1 var(--font); cursor: pointer;
}
.modal-body { padding: 12px 14px 16px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 2px solid var(--orange); }
.auth-tab {
  flex: 1; padding: 6px; font: bold 13px var(--font); cursor: pointer;
  background: #e8e8e8; border: 1px solid var(--line-dark); border-bottom: 0;
}
.auth-tab[aria-selected="true"] { background: var(--yellow); }
.modal form label { display: block; margin-bottom: 10px; font-weight: bold; }
.modal form input {
  display: block; width: 100%; margin-top: 3px; padding: 6px;
  font: 13px var(--font); border: 1px solid var(--line-dark); background: var(--white);
}
.modal form p { color: var(--muted); }
.auth-link { display: inline-block; margin-top: 10px; font-size: 12px; }
.auth-message { padding: 6px 8px; margin: 0 0 10px; border: 1px solid #b00020; background: #ffe6ea; color: #7a0016; }
.auth-message[data-type="success"] { border-color: #1b7a2a; background: #e3f6e6; color: #10501b; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; }
.toast {
  padding: 8px 14px; max-width: 320px;
  background: var(--black); color: var(--yellow); font-weight: bold;
  border: 2px solid var(--orange);
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.is-leaving { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  /* Drop the right skyscraper first; the left one stays with the member box. */
  .layout { grid-template-columns: var(--side) minmax(0, 1fr); }
  .side-right { display: none; }
}

@media (max-width: 860px) {
  .welcome-body, .game-info { grid-template-columns: 1fr; }
  .tagline { display: none; }
  .brand-word { font-size: 34px; }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; padding: 10px; }
  .side-left { order: 2; }
  .ad-skyscraper { display: none; }
  .ad-leaderboard { height: 60px; }

  .masthead { padding: 8px 12px; gap: 10px; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-word { font-size: 24px; -webkit-text-stroke-width: 1px; text-shadow: 2px 2px 0 var(--orange-dark), 3px 3px 0 var(--black); }
  .btn-playnow { margin-left: auto; font-size: 15px; padding: 6px 12px; }

  .navbar { flex-wrap: wrap; padding: 4px 10px; }
  .nav-toggle {
    display: inline-block; padding: 4px 8px;
    font: bold 13px var(--font); color: var(--white);
    background: none; border: 1px solid rgba(0, 0, 0, 0.4); border-radius: 4px; cursor: pointer;
  }
  .nav-links { display: none; width: 100%; order: 3; flex-direction: column; padding: 4px 0; }
  .navbar.is-open .nav-links { display: flex; }
  .nav-links li + li::before { content: none; }
  .nav-links a { display: block; padding: 6px 0; }

  .about { flex-direction: column; align-items: center; text-align: center; }
  .about-facts { margin-inline: auto; }
}

@media (max-width: 480px) {
  .brand-word { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
