/* =========================================================================
   WordGames.club — site styles
   Look: letter tiles on warm paper. Variables are prefixed --w- so they
   never clash with the game engine (games/wu/wu.css uses --card, --line…).
   Dark mode = html.pdd-dark, the same class our games use.
   ========================================================================= */

/* Nunito, self-hosted (SIL Open Font License): no request to Google Fonts */
@font-face { font-family: Nunito; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/assets/fonts/nunito-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-style: normal; font-weight: 700 800; font-display: swap; src: url(/assets/fonts/nunito-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-style: normal; font-weight: 900; font-display: swap; src: url(/assets/fonts/nunito-latin-900-normal.woff2) format("woff2"); }

:root {
  --w-bg: #faf6ee;
  --w-bg2: #f2eadb;
  --w-card: #ffffff;
  --w-ink: #1d2433;
  --w-mut: #5e6576;
  --w-line: #e6dcc8;
  --w-acc: #d9532a;
  --w-acc-h: #bf4520;
  --w-acc-ink: #ffffff;
  --w-tile: #f6e2b5;
  --w-tile-edge: #d8b56f;
  --w-tile-ink: #3b2c12;
  --w-link: #1f56b5;
  --w-shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 8px 22px -12px rgba(29, 36, 51, .22);
  --w-r: 14px;
}
html.pdd-dark {
  --w-bg: #14161c;
  --w-bg2: #1b1e26;
  --w-card: #20242d;
  --w-ink: #eef0f4;
  --w-mut: #a3a9b6;
  --w-line: #2e333e;
  --w-acc: #ff7a4d;
  --w-acc-h: #ff946d;
  --w-acc-ink: #1a1208;
  --w-tile: #3a3224;
  --w-tile-edge: #5c4b2c;
  --w-tile-ink: #f4e2b9;
  --w-link: #93b6ff;
  --w-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .7);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--w-bg);
  color: var(--w-ink);
  font: 400 17px/1.6 Nunito, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
img { max-width: 100%; height: auto; }
a { color: var(--w-link); }
button { font: inherit; }
h1, h2, h3 { line-height: 1.2; font-weight: 900; letter-spacing: -.01em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--w-card); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--w-acc); outline-offset: 2px; }

/* ---------- header ---------- */
.top { background: var(--w-card); border-bottom: 1px solid var(--w-line); }
.top-in { display: flex; align-items: center; gap: 14px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--w-ink); flex: 0 0 auto; }
.brand-tiles { display: inline-flex; gap: 3px; }
.brand-tiles i, .nf-tiles i {
  display: grid; place-items: center; width: 30px; height: 32px;
  font: 900 18px/1 Nunito, system-ui, sans-serif; font-style: normal;
  color: var(--w-tile-ink); background: var(--w-tile);
  border-radius: 6px; box-shadow: inset 0 -3px 0 var(--w-tile-edge);
}
.brand-tiles i:nth-child(2) { transform: rotate(4deg) translateY(1px); }
.brand-t { font-weight: 900; font-size: 21px; letter-spacing: -.02em; }
.brand-t span { color: var(--w-acc); }
.find { flex: 1 1 auto; max-width: 420px; margin-left: auto; display: flex; align-items: center;
  background: var(--w-bg); border: 1px solid var(--w-line); border-radius: 999px; padding: 0 4px 0 16px; height: 42px; }
.find input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--w-ink); font: inherit; font-size: 16px; outline: none; }
.find input::placeholder { color: var(--w-mut); }
.find button { border: 0; background: transparent; color: var(--w-mut); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.find button:hover { background: var(--w-bg2); color: var(--w-ink); }
.find svg, .theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.theme-btn { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--w-line); background: var(--w-bg); color: var(--w-ink); cursor: pointer; display: grid; place-items: center; }
.theme-btn:hover { background: var(--w-bg2); }
.theme-btn .i-sun { display: none; }
html.pdd-dark .theme-btn .i-sun { display: block; }
html.pdd-dark .theme-btn .i-moon { display: none; }

.menu { border-top: 1px solid var(--w-line); }
.menu-in { position: relative; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 6px; }
.menu-in::-webkit-scrollbar { display: none; }
.menu a { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; color: var(--w-ink); text-decoration: none; font-weight: 800; font-size: 15px; white-space: nowrap; }
.menu a:hover { background: var(--w-bg2); }
.menu a[aria-current], .menu a.on { background: var(--w-ink); color: var(--w-bg); }

