/* DogTerritory website. Colours follow the game: orange buttons, cream
   cards, warm brown ink, and the board's region palette (UiKit.ts). */
:root {
  color-scheme: light;
  --orange: #ff8a16;
  --orange-deep: #d95b14;
  --yellow: #ffd45b;
  --cream: #fff6e7;
  --card: #fffdf9;
  --ink: #783925;
  --ink-soft: #9e6e68;
  --line: #f0dcc6;
  --grass: #7eb248;
  --danger: #e84c3c;
  --page: #fdf1df;
  --shadow: 0 10px 30px rgba(120, 57, 37, .12);
  --r-rose: #d67092; --r-leaf: #8cd27c; --r-lavender: #907cdc; --r-mustard: #cea616;
  --r-teal: #3aa8c6; --r-cocoa: #aa6e4a; --r-pink: #f29cdc; --r-coral: #ee8260;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Arial Rounded MT Bold", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --cream: #2c211a; --card: #33271f; --ink: #f6e6d6; --ink-soft: #cdb3a2;
    --line: #4a392d; --page: #1f1813; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --cream: #2c211a; --card: #33271f; --ink: #f6e6d6; --ink-soft: #cdb3a2;
  --line: #4a392d; --page: #1f1813; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

/* One language at a time. Without script the English copy shows. */
html[data-lang="zh"] body [lang="en"],
html:not([data-lang="zh"]) body [lang="zh-CN"] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 17px/1.6 var(--font); overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--orange-deep); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 19px; white-space: nowrap; }
.brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 2px 6px rgba(120, 57, 37, .25); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 999px; }
.nav a:hover { background: var(--cream); }
.lang-toggle {
  font: inherit; font-size: 14px; font-weight: 800; color: var(--ink); cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 5px 12px; margin-left: 4px;
}
.lang-toggle:hover { border-color: var(--orange); }
@media (max-width: 760px) { .nav a.opt { display: none; } }

/* Buttons: the game's chunky orange pill with a darker bottom edge */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 800; font-size: 17px; text-decoration: none; cursor: pointer;
  color: #fff; background: linear-gradient(#ffa13d, var(--orange));
  border: 0; border-radius: 999px; padding: 13px 26px;
  box-shadow: 0 5px 0 var(--orange-deep), 0 10px 20px rgba(217, 91, 20, .28);
  transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-deep), 0 4px 10px rgba(217, 91, 20, .25); }
.btn.ghost { color: var(--ink); background: var(--card); box-shadow: 0 5px 0 var(--line), 0 10px 20px rgba(120, 57, 37, .1); }
.btn.small { font-size: 15px; padding: 9px 18px; }

/* Hero: the backyard from the game */
.hero {
  position: relative; overflow: hidden; color: #5a2a1a;
  background: #9fd06a url("backyard.webp") center 38% / cover no-repeat;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255, 246, 231, .92) 0%, rgba(255, 246, 231, .75) 45%, rgba(255, 246, 231, 0) 75%),
    linear-gradient(0deg, var(--page) 0%, rgba(253, 241, 223, 0) 22%);
}
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 24px; padding-top: 56px; padding-bottom: 72px; min-height: 560px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px;
  background: #fff; color: var(--orange-deep); border-radius: 999px; padding: 6px 14px 6px 8px; box-shadow: var(--shadow);
}
.pill img { width: 24px; height: 24px; }
.hero h1 { margin: 18px 0 6px; font-size: clamp(44px, 7vw, 76px); line-height: 1.02; font-weight: 900; letter-spacing: -.5px; color: var(--orange-deep); text-shadow: 0 3px 0 #fff, 0 6px 18px rgba(217, 91, 20, .25); }
.hero .sub { font-size: clamp(22px, 3vw, 28px); font-weight: 900; margin: 0 0 16px; color: var(--ink); }
.hero .lede { font-size: 19px; max-width: 520px; margin: 0 0 28px; color: #6b3522; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero .corgi { width: min(420px, 100%); height: auto; justify-self: center; filter: drop-shadow(0 18px 20px rgba(60, 90, 20, .35)); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-14px) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .hero .corgi, .float-bone { animation: none; } html { scroll-behavior: auto; } }
.float-bone { position: absolute; width: 56px; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .15)); }
@media (max-width: 820px) {
  .hero::before { background: linear-gradient(0deg, rgba(255, 246, 231, .95) 0%, rgba(255, 246, 231, .82) 55%, rgba(255, 246, 231, .3) 100%); }
  .hero .wrap { grid-template-columns: 1fr; text-align: center; padding-top: 28px; min-height: 0; }
  .hero .corgi { width: 200px; grid-row: 1; }
  .hero .lede { margin-left: auto; margin-right: auto; }
  .hero .actions { justify-content: center; }
  .float-bone { display: none; }
}

