/* =====================================================================
   Owl Night Watch — AnimalSake
   Warm AnimalSake resource page around a moonlit Canvas 2D forest game.
   Page chrome matches the AnimalSake games; the canvas scene is night.
   ===================================================================== */

:root {
  --as-bg:     #fdf6e9;
  --as-card:   #fff8ec;
  --as-brown:  #4b2f20;
  --as-orange: #ff5a00;
  --as-green:  #5aa545;
  --as-yellow: #f8e7c2;
  --as-blue:   #2e9fe6;
  --as-shadow: 0 12px 30px rgba(75, 47, 32, 0.14);

  --as-brown-soft:  #6f5b4a;
  --as-orange-deep: #e54f00;
  --as-green-deep:  #468539;
  --as-line:        #efe0c8;
  --as-card-soft:   #fffdf8;

  /* game palette (night) */
  --night-bg:    #14213d;
  --moonlight:   #f8e7c2;
  --tree-dark:   #263044;
  --glow-blue:   #66d9ff;
  --owl-brown:   #8a5a3c;

  --radius:    22px;
  --radius-sm: 14px;
  --maxw: 980px;
  --font: "Baloo 2", "Quicksand", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--as-brown);
  background:
    radial-gradient(1200px 520px at 50% -160px, #ffe9c9 0%, rgba(255,233,201,0) 70%),
    var(--as-bg);
  line-height: 1.55;
  font-size: 17px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.12; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
strong { color: var(--as-orange-deep); }
a { color: var(--as-orange-deep); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 24px;
  font-family: var(--font); font-weight: 700; font-size: 16px; color: #fff;
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--lg { padding: 16px 32px; font-size: 18px; }
.btn--sm { padding: 9px 14px; font-size: 14px; }
.btn--primary { background: var(--as-green); box-shadow: 0 8px 18px rgba(90,165,69,.32); }
.btn--primary:hover { background: var(--as-green-deep); }
.btn--orange { background: var(--as-orange); box-shadow: 0 8px 18px rgba(255,90,0,.28); }
.btn--orange:hover { background: var(--as-orange-deep); }
.btn--listen { background: #2a86c9; box-shadow: 0 8px 18px rgba(42,134,201,.32); }
.btn--listen:hover { background: #2273ad; }
.btn--ghost { background: var(--as-card-soft); color: var(--as-brown); border: 2px solid var(--as-line); }
.btn--ghost:hover { background: #fff; border-color: #e3cfa8; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }

:focus-visible { outline: 3px solid var(--as-blue); outline-offset: 3px; border-radius: 6px; }

/* ---------- Page chrome ---------- */
.wordmark { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 26px; }
.wordmark__paw { font-size: 22px; }
.wordmark__a { color: var(--as-brown); }
.wordmark__b { color: var(--as-orange); }
.site-nav a { font-weight: 700; color: var(--as-brown); }
.site-nav a:hover { color: var(--as-orange-deep); }

.page { max-width: var(--maxw); margin: 0 auto; padding: 8px 20px 48px; }
.resource { display: flex; flex-direction: column; gap: 26px; }

/* ---------- Intro ---------- */
.eyebrow { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--as-orange); background: #fff; border: 2px solid var(--as-line); border-radius: 999px; padding: 5px 14px; margin-bottom: 12px; }
.intro h1 { font-size: 40px; color: var(--as-brown); margin-bottom: 12px; }
.lede { font-size: 20px; color: var(--as-brown); max-width: 62ch; margin-bottom: 18px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.meta-pill { display: inline-flex; align-items: center; gap: 7px; background: var(--as-card); border: 2px solid var(--as-line); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; color: var(--as-brown); }

/* =====================================================================
   Game widget shell
   ===================================================================== */
.game-shell { position: relative; border-radius: var(--radius); overflow: hidden; }

/* HUD */
.hud {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  background: var(--as-card); border: 2px solid var(--as-line);
  border-radius: var(--radius); box-shadow: var(--as-shadow); padding: 12px 16px; margin-bottom: 12px;
}
.hud__title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--as-brown); }
.hud__logo { font-size: 22px; }
.hud__stats { display: flex; gap: 8px; flex-wrap: wrap; }
.hud__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: var(--as-brown); background: var(--as-yellow); border-radius: 999px; padding: 7px 13px; white-space: nowrap; overflow: hidden; }
.chip__label { position: relative; z-index: 1; }
.chip--hearts { gap: 3px; font-size: 17px; line-height: 1; padding: 6px 12px; }
.heart { color: var(--as-orange); }
.heart--empty { color: #d9c6a6; }

/* stealth bar chip */
.chip--bar .bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: rgba(90,165,69,.34); z-index: 0; transition: width .12s linear, background-color .2s ease; }
.chip--stealth.is-low .bar-fill { background: rgba(255,90,0,.32); }

/* cooldown chips (Night Vision / Listen) */
.chip--cd { background: #e1f4fb; color: #1f5e7a; }
.chip--cd .cd-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: rgba(102,217,255,.45); z-index: 0; transition: width .06s linear; }
.chip--nv.is-cool .cd-fill { background: rgba(255,90,0,.30); }
.chip--listen.is-cool .cd-fill { background: rgba(42,134,201,.28); }

/* dark game card */
.canvas-wrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--as-shadow); border: 2px solid #1b2942; background: var(--night-bg); }
.game-canvas { display: block; width: 100%; height: auto; aspect-ratio: 960 / 600; touch-action: none; background: var(--night-bg); }

/* touch / d-pad controls */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.dpad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 58px); gap: 8px; align-items: center; justify-content: center; }
.dbtn {
  border: 0; border-radius: 16px; background: var(--as-card); border: 2px solid var(--as-line);
  color: var(--as-brown); font-size: 22px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 10px rgba(75,47,32,.1); -webkit-tap-highlight-color: transparent;
  transition: transform .1s ease, background-color .12s ease; width: 58px; height: 58px;
}
.dbtn:hover { background: var(--as-yellow); }
.dbtn:active { transform: translateY(2px); background: #ffe8b4; }
.dbtn--up { grid-column: 2; grid-row: 1; }
.dbtn--left { grid-column: 1; grid-row: 2; }
.dbtn--down { grid-column: 2; grid-row: 2; }
.dbtn--right { grid-column: 3; grid-row: 2; }

.action-row { display: flex; gap: 12px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }

.sense-btn, .sentry-btn { position: relative; overflow: hidden; min-width: 168px; height: 58px; font-size: 17px; }
.sense-btn__label, .sentry-btn__label { position: relative; z-index: 2; }
.sense-btn__fill, .sentry-btn__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: rgba(255,255,255,.30); z-index: 1; }
.sentry-btn.is-cool { background: #c9b48f; }
.sense-btn.is-cool { background: #8fb6cf; }

/* =====================================================================
   Overlays (scoped to the game shell)
   ===================================================================== */
.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 460px at 50% 40%, rgba(28,42,74,0.86) 0%, rgba(20,33,61,0.95) 70%);
  border-radius: var(--radius); overflow-y: auto;
}
.overlay[hidden] { display: none; }
.overlay__card { width: min(560px, 100%); background: var(--as-card); border: 2px solid var(--as-line); border-radius: 26px; box-shadow: 0 24px 60px rgba(8,12,22,.5); padding: 32px 28px; text-align: center; }
.overlay__card--wide { width: min(620px, 100%); }
.overlay__emoji { font-size: 56px; line-height: 1; margin-bottom: 6px; }
.overlay__title { font-size: 36px; color: var(--as-brown); margin-bottom: 10px; }
.overlay__sub { font-size: 18px; color: var(--as-brown); margin-bottom: 18px; }
.overlay__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