/* ---------- common blocks ---------- */
main { padding-bottom: 36px; }
.crumbs { font-size: 14px; color: var(--w-mut); margin: 16px 0 4px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { color: var(--w-mut); text-decoration: none; }
.crumbs a:hover { color: var(--w-ink); text-decoration: underline; }
.lead { font-size: 19px; color: var(--w-mut); margin: 0 0 8px; max-width: 760px; }
.sec { margin-top: 34px; }
.sec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-h { font-size: 25px; margin: 0 0 14px; }
.sec-top .sec-h { margin: 0; }
.more { font-weight: 800; font-size: 15px; text-decoration: none; white-space: nowrap; color: var(--w-acc); }
.more::after { content: " →"; }
.more:hover { color: var(--w-acc-h); text-decoration: underline; }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--w-line); background: var(--w-card); color: var(--w-ink); font-weight: 800; font-size: 15px; }
.btn:hover { border-color: var(--w-ink); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 20px; }
.card { display: flex; flex-direction: column; text-decoration: none; color: var(--w-ink); min-width: 0; }
.card-img { position: relative; display: block; aspect-ratio: 3 / 2; border-radius: var(--w-r); overflow: hidden; background: var(--w-bg2);
  box-shadow: var(--w-shadow); transition: transform .15s ease, box-shadow .15s ease; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .card-img { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--w-acc), var(--w-shadow); }
.card-t { margin-top: 10px; font-weight: 800; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.card-s { font-size: 13.5px; color: var(--w-mut); margin-top: 2px; }
.badge { position: absolute; left: 8px; top: 8px; background: var(--w-acc); color: var(--w-acc-ink); font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 999px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 12px; background: var(--w-card);
  border: 1px solid var(--w-line); color: var(--w-ink); text-decoration: none; font-weight: 800; font-size: 15.5px; }
.chip i { display: grid; place-items: center; width: 28px; height: 30px; border-radius: 6px; font-style: normal; font-weight: 900;
  background: var(--w-tile); color: var(--w-tile-ink); box-shadow: inset 0 -3px 0 var(--w-tile-edge); }
.chip small { color: var(--w-mut); font-weight: 600; font-size: 13.5px; }
.chip:hover { border-color: var(--w-ink); }

.az { columns: 4 200px; column-gap: 24px; list-style: none; margin: 0; padding: 0; font-size: 15.5px; }
.az li { break-inside: avoid; padding: 3px 0; }
.az a { color: var(--w-ink); text-decoration: none; }
.az a:hover { color: var(--w-acc); text-decoration: underline; }

.prose { max-width: 820px; }
.prose h2 { font-size: 26px; margin: 30px 0 10px; }
.prose h3 { font-size: 20px; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 5px 0; }
.prose > :first-child { margin-top: 0; }
.faq h3 { font-size: 18px; }

.ad { margin: 26px auto 0; min-height: 100px; text-align: center; }

/* ---------- home ---------- */
.hero { padding: 26px 0 6px; }
.hero h1 { font-size: 40px; margin: 0 0 8px; }
.playbox { margin-top: 14px; background: var(--w-card); border: 1px solid var(--w-line); border-radius: 20px; box-shadow: var(--w-shadow); padding: 14px 14px 6px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs [role=tab] { flex: 0 0 auto; border: 0; cursor: pointer; padding: 9px 16px; border-radius: 10px; font-weight: 900; font-size: 16px;
  background: var(--w-bg2); color: var(--w-ink); box-shadow: inset 0 -3px 0 var(--w-line); }
.tabs [role=tab]:hover { background: var(--w-tile); color: var(--w-tile-ink); box-shadow: inset 0 -3px 0 var(--w-tile-edge); }
.tabs [role=tab][aria-selected=true] { background: var(--w-acc); color: var(--w-acc-ink); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .22); }
.panel-note { margin: 2px 4px 6px; color: var(--w-mut); font-size: 15px; text-align: center; }
.panel .pdd { min-height: 540px; }

/* ---------- game page ---------- */
.game-head { margin: 4px 0 14px; }
.game-head h1 { font-size: 34px; margin: 6px 0 6px; }
.game-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; color: var(--w-mut); }
.tag { padding: 3px 10px; border-radius: 999px; background: var(--w-bg2); color: var(--w-ink); text-decoration: none; font-weight: 800; }
.tag:hover { background: var(--w-tile); color: var(--w-tile-ink); }
.plays::before { content: "▶ "; font-size: 12px; }