/* Sections */
section.block { padding: 72px 0; }
.eyebrow { display: inline-block; font-weight: 900; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--orange); margin-bottom: 6px; }
h2.title { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.15; margin: 0 0 12px; font-weight: 900; }
.intro { font-size: 18px; color: var(--ink-soft); max-width: 640px; margin: 0 0 36px; }
.center { text-align: center; }
.center .intro { margin-left: auto; margin-right: auto; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }

/* Rules */
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.rule-list { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.rule-list li { display: flex; gap: 16px; align-items: center; padding: 14px 18px; font-weight: 800; font-size: 18px; }
.rule-list .ico { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--cream); }
.rule-list .ico svg { width: 34px; height: 34px; }
.rule-list small { display: block; font-weight: 600; font-size: 15px; color: var(--ink-soft); }
@media (max-width: 820px) { .rules { grid-template-columns: 1fr; } }

/* Boards (mini example and the playable demo) */
.board {
  --n: 6; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px;
  background: #fff; padding: 8px; border-radius: 22px; border: 3px solid #f1dcc4;
  box-shadow: 0 8px 0 #e9cfb2, var(--shadow); width: 100%; max-width: 440px; margin: 0 auto;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.cell {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; margin: 0; border-radius: 7px;
  background: var(--c, #eee); cursor: pointer; display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .1), inset 0 2px 0 rgba(255, 255, 255, .25);
  transition: filter .12s, transform .12s;
}
.cell:hover { filter: brightness(1.06); }
.cell:disabled { cursor: default; }
.cell .x { width: 42%; height: 42%; position: relative; }
.cell .x::before, .cell .x::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 118%; height: 20%; background: #fff; border-radius: 99px;
  transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 1px 2px rgba(60, 44, 32, .35);
}
.cell .x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cell img { width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.cell.bad { animation: shake .36s; box-shadow: inset 0 0 0 3px var(--danger), inset 0 -3px 0 rgba(0, 0, 0, .1); }
.cell.bad::after { content: ""; position: absolute; inset: 0; border-radius: 7px; background: rgba(232, 76, 60, .35); }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.board.solved .cell { cursor: default; }
.board.solved .cell img { animation: hop .5s ease-in-out 2; }
@keyframes hop { 50% { transform: translateY(-18%) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .cell img, .board.solved .cell img { animation: none; } }
.board.mini { max-width: 300px; --n: 4; }
.board.mini .cell { cursor: default; }

.play { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.play-side { display: grid; gap: 16px; }
.howto { padding: 20px 22px; }
.howto p { margin: 0 0 8px; }
.howto p:last-child { margin: 0; }
.status { display: flex; align-items: center; gap: 12px; min-height: 64px; font-weight: 800; font-size: 18px; padding: 10px 18px; }
.status img { width: 52px; height: 52px; flex: none; }
.status.win { background: #fff4d4; border-color: var(--yellow); }
.status.oops { background: #fde6e2; border-color: #f4b7ad; }
:root[data-theme="dark"] .status.win, :root[data-theme="dark"] .status.oops { color: #783925; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.win, :root:not([data-theme="light"]) .status.oops { color: #783925; } }
.play-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 820px) { .play { grid-template-columns: 1fr; } }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { padding: 26px 24px; position: relative; overflow: hidden; }
.feature .badge { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 14px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); }
.feature .badge svg, .feature .badge img { width: 34px; height: 34px; }
.feature h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.25; font-weight: 900; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 16px; }
@media (max-width: 900px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 580px) { .features { grid-template-columns: 1fr; } }

/* Stats band */
.stats { background: linear-gradient(135deg, #ffa13d, var(--orange-deep)); color: #fff; border-radius: 32px; padding: 34px 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; box-shadow: 0 8px 0 #b84a0f, var(--shadow); }
.stats b { display: block; font-size: clamp(34px, 5vw, 50px); line-height: 1.05; font-weight: 900; text-shadow: 0 3px 0 rgba(120, 40, 10, .35); }
.stats span { font-weight: 800; font-size: 15px; opacity: .95; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr; row-gap: 22px; } }

/* Dogs */
.dogs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.dog { padding: 14px 12px 16px; text-align: center; transition: transform .18s; }
.dog:hover { transform: translateY(-6px) rotate(-1deg); }
.dog .pic { border-radius: 20px; background: radial-gradient(circle closest-side at 50% 54%, var(--c) 0 90%, transparent 91%); }
.dog img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.dog b { display: block; margin-top: 6px; font-size: 17px; font-weight: 900; }
@media (max-width: 760px) { .dogs { grid-template-columns: 1fr 1fr; } }

/* Closing call to action */
.cta { text-align: center; padding: 48px 20px; position: relative; overflow: hidden; background: var(--cream); }
.cta .heads { display: flex; justify-content: center; gap: 4px; margin-bottom: 12px; }
.cta .heads img { width: 56px; height: 56px; }
.cta h2 { margin: 0 0 8px; font-size: clamp(26px, 3.6vw, 36px); font-weight: 900; }
.cta p { margin: 0 auto 22px; color: var(--ink-soft); max-width: 560px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.cta .note { margin: 18px auto 0; font-size: 14px; }

/* Footer */
.footer { padding: 40px 0 48px; color: var(--ink-soft); font-size: 15px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer a { color: var(--ink); font-weight: 700; text-decoration: none; }
.footer a:hover { color: var(--orange-deep); text-decoration: underline; }

/* Document pages: support, privacy, terms */
.doc-hero { padding: 44px 0 24px; text-align: center; }
.doc-hero img { width: 120px; height: auto; margin: 0 auto 6px; filter: drop-shadow(0 10px 10px rgba(120, 57, 37, .2)); }
.doc-hero h1 { margin: 0; font-size: clamp(32px, 5vw, 46px); font-weight: 900; color: var(--orange-deep); }
.doc-hero .meta { color: var(--ink-soft); margin: 4px 0 0; font-weight: 700; }
.doc { max-width: 780px; margin: 0 auto 24px; padding: 34px clamp(20px, 5vw, 48px) 38px; }
.doc h2 { font-size: 21px; margin: 30px 0 8px; font-weight: 900; display: flex; align-items: center; gap: 10px; }
.doc h2::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 4px; background: var(--orange); transform: rotate(45deg); }
.doc h2:first-child { margin-top: 0; }
.doc p, .doc li { margin: 0 0 10px; }
.doc ul { padding-left: 22px; }
.contact-card { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 22px 24px; margin-bottom: 26px; background: var(--cream); border-radius: 20px; border: 2px dashed var(--line); }
.contact-card img { width: 64px; height: 64px; }
.contact-card div { flex: 1 1 240px; }
.contact-card b { display: block; font-size: 19px; }
.faq details { border-bottom: 2px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--orange); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 10px 0 2px; color: var(--ink-soft); }