.mini-panel { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.mini-panel li { display: flex; flex-direction: column; gap: 2px; background: var(--as-yellow); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; }
.mini-panel li span { color: var(--as-brown-soft); font-weight: 600; }
.mini-panel li strong { color: var(--as-brown); font-size: 15px; }

.best-line { font-size: 14px; color: var(--as-brown-soft); margin-bottom: 14px; }

.howto-list { text-align: left; display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; }
.howto-list li { background: var(--as-card-soft); border: 2px solid var(--as-line); border-left: 6px solid var(--as-green); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; }
.fineprint { color: var(--as-brown-soft); font-size: 13px; margin-bottom: 18px; }

.field-note { font-size: 19px; color: var(--as-brown); background: var(--as-card-soft); border: 2px solid var(--as-line); border-left: 6px solid var(--as-orange); border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 18px; text-align: left; }
.field-note--blue { border-left-color: #2a86c9; }

.rank-line { font-size: 18px; margin-bottom: 14px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 auto 16px; max-width: 540px; }
.result-grid li { background: var(--as-card-soft); border: 1px solid var(--as-line); border-radius: 12px; padding: 10px 8px; text-align: center; }
.result-grid .rk { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--as-brown-soft); margin-bottom: 4px; }
.result-grid .rv { font-size: 22px; font-weight: 800; color: var(--as-brown); }

.medallion { width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe27a, #ffc23a 70%); display: grid; place-items: center; box-shadow: 0 10px 22px rgba(255,180,40,.4), inset 0 -6px 12px rgba(180,120,0,.25); border: 4px solid #fff3d6; }
.medallion__star { color: #fff; font-size: 42px; text-shadow: 0 2px 4px rgba(160,110,0,.35); }

/* =====================================================================
   Below-game content + related
   ===================================================================== */
.learn-below { background: var(--as-yellow); border-radius: var(--radius); padding: 22px 24px; }
.learn-below__title { font-size: 22px; color: var(--as-brown); margin-bottom: 14px; }
.learn-below__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.learn-below__list li { display: flex; align-items: center; gap: 10px; background: #fffdf8; border-radius: var(--radius-sm); padding: 14px 16px; font-weight: 700; font-size: 15px; box-shadow: 0 3px 8px rgba(75,47,32,.07); }
.learn-below__list li span { font-size: 24px; }

.related__title { font-size: 24px; color: var(--as-brown); margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.related-card { display: flex; align-items: center; gap: 12px; background: var(--as-card); border: 2px solid var(--as-line); border-radius: var(--radius-sm); padding: 16px 18px; font-weight: 700; font-size: 16px; color: var(--as-brown); box-shadow: 0 4px 10px rgba(75,47,32,.07); transition: transform .12s ease, border-color .15s ease; }
.related-card:hover { transform: translateY(-2px); border-color: var(--as-orange); color: var(--as-orange-deep); }
.related-card__emoji { font-size: 26px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .page { padding: 4px 14px 36px; }
  .resource { gap: 20px; }
  .intro h1 { font-size: 30px; }
  .lede { font-size: 17px; }
  .learn-below__list { grid-template-columns: 1fr; }

  .hud { padding: 10px 12px; gap: 8px 10px; }
  .hud__title { font-size: 17px; width: 100%; }
  .hud__actions { margin-left: 0; width: 100%; }

  .overlay__title { font-size: 30px; }
  .overlay__card { padding: 26px 20px; }
}

@media (max-width: 700px) {
  .controls { flex-direction: column; gap: 14px; }
  .dpad { grid-template-columns: repeat(3, 66px); grid-template-rows: repeat(2, 66px); }
  .dbtn { width: 66px; height: 66px; font-size: 26px; }
  .action-row { width: 100%; justify-content: stretch; }
  .sense-btn, .sentry-btn { flex: 1; width: 100%; min-width: 0; }
}

@media (max-width: 380px) {
  .intro h1 { font-size: 25px; }
  .dpad { grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 60px); }
  .dbtn { width: 60px; height: 60px; }
  .action-row { flex-direction: column; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .dbtn, .related-card { transition: none; }
  .btn:hover, .dbtn:active, .related-card:hover { transform: none; }
}
