/* Colours of keepwatch.gg: home page, wiki, legal pages and the web app (/app/).
   They follow the app (KeepwatchMobile/src/constants/keepwatch.ts). Edit them here only. */

:root {
  --bg: #070d17; --head: #050a14; --surface: #101c30; --raised: #16253e; --chip: #1d3050; --border: #1f3352;
  --text: #f2f6fb; --muted: #9fb0c6; --dim: #7f91ab; --gold: #f3a418; --gold-text: #f6c25e; --on-gold: #1c1206;
  --pic: #0d1a2c; --mine: rgba(243, 164, 24, .12); --heart: #f87171; --cut: #86efac; --new-bg: rgba(74, 222, 128, .14); --new: #86efac;
  --epic: rgba(168, 85, 247, .2); --common: rgba(148, 163, 184, .18);
  --bg-deep: #050a14; --gold-hover: #d98c0e; --gold-light: #f6c25e; --blue: #58a6ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f5fa; --head: #fff; --surface: #fff; --raised: #eef2f8; --chip: #e2e9f3; --border: #d6dfeb;
  --text: #0b1424; --muted: #4f5f78; --dim: #5e6e86; --gold-text: #9a5b00; --mine: #fff4dc; --pic: #e8eef7; --heart: #dc2626;
  --cut: #15803d; --new-bg: #dcfce7; --new: #166534; --epic: #f3e8ff; --common: #eef2f7;
  --bg-deep: #fff; --gold-light: #9a5b00;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f2f5fa; --head: #fff; --surface: #fff; --raised: #eef2f8; --chip: #e2e9f3; --border: #d6dfeb;
    --text: #0b1424; --muted: #4f5f78; --dim: #5e6e86; --gold-text: #9a5b00; --mine: #fff4dc; --pic: #e8eef7; --heart: #dc2626;
    --cut: #15803d; --new-bg: #dcfce7; --new: #166534; --epic: #f3e8ff; --common: #eef2f7;
    --bg-deep: #fff; --gold-light: #9a5b00;
    color-scheme: light;
  }
}

/* Header, footer and search of every keepwatch.gg page and of the web app.
   Needs tokens.css first. Edit them here only. */
html { scroll-padding-top: 150px; }
.top { position: sticky; top: 0; z-index: 30; background: var(--head); border-bottom: 1px solid var(--border); }
.top .wrap { max-width: 1100px; margin: 0 auto; padding: 0 var(--hpad, 16px); }
.top .i { width: 16px; height: 16px; flex: none; color: var(--muted); }
.bar { display: flex; align-items: center; gap: 8px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-inline-end: auto; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.tools { display: flex; align-items: center; gap: 8px; }
.top .get { display: none; height: 40px; padding: 0 14px; border-radius: 10px; background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: 14px; align-items: center; white-space: nowrap; }
.top .get:hover { filter: brightness(1.06); color: var(--on-gold); text-decoration: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 calc(-1 * var(--hpad, 16px)); padding: 0 var(--hpad, 16px) 8px; scroll-padding-inline: var(--hpad, 16px); }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: 1 0 auto; min-width: 64px; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 5px 8px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.nav a img { width: 32px; height: 32px; object-fit: contain; transition: width .15s, height .15s; }
.nav a:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.nav a[aria-current] { background: var(--chip); color: var(--text); }
@media (max-width: 899px) {
  .top.small .nav a { min-width: 48px; padding: 4px 6px; }
  .top.small .nav a span { display: none; }
  .top.small .nav a img { width: 28px; height: 28px; }
}
@media (min-width: 900px) {
  .top .get { display: inline-flex; }
  .nav a { flex-direction: row; gap: 8px; padding: 6px 12px; font-size: 14px; }
  .nav a img { width: 26px; height: 26px; }
}
/* rows that scroll sideways fade out at the side where more follows (set by the header script) */
.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
.more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 44px), transparent); }
.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, transparent, #000 44px, #000 calc(100% - 44px), transparent); }
.langs { position: relative; }
.langs summary, .theme { height: 40px; min-width: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 14px var(--font); display: flex; align-items: center; justify-content: center; cursor: pointer; list-style: none; }
.langs summary::-webkit-details-marker { display: none; }
.langs summary { gap: 7px; }
.langs summary .i.chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.langs[open] summary .i.chev { transform: rotate(180deg); }
.flag { width: 24px; height: 18px; flex: none; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(127, 127, 127, .3); }
.langs summary .flag { width: 20px; height: 15px; }
.langs div { position: absolute; inset-inline-end: 0; top: 46px; z-index: 5; width: min(calc(var(--cols) * 190px + 16px), calc(100vw - 32px)); padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .55); }
.langs div p { margin: 4px 8px 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.langs nav { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 2px; }
.langs nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; padding: 8px 10px; border-radius: 9px; font-size: 15px; }
.langs nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.langs nav a:hover { background: var(--chip); text-decoration: none; }
.langs nav a[aria-current] { background: var(--chip); font-weight: 600; }
@media (max-width: 600px) {
  .langs[open] summary::before { content: ""; position: fixed; inset: 0; z-index: 5; background: rgba(5, 10, 20, .45); cursor: default; }
  .langs div { position: fixed; inset: auto 0 0; top: auto; width: auto; max-height: 80vh; overflow: auto; z-index: 6; padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); border-radius: 18px 18px 0 0; }
  .langs div::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 2px; background: var(--border); }
  .langs nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.theme .i { color: var(--text); width: 20px; height: 20px; }
