/* Fitz & Pop brand: cream #F4DAB5, logo blue #5B85D8 */
:root[data-theme="dark"] {
  --bg: #0e0e12; --panel: #1a1a22; --panel-2: #23232f; --line: #2c2c3a;
  --text: #f4f4f8; --muted: #a6a6b8; --title: #7aa0e6; --accent: #5b85d8;
  --accent-contrast: #ffffff; --gold: #e8c15a; --logo-pad: #f4dab5;
  --tile-bg: #0d0d14;
}
:root[data-theme="light"] {
  --bg: #f4dab5; --panel: #ffffff; --panel-2: #fbf3e6; --line: #e4c99b;
  --text: #1a1a1a; --muted: #7a6f57; --title: #4d78cf; --accent: #5b85d8;
  --accent-contrast: #ffffff; --gold: #b78a1f; --logo-pad: #f4dab5;
  --tile-bg: #efe3cc;
}
:root { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text); transition: background .2s, color .2s; }
a { color: inherit; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.4rem; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); z-index: 10; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; text-decoration: none;
  font-size: 1.15rem; color: var(--title); }
.brand img { height: 30px; width: auto; display: block; border-radius: 6px; }
.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { text-decoration: none; color: var(--muted); font-size: .92rem; }
.nav a.active, .nav a:hover { color: var(--text); }
.nav .me { display: flex; align-items: center; gap: .5rem; }
.nav .me img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.btn { background: var(--accent); color: var(--accent-contrast); border: 0; padding: .55rem 1rem;
  border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.btn.ghost:hover { color: var(--text); }
.theme-toggle { font-size: 1rem; line-height: 1; padding: .5rem .6rem; }

main { max-width: 960px; margin: 0 auto; padding: 2rem 1.4rem 3rem; }
h1 { font-size: 1.5rem; margin: 0 0 1.4rem; color: var(--title); }
h2 { font-size: 1.15rem; margin: 2rem 0 1rem; color: var(--title); }
.muted { color: var(--muted); }

/* game grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }
.tile { display: block; text-decoration: none; color: inherit; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: transform .12s, border-color .12s; }
.tile:hover { transform: translateY(-4px); border-color: var(--accent); }
.tile .art { aspect-ratio: 16/10; width: 100%; object-fit: cover; display: block; background: var(--tile-bg); }
.tile .body { padding: 1rem 1.1rem 1.2rem; }
.tile .body h3 { margin: 0 0 .3rem; font-size: 1.1rem; }
.tile .body p { margin: 0; color: var(--muted); font-size: .88rem; }

/* forms / panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 .4rem; }
input[type=text], input[type=file] { width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: .7rem .8rem; font-size: .95rem; }
.field { margin-bottom: 1.2rem; }
.avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.notice { background: color-mix(in srgb, #2f9e5f 22%, var(--panel)); border: 1px solid #2f9e5f; color: var(--text); padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.err { background: color-mix(in srgb, #d64545 22%, var(--panel)); border: 1px solid #d64545; color: var(--text); padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); font-size: .92rem; }
th { color: var(--muted); font-weight: 500; }
.rank { color: var(--gold); font-weight: 700; width: 2.5rem; }
.pname { display: flex; align-items: center; gap: .6rem; }
.pname img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.empty { color: var(--muted); padding: 1rem 0; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.5rem; }
.login-card { max-width: 420px; }
.login-logo { width: 260px; max-width: 80%; height: auto; border-radius: 12px; margin: 0 auto 1.4rem; display: block; }
:root[data-theme="dark"] .login-logo { box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.login-card h1 { font-size: 1.5rem; margin: 0 0 .4rem; }
.g-btn { display: inline-flex; align-items: center; gap: .6rem; background: #fff; color: #1f1f1f;
  text-decoration: none; padding: .8rem 1.4rem; border-radius: 8px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.corner-toggle { position: fixed; top: 1rem; right: 1rem; }

/* game shell: slim arcade bar + the game in a frame beneath it */
.shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.game-bar { flex: 0 0 42px; display: flex; align-items: center; gap: .9rem; padding: 0 1rem;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.game-bar .home { display: inline-flex; align-items: center; gap: .4rem; color: var(--title);
  text-decoration: none; font-weight: 700; font-size: .95rem; }
.game-bar .home:hover { filter: brightness(1.15); }
.game-bar .game-name { margin-left: auto; color: var(--muted); font-size: .88rem; }
.game-frame { flex: 1 1 auto; width: 100%; border: 0; display: block; background: #000; }

/* mobile header: wrap the nav to its own row so nothing gets clipped */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: .5rem .7rem; padding: .6rem 1rem; }
  .brand { font-size: 1.05rem; }
  .brand img { height: 26px; }
  .nav { width: 100%; justify-content: space-between; gap: .5rem; font-size: .85rem; }
  .nav .me .uname { display: none; } /* keep the avatar, drop the name to save room */
  main { padding: 1.4rem 1rem 2.5rem; }
}