.player { position: relative; background: #11141b; border-radius: 18px; overflow: hidden; box-shadow: var(--w-shadow); }
.stage { position: relative; height: var(--h, 600px); max-height: 82vh; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.poster { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; cursor: pointer; background: #11141b; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; overflow: hidden; }
.poster-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(26px) brightness(.55); transform: scale(1.1); }
.poster img { position: relative; width: 300px; max-width: 70%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.poster-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 13px 28px 13px 22px; border-radius: 999px;
  background: var(--w-acc); color: #fff; font-weight: 900; font-size: 20px; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); transition: transform .12s; }
.poster-btn svg { width: 24px; height: 24px; fill: currentColor; }
.poster:hover .poster-btn { transform: translateY(-2px) scale(1.03); }
.poster-hint { position: relative; font-size: 14px; opacity: .85; }
.fs-close { display: none; }
.player.is-fs { position: fixed; inset: 0; z-index: 1000; border-radius: 0; }
.player.is-fs .stage { height: 100%; max-height: none; }
.player.is-fs .fs-close { display: grid; place-items: center; position: absolute; top: 12px; right: 12px; z-index: 2; width: 46px; height: 46px;
  border-radius: 50%; border: 2px solid #fff; background: #e03c31; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
body.fs-on { overflow: hidden; }

.own-game { background: var(--w-card); border: 1px solid var(--w-line); border-radius: 18px; box-shadow: var(--w-shadow); padding: 10px 6px; }

.game-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.vote { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.vote-q { font-weight: 800; color: var(--w-mut); font-size: 15px; }
.vote-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--w-line); background: var(--w-card); color: var(--w-mut); font-weight: 800; }
.vote-btn svg { width: 18px; height: 18px; fill: currentColor; }
.vote-btn:hover { color: var(--w-ink); border-color: var(--w-ink); }
.vote-btn.up.on { background: #2f9e5b; border-color: #2f9e5b; color: #fff; }
.vote-btn.down.on { background: #d24a3c; border-color: #d24a3c; color: #fff; }
.vote-pct { font-size: 14px; color: var(--w-mut); }
.vote-note { flex-basis: 100%; text-align: right; font-size: 14px; color: #2f9e5b; }
.vote-note.bad { color: #d24a3c; }
.game-text { margin-top: 28px; }

/* ---------- section / search / 404 ---------- */
.cat-head { margin: 8px 0 10px; }
.cat-head h1 { font-size: 36px; margin: 6px 0 2px; }
.cat-n { margin: 0; color: var(--w-mut); font-weight: 700; }
.cat-intro { margin-top: 10px; }
.find-big { max-width: 640px; margin: 18px 0 0; height: 52px; padding-left: 18px; }
.find-big button { width: auto; border-radius: 999px; padding: 0 20px; background: var(--w-acc); color: var(--w-acc-ink); font-weight: 900; height: 42px; }
.find-big button:hover { background: var(--w-acc-h); color: var(--w-acc-ink); }
.nf { text-align: left; padding-top: 24px; }
.nf-tiles { display: flex; gap: 6px; margin: 0 0 10px; }
.nf-tiles i { width: 54px; height: 58px; font-size: 32px; border-radius: 10px; box-shadow: inset 0 -5px 0 var(--w-tile-edge); }
.nf-tiles i:nth-child(2) { transform: rotate(-6deg); }
.page-text { margin-top: 12px; }
.page-text h1 { font-size: 36px; margin: 8px 0 10px; }

/* ---------- footer ---------- */
.foot { margin-top: 20px; background: var(--w-card); border-top: 1px solid var(--w-line); padding: 30px 0 34px; font-size: 15px; color: var(--w-mut); }
.net-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px 16px; }
.net-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--w-ink); min-width: 0; }
.net-img { display: block; aspect-ratio: 3 / 2; border-radius: var(--w-r); overflow: hidden; background: var(--w-bg2); box-shadow: var(--w-shadow); transition: transform .15s, box-shadow .15s; margin-bottom: 6px; }
.net-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.net-card:hover .net-img { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--w-acc), var(--w-shadow); }
.net-card b { font-size: 16px; font-weight: 800; }
.net-card small { font-size: 13.5px; color: var(--w-mut); line-height: 1.35; }
@media (max-width: 900px) { .net-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .net-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; } }
.foot-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1.5fr); gap: 30px; }
.foot-h { grid-column: 1 / -1; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--w-mut); }
.foot-about p { margin: 12px 0 0; max-width: 340px; }
.brand-sm .brand-t { font-size: 18px; }
.brand-sm .brand-tiles i { width: 26px; height: 28px; font-size: 16px; }
.foot-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; align-content: start; }
.foot a { color: var(--w-mut); text-decoration: none; }
.foot a:hover { color: var(--w-ink); text-decoration: underline; }
.foot-line { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--w-line); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .grid { gap: 18px 16px; } }
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .foot-cols { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { font-size: 16.5px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .hero { padding: 16px 0 0; }
  .hero h1 { font-size: 28px; }
  .lead { font-size: 16px; line-height: 1.5; }
  .panel-note { font-size: 14px; }
  .game-head h1, .cat-head h1, .page-text h1 { font-size: 28px; }
  .sec-h { font-size: 22px; }
  .top-in { height: 58px; gap: 10px; }
  .brand-t { display: none; }
  .find { max-width: none; }
  .stage { height: min(var(--h, 600px), 76vh); }
  .foot-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vote { margin-left: 0; }
  .playbox { padding: 10px 6px 4px; border-radius: 16px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-t { font-size: 15px; }
  .poster img { width: 220px; }
  .poster-btn { font-size: 18px; padding: 11px 24px 11px 18px; }
  .wrap { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .top, .foot, .ad, .game-bar, .playbox .tabs { display: none !important; } }
