@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Nunito:wght@500;600;700;800;900&display=swap');

:root {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: #244a3c;
  background: #a6e6e9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #244a3c;
  --green: #286d50;
  --cream: #fff8e9;
  --coral: #ef795d;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-width: 320px; }
button { font: inherit; }
#game-shell { position: relative; width: 100%; height: 100%; min-height: 540px; overflow: hidden; background: linear-gradient(#a4e2e8, #d2f1d9 68%, #90c85b); }
#game-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; outline: none; }
.hidden { display: none !important; }

.screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 26px; background: linear-gradient(90deg, rgba(22,70,58,.14), transparent 55%); }
#start-screen { place-items: center start; padding-left: clamp(24px, 8vw, 128px); }
.menu-card { position: relative; z-index: 2; width: min(590px, 100%); padding: 35px 40px 26px; border: 1px solid rgba(255,255,255,.82); border-radius: 30px; background: rgba(255,250,236,.94); box-shadow: 0 24px 70px rgba(31,77,59,.2), inset 0 1px 0 #fff; backdrop-filter: blur(14px); }
.game-kicker { color: #78927b; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.game-kicker span { color: #ef9a55; font-size: 14px; margin-right: 4px; }
h1, h2 { font-family: 'Nunito', 'DM Sans', sans-serif; margin: 0; font-weight: 900; letter-spacing: -.065em; }
h1 { color: #244f3e; font-size: clamp(54px, 6.4vw, 80px); line-height: .88; margin-top: 14px; }
h1 em { color: #eb785c; font-style: normal; }
.intro { max-width: 420px; margin: 18px 0 24px; color: #687d6c; font-size: 14px; line-height: 1.55; }
.breed-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 9px; border-bottom: 1px solid #e6e7d8; color: #87927e; font-size: 9px; letter-spacing: .12em; font-weight: 800; }
.breed-note { color: #a6ad9c; font-size: 9px; letter-spacing: 0; font-weight: 600; }
.breed-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 11px; }
.breed-card { min-width: 0; text-align: left; border: 1px solid #e7e7d7; border-radius: 14px; padding: 9px 10px 11px; color: #355443; background: #fffdf6; cursor: pointer; transition: .18s ease; }
.breed-card:hover { transform: translateY(-2px); border-color: #a3c79e; }
.breed-card.selected { background: #eef6e7; border-color: #78ac7c; box-shadow: inset 0 0 0 1px #78ac7c; }
.breed-avatar { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 6px; border-radius: 12px; font-size: 23px; background: #e2efcf; }
.aussie-avatar { background: #f5e4c1; }
.berner-avatar { background: #f4ddd0; }
.breed-name { display: block; font-size: 11px; line-height: 1.2; font-weight: 800; }
.breed-trait { display: block; margin-top: 4px; color: #819181; font-size: 9px; line-height: 1.3; }
.menu-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 15px; min-height: 47px; padding: 0 22px; border: 0; border-radius: 14px; color: white; background: #327454; font-size: 11px; letter-spacing: .07em; font-weight: 800; box-shadow: 0 7px 0 #23583f, 0 12px 18px rgba(44,105,72,.18); cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-button:hover { background: #3e865f; transform: translateY(-2px); box-shadow: 0 9px 0 #23583f, 0 14px 20px rgba(44,105,72,.18); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 3px 0 #23583f; }
.primary-button span { font-size: 18px; line-height: 1; }
.control-note { display: flex; align-items: center; gap: 3px; color: #849081; font-size: 9px; }
kbd { display: inline-grid; place-items: center; min-width: 17px; height: 18px; padding: 0 4px; border: 1px solid #d6dccd; border-bottom-width: 2px; border-radius: 5px; background: #fffef8; color: #506d59; font: 700 9px 'DM Sans', sans-serif; }
.space-key { margin-left: 7px; }
.menu-footnote { margin-top: 20px; text-align: center; color: #adb2a3; font-size: 9px; letter-spacing: .06em; }
.menu-decoration { position: absolute; color: #fff3b6; text-shadow: 0 4px 18px rgba(90,135,81,.13); pointer-events: none; }
.decoration-sun { right: 12%; top: 10%; font-size: clamp(80px, 13vw, 180px); animation: float 7s ease-in-out infinite; }
.decoration-flower { right: 17%; bottom: 12%; color: #ffd798; font-size: 68px; transform: rotate(-13deg); }
@keyframes float { 50% { transform: translateY(11px) rotate(5deg); } }

.hud { position: absolute; z-index: 3; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 19px; width: min(1100px, calc(100% - 34px)); min-height: 68px; padding: 9px 11px 9px 16px; border: 1px solid rgba(255,255,255,.75); border-radius: 20px; background: rgba(255,250,235,.91); box-shadow: 0 10px 30px rgba(28,80,57,.17); backdrop-filter: blur(10px); }
.hud-brand { display: flex; align-items: center; gap: 8px; min-width: 124px; color: #71836b; font-size: 8px; letter-spacing: .13em; line-height: 1.35; }
.hud-brand b { color: #315e44; font-size: 10px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff7d7; background: #6a9a60; font-size: 19px; }
.hud-level { width: 96px; }
.eyebrow { display: block; color: #929985; font-size: 8px; font-weight: 800; letter-spacing: .13em; }
.hud-level strong, .hud-timer strong { display: block; margin-top: 2px; color: #385d46; font-family: 'Nunito', sans-serif; font-size: 17px; font-weight: 900; }
.level-progress { width: 76px; height: 4px; margin-top: 4px; overflow: hidden; border-radius: 5px; background: #e2e6d4; }
.level-progress i { display: block; height: 100%; width: 12.5%; border-radius: inherit; background: #ef9360; transition: width .3s; }
.hud-objective { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 155px; padding-left: 16px; border-left: 1px solid #e4e4d7; }
.objective-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #e17758; background: #fae3cf; font-size: 26px; }
.hud-objective strong { display: block; margin-top: 2px; color: #385d46; font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 900; }
.hud-timer { padding: 0 16px; border-left: 1px solid #e4e4d7; }
.icon-button { display: grid; place-items: center; width: 39px; height: 39px; border: 0; border-radius: 12px; color: #497356; background: #e7f0dc; font-size: 17px; font-weight: 900; cursor: pointer; }
.hint { position: absolute; z-index: 2; top: 103px; left: 50%; transform: translateX(-50%); padding: 8px 15px; border: 1px solid rgba(255,255,255,.7); border-radius: 30px; background: rgba(255,249,232,.83); box-shadow: 0 4px 18px rgba(44,87,53,.1); color: #55755e; font-size: 11px; font-weight: 700; white-space: nowrap; }
.hint-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #ed9564; vertical-align: 1px; }
.bark-indicator { position: absolute; z-index: 2; left: 25px; bottom: 45px; display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.75); border-radius: 15px; background: rgba(255,249,232,.89); box-shadow: 0 7px 25px rgba(44,87,53,.11); }
.bark-key { display: grid; place-items: center; width: 45px; height: 33px; border: 1px solid #d8dcca; border-bottom-width: 3px; border-radius: 8px; color: #43684c; background: #fffef7; font-size: 8px; font-weight: 900; }
.bark-indicator b, .bark-indicator span:not(.bark-key) { display: block; }
.bark-indicator b { color: #42634a; font-size: 9px; letter-spacing: .07em; }
#bark-status { margin-top: 3px; color: #899480; font-size: 9px; }
.bark-meter { width: 47px; height: 4px; border-radius: 6px; background: #dfe5d5; overflow: hidden; }
.bark-meter i { display: block; width: 100%; height: 100%; border-radius: inherit; background: #ed9162; transition: width .1s; }
.game-footer { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 13px 23px; color: rgba(36,74,60,.65); text-shadow: 0 1px rgba(255,255,255,.4); font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.game-footer b { color: #f3f0d4; margin: 0 5px; }

.dialog-card { width: min(440px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.85); border-radius: 26px; text-align: center; background: rgba(255,250,236,.97); box-shadow: 0 25px 75px rgba(31,77,59,.24); }
.compact-card { padding: 34px 39px; }
.dialog-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 17px; color: #55815b; background: #e6f0dc; font-size: 23px; font-weight: 900; }
.dialog-card h2 { margin-top: 7px; color: #315641; font-size: 43px; }
.dialog-card p { margin: 5px 0 22px; color: #7d8977; font-size: 13px; }
.dialog-card .primary-button { width: 100%; margin-top: 8px; }
.text-button { padding: 12px 14px 0; border: 0; background: transparent; color: #81907e; font-size: 11px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: #345f45; }
.result-stamp { display: inline-block; padding: 6px 10px; border-radius: 20px; color: #578159; background: #e9f1dc; font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.result-stamp.final { color: #b06a3e; background: #f7e4cd; }
.dialog-card .game-kicker { margin-top: 17px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 13px 0 16px; margin-bottom: 7px; border-top: 1px solid #e7e7d9; border-bottom: 1px solid #e7e7d9; }
.result-stats b, .result-stats span { display: block; }
.result-stats b { color: #3d694d; font-family: 'Nunito', sans-serif; font-size: 20px; font-weight: 900; }
.result-stats span { margin-top: 3px; color: #99a08e; font-size: 7px; font-weight: 800; letter-spacing: .1em; }
.toast { position: absolute; z-index: 4; top: 135px; left: 50%; transform: translateX(-50%); padding: 11px 19px; border: 1px solid rgba(255,255,255,.8); border-radius: 30px; color: #fffdf2; background: rgba(49,102,70,.91); box-shadow: 0 8px 25px rgba(35,82,53,.2); font-size: 12px; font-weight: 800; white-space: nowrap; animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 720px) {
  #game-shell { min-height: 500px; }
  #start-screen { place-items: center; padding: 12px; }
  .menu-card { padding: 25px 22px 19px; border-radius: 23px; }
  .intro { margin: 13px 0 18px; font-size: 12px; }
  .breed-card { padding: 8px 6px; }
  .breed-name { font-size: 9px; }
  .breed-trait { font-size: 8px; }
  .breed-heading { font-size: 8px; }
  .breed-note { display: none; }
  .menu-bottom { flex-wrap: wrap; }
  .control-note { margin-left: 2px; }
  .menu-footnote { margin-top: 13px; }
  .decoration-sun { right: 0; top: 2%; opacity: .6; }
  .decoration-flower { right: 3%; bottom: 3%; }
  .hud { top: 9px; width: calc(100% - 16px); min-height: 58px; gap: 8px; padding: 7px; border-radius: 16px; }
  .hud-brand { min-width: 0; font-size: 7px; gap: 5px; }
  .hud-brand b { font-size: 8px; }
  .brand-mark { width: 27px; height: 27px; font-size: 15px; }
  .hud-level { width: 67px; }
  .hud-level strong, .hud-timer strong { font-size: 13px; }
  .eyebrow { font-size: 7px; }
  .level-progress { width: 58px; }
  .hud-objective { min-width: 0; gap: 5px; padding-left: 7px; }
  .objective-icon { width: 28px; height: 28px; font-size: 19px; }
  .hud-objective strong { font-size: 10px; }
  .hud-timer { padding: 0 5px; }
  .icon-button { width: 31px; height: 31px; }
  .hint { top: 76px; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; font-size: 9px; }
  .bark-indicator { left: 10px; bottom: 37px; gap: 7px; padding: 7px 9px; }
  .bark-key { width: 39px; height: 29px; }
  .game-footer { padding: 10px 12px; font-size: 7px; }
  .game-footer span:first-child { display: none; }
  .toast { top: 105px; max-width: calc(100% - 30px); font-size: 10px; }
}

@media (max-width: 430px) {
  .hud-brand { display: none; }
  .hud { justify-content: space-between; }
  .hud-objective { flex: 1; }
  .hud-timer { padding: 0 3px; }
}

@media (max-height: 700px) and (min-width: 721px) {
  .menu-card { padding-top: 24px; padding-bottom: 18px; transform: scale(.93); transform-origin: left center; }
  .intro { margin: 12px 0 16px; }
  .breed-options { margin-top: 8px; }
  .menu-bottom { margin-top: 14px; }
  .menu-footnote { margin-top: 13px; }
}
