:root { --blue:#6698cb; --navy:#003399; --light:#b1d0f0; --orange:#ff9933; --text:#222; }
* { box-sizing: border-box; }
body { margin:0; font:13px/1.45 Verdana, Geneva, Arial, sans-serif; color:var(--text); background:#fff; }
a { color:#036; }
a:hover { color:var(--orange); }
img { max-width:100%; }
input, textarea, select, button { font:inherit; }
input[type=text], input[type=password], input[type=email], input:not([type]), textarea, select {
  width:100%; padding:5px 6px; border:1px solid #7f9db9; background:#fff; color:#222;
}
textarea { min-height:90px; resize:vertical; }
label { display:block; margin:8px 0 2px; font-weight:bold; font-size:12px; }
button, .btn {
  display:inline-block; cursor:pointer; padding:5px 12px; border:1px solid #cc6600; border-radius:3px;
  background:linear-gradient(#ffb347,#ff9933); color:#fff; font-weight:bold; text-decoration:none; text-shadow:0 1px 0 rgba(0,0,0,.25);
}
button:hover, .btn:hover { background:linear-gradient(#ffc069,#ffa64d); color:#fff; }
button.secondary, .btn.secondary { background:linear-gradient(#e8f0fa,#c9dcf2); border-color:#6698cb; color:#036; text-shadow:none; }
button.danger { background:linear-gradient(#f77,#d33); border-color:#a00; }
button:disabled { opacity:.5; cursor:default; }
.small { font-size:11px; padding:2px 8px; }
.muted { color:#777; font-size:11px; }
.error { color:#c00; font-weight:bold; margin:6px 0; min-height:1em; }
.notice { background:#fffbe0; border:1px solid #e0c040; padding:8px 10px; margin-bottom:12px; }
.loading { padding:40px; text-align:center; color:#777; }

/* header */
.topbar { background:linear-gradient(#003399,#002277); color:#fff; padding:8px 16px; display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.logo { font:bold 28px/1 "Trebuchet MS", Arial, sans-serif; letter-spacing:-1px; color:#fff; text-decoration:none; }
.logo span { color:var(--orange); }
.logo:hover { color:#fff; }
.tagline { opacity:.8; font-size:11px; }
.search { margin-left:auto; display:flex; gap:4px; }
.search input { width:170px; }
.nav { background:var(--blue); padding:0 12px; display:flex; flex-wrap:wrap; border-bottom:3px solid var(--orange); }
.nav a { color:#fff; text-decoration:none; font-weight:bold; padding:7px 12px; }
.nav a:hover, .nav a.active { background:var(--light); color:#036; }
.nav .spacer { flex:1; }
.wrap { max-width:980px; margin:0 auto; padding:14px; }
.footer { text-align:center; color:#777; font-size:11px; padding:20px 10px 30px; }

/* layout */
.cols { display:grid; grid-template-columns:minmax(0,2fr) minmax(0,3fr); gap:14px; align-items:start; }
.cols.even { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.cols.wide-left { grid-template-columns:minmax(0,3fr) minmax(0,2fr); }
@media (max-width:760px) { .cols, .cols.even, .cols.wide-left { grid-template-columns:1fr; } .search { margin-left:0; } }
h1, h2 { font-family:"Trebuchet MS", Arial, sans-serif; color:var(--navy); margin:4px 0 10px; }
h1 { font-size:22px; } h2 { font-size:17px; }

/* boxes */
.box { margin-bottom:14px; border:1px solid var(--accent, var(--blue)); }
.box h3 { margin:0; padding:3px 8px; background:var(--accent, var(--blue)); color:#fff; font-size:13px; }
.box .inner { padding:8px 10px; background:color-mix(in srgb, var(--accent, var(--blue)) 18%, var(--pbg, #fff)); color:var(--ptext, var(--text)); }
.box .inner.plain { background:#fff; }

/* people */
.avatar { display:block; object-fit:cover; background:#ddd; border:1px solid #999; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(96px, 1fr)); gap:10px; }
.person { text-align:center; font-size:11px; word-break:break-word; }
.person a { text-decoration:none; font-weight:bold; }
.person .avatar { width:100%; aspect-ratio:1; margin:3px 0 0; }
.person .sub { color:#777; font-weight:normal; }
.top8 { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:10px; }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#3c3; margin-right:3px; }
.row { display:flex; gap:10px; align-items:center; padding:6px 0; border-bottom:1px dotted #aac; }
.row:last-child { border-bottom:0; }
.row .grow { flex:1; min-width:0; }
.row .avatar { width:48px; height:48px; flex:none; }
.actions { display:flex; gap:6px; flex-wrap:wrap; margin:8px 0; }
.tabs { display:flex; gap:4px; margin-bottom:10px; flex-wrap:wrap; }
.tabs button { background:#e8f0fa; color:#036; border-color:#6698cb; text-shadow:none; }
.tabs button.on { background:var(--blue); color:#fff; }

/* profile */
.profile { background:var(--pbg); color:var(--ptext); padding:14px; border:1px solid #999; }
.profile.light { --ptext:#222; }
.profile.dark { --ptext:#eee; }
.profile.light a { color:color-mix(in srgb, var(--accent) 80%, #000); }
.profile.dark a { color:color-mix(in srgb, var(--accent) 50%, #fff); }
.profile h1 { color:var(--ptext); margin-top:0; }
.profile .headline { font-style:italic; margin-bottom:8px; }
.profile .big-avatar { width:100%; max-width:260px; aspect-ratio:1; margin-bottom:8px; }
.profile .btn, .profile button { color:#fff; }
.profile dl { margin:0; display:grid; grid-template-columns:auto 1fr; gap:3px 10px; }
.profile dt { font-weight:bold; }
.profile dd { margin:0; word-break:break-word; }
.pre { white-space:pre-wrap; word-break:break-word; }

/* comments */
.comment { display:flex; gap:10px; padding:8px 0; border-bottom:1px dotted var(--accent, #aac); }
.comment:last-child { border-bottom:0; }
.comment .avatar { width:56px; height:56px; flex:none; }
.comment .body { flex:1; min-width:0; }
.comment .who { font-weight:bold; }

/* editor */
.swatches { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0; }
.swatch { width:34px; height:34px; border:2px solid #666; border-radius:4px; padding:0; position:relative; overflow:hidden; }
.swatch i { position:absolute; right:0; bottom:0; width:16px; height:16px; }
.colors { display:flex; gap:20px; align-items:center; }
.colors input[type=color] { width:56px; height:32px; padding:0; border:1px solid #666; }
.preview-av { width:128px; height:128px; }

/* auth */
.auth input { margin-bottom:4px; }
.hero { font-size:15px; }
.hero ul { padding-left:18px; }

/* games */
.game-card { text-align:center; }
.game-card .emoji { font-size:42px; }
.board { width:100%; border-collapse:collapse; }
.board td, .board th { padding:3px 6px; text-align:left; border-bottom:1px dotted #aac; }
.board td:last-child, .board th:last-child { text-align:right; }
.stage { text-align:center; }
canvas#snake { background:#102a43; border:3px solid var(--blue); max-width:100%; touch-action:none; }
.hud { display:flex; justify-content:space-between; max-width:400px; margin:0 auto 6px; font-weight:bold; }
.dpad { display:grid; grid-template-columns:repeat(3,48px); gap:4px; justify-content:center; margin-top:8px; }
.dpad button { padding:8px 0; }
.memory { display:grid; grid-template-columns:repeat(4, 70px); gap:8px; justify-content:center; }
.memory button { height:70px; font-size:32px; background:linear-gradient(#e8f0fa,#9fc0e6); color:#036; border-color:#6698cb; text-shadow:none; padding:0; }
.memory button.up { background:#fff; }
.memory button.done { background:#c8f0c8; border-color:#5a5; }
.moles { display:grid; grid-template-columns:repeat(3, 84px); gap:10px; justify-content:center; }
.moles button { height:84px; font-size:40px; background:#6b4a2b; border-color:#3d2a18; border-radius:50%; padding:0; text-shadow:none; }
.moles button.up { background:#d9b27c; }

/* security + admin */
.qr { image-rendering: pixelated; border: 1px solid #999; max-width: 100%; }
pre.codes { background: #fff; color: #222; border: 1px dashed #666; padding: 10px; font: bold 15px/1.7 "Courier New", monospace; text-align: center; user-select: all; }
code { background: #f1f1f1; color: #222; padding: 1px 4px; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: #fff; color: #222; border: 1px solid #aac; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 24px; color: var(--navy); }
.stat span { font-size: 11px; color: #666; }
label.check { display: flex; gap: 6px; align-items: center; font-size: 13px; }
label.check input { width: auto; }
table.admin { background: #fff; color: #222; }
table.admin td:last-child, table.admin th:last-child { text-align: left; }
table.admin .actions { margin: 0; }
@media (max-width: 760px) { table.admin { display: block; overflow-x: auto; } }

/* invisible bot trap: off-screen rather than display:none, because some bots skip display:none fields */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.narrow { max-width: 520px; margin: 0 auto; }