.theme .moon { display: none; }
:root[data-theme="light"] .theme .sun { display: none; }
:root[data-theme="light"] .theme .moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme .sun { display: none; }
  :root:not([data-theme="dark"]) .theme .moon { display: block; }
}
/* footer, also part of the shared block */
.site-footer { padding: 32px 0 40px; background: var(--head); border-top: 1px solid var(--border); font-size: 15px; }
.site-footer .wrap { max-width: 1100px; margin: 0 auto; padding: 0 var(--hpad, 16px); }
.notice { margin: 0; max-width: 72ch; color: var(--muted); line-height: 1.6; }
.notice a { color: var(--gold-text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 16px 0 0; padding: 0; list-style: none; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); }
.footer-links a:hover { color: var(--gold-text); text-decoration: none; }
.copyright { margin: 8px 0 0; color: var(--muted); }
.foot-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; padding-bottom: 28px; margin-bottom: 24px; border-bottom: 1px solid var(--border); scroll-margin-top: 120px; }
.foot-cta > div:first-child { min-width: 0; }
.foot-cta p { margin: 0; }
.foot-cta-t { font-size: clamp(1.4rem, 4.5vw, 1.9rem); font-weight: 700; line-height: 1.2; color: var(--text); text-wrap: balance; }
.foot-cta-p { margin-top: 4px !important; color: var(--muted); }
.foot-stores { display: flex; flex-wrap: wrap; gap: 12px; }
.foot-stores a { display: block; line-height: 0; border-radius: 10px; }
.foot-stores a:hover { opacity: .85; }
.foot-stores img { height: 48px; width: auto; }
/* search: button in the header gap, window in the middle (phones: sheet from below). Logical properties only, so RTL needs nothing extra. */
.find { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 500 14px var(--font); cursor: pointer; }
.find[hidden] { display: none; }
.find .i { width: 18px; height: 18px; color: currentColor; }
.find span, .find kbd { display: none; }
.find:hover { color: var(--text); }
.find kbd, .srch-x kbd { font: 600 11px var(--font); color: var(--dim); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; }
@media (min-width: 900px) {
  .brand { margin-inline-end: 0; }
  .find { margin-inline: auto; width: min(440px, 40vw); justify-content: flex-start; padding-inline: 12px 8px; }
  .find span { display: inline; }
  .find kbd { display: inline-block; margin-inline-start: auto; }
}
.srch { width: min(640px, calc(100vw - 32px)); max-width: none; max-height: min(600px, calc(100dvh - 32px)); margin: 8px auto auto; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7); overflow: hidden; }
.srch[open] { display: flex; flex-direction: column; }
.srch::backdrop { background: rgba(5, 10, 20, .55); }
html:has(.srch[open]) { overflow: hidden; }
.srch-f { flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding-inline: 16px 10px; border-bottom: 1px solid var(--border); }
.srch-f > .i { width: 20px; height: 20px; color: var(--muted); }
.srch-f input { flex: 1; min-width: 0; height: 54px; border: 0; outline: 0; background: transparent; color: var(--text); font: 17px var(--font); }
.srch-f input::placeholder { color: var(--dim); }
.srch-f input::-webkit-search-cancel-button { display: none; }
.srch-x { flex: none; display: flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.srch-x .i { display: none; width: 20px; height: 20px; color: currentColor; }
.srch-r { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 6px; }
.srch-r:empty { display: none; }
.srch-g { margin: 0; padding: 10px 10px 4px; font-size: 11px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; }
.srch-o { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px; border-radius: 10px; color: var(--text); }
.srch-o:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.srch-o[aria-selected="true"] { background: var(--raised); box-shadow: inset 0 0 0 1px var(--border); }
.srch-o img, .srch-o > i { flex: none; width: 34px; height: 34px; object-fit: contain; }
.srch-o span { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.srch-o b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srch-o small { color: var(--dim); font-size: 12px; }
.srch mark { background: none; color: var(--gold-text); font-weight: 700; }
.srch-th { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 6px 8px; }
.srch-th a { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding-inline: 4px 10px; border-radius: 9px; background: var(--raised); color: var(--text); font-size: 13px; font-weight: 600; }
.srch-th a:hover { background: var(--chip); color: var(--text); text-decoration: none; }
.srch-th a[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--gold); }
.srch-th img, .srch-th a > i { width: 28px; height: 28px; object-fit: contain; }
.srch-n { margin: 0; padding: 14px 10px 6px; color: var(--muted); }
.srch-k { flex: none; margin: 0; padding: 8px 16px; border-top: 1px solid var(--border); color: var(--dim); font-size: 12px; }
.srch-s { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding-inline: 4px 9px; border: 1px solid transparent; border-radius: 8px; background: var(--chip); color: var(--text); font: 600 13px var(--font); white-space: nowrap; }
.srch-s img { width: 18px; height: 18px; object-fit: contain; }
.srch-s i { font-style: normal; font-weight: 500; color: var(--muted); }
button.srch-s { cursor: pointer; }
button.srch-s:hover i { color: var(--text); }
.srch-s[aria-pressed="false"] { background: none; border: 1px dashed var(--border); color: var(--muted); }
.srch-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted); font-style: normal; font-size: 18px; }
.srch-ic svg { width: 22px; height: 22px; }
.srch-th .srch-ic { width: 28px; height: 28px; }
.srch-th .srch-ic svg { width: 20px; height: 20px; }
.srch-t { flex: none; color: var(--muted); font-size: 13px; font-style: normal; font-variant-numeric: tabular-nums; }
.srch-b { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; background: var(--chip); color: var(--muted); font: 700 11px var(--font); letter-spacing: .03em; text-transform: uppercase; }
.srch-o .srch-b img { width: 14px; height: 14px; }
.srch-m { margin-top: 4px; border: 1px dashed var(--border); color: var(--muted); }
@media (max-width: 400px) {
  .bar, .tools { gap: 6px; }
  .find, .theme { min-width: 40px; padding: 0 8px; }
  .langs summary { padding: 0 8px; gap: 5px; }
}
@media (max-width: 359px) {
  .brand span { display: none; }
}
@media (max-width: 600px) {
  .srch { width: 100%; max-height: none; height: calc(100dvh - 48px); margin: auto 0 0; border-width: 1px 0 0; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .srch::before { content: ""; flex: none; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--border); }
  .srch-f { padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(6px, env(safe-area-inset-right, 0px)); }
  .srch-x kbd, .srch-k { display: none; }
  .srch-x .i { display: block; }
  .srch-o { min-height: 52px; }
}
/* "Game data | My village" switch and the account (WEB_APP in build_data_pages.py; same markup in the web app) */
.top [hidden] { display: none !important; }
.mode { flex: none; display: flex; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.mode a { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.mode a img { width: 20px; height: 20px; }
.mode a:hover { color: var(--text); text-decoration: none; }
.mode a[aria-current] { background: var(--chip); color: var(--text); }
.top .sign { display: none; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; align-items: center; white-space: nowrap; }
.top .sign:hover { background: var(--raised); text-decoration: none; }
.top .av { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--chip); color: var(--text); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.top .av:hover { text-decoration: none; filter: brightness(1.1); }
.has-mode .brand { margin-inline-end: 0; }
/* phone button next to the switch: the app page (/mobile) */
.top .mob .i { color: var(--text); width: 20px; height: 20px; }
.top .mob:hover { background: var(--raised); text-decoration: none; }
.top .mob[aria-current] { background: var(--chip); }
@media (min-width: 600px) and (max-width: 899px) {
  .has-mode .mob { margin-inline-end: auto; }
  .has-mode .brand span { display: none; }
}
/* phones: the switch gets its own row under the bar, two equal halves; hidden again once the header shrinks on scroll */
@media (max-width: 599px) {
  .has-mode .bar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 8px; }
  .has-mode .brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .has-mode .brand span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .has-mode .find { grid-column: 2; grid-row: 1; }
  .has-mode .tools { grid-column: 3; grid-row: 1; }
  .has-mode .mode { grid-column: 1 / -1; grid-row: 2; margin-block: 0 8px; margin-inline: 0 52px; }
  .has-mode .mob { grid-column: -2; grid-row: 2; justify-self: end; margin-bottom: 8px; }
  .top.small .mob { display: none; }
  .mode a { flex: 1; justify-content: center; height: 36px; min-width: 0; }
  .mode a span { overflow: hidden; text-overflow: ellipsis; }
  .top.small .mode { display: none; }
}
@media (max-width: 419px) {
  .has-mode:has(.av:not([hidden])) .brand span { display: none; }
}
@media (max-width: 359px) {
  .has-mode .brand span { display: none; }
}
@media (min-width: 1100px) {
  .top .sign { display: inline-flex; }
}
@media (min-width: 900px) {
  .has-mode .find { margin-inline: auto 0; width: auto; flex: 0 1 300px; min-width: 44px; }
}
