:root {
  --ink: #173f3d;
  --muted: #536c63;
  --cream: #f6f4eb;
  --gold: #edce8e;
  --line: #d7dfd2;
  --green: #23564d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 17px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
button, input { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible { outline: 3px solid #bc8b35; outline-offset: 4px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.15; letter-spacing: -1.2px; margin-bottom: 12px; }
h2 { font-size: 28px; line-height: 1.2; letter-spacing: -.5px; margin-bottom: 14px; }
.site-header { max-width: 1340px; margin: auto; padding: 22px 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: 25px; font-weight: 750; text-decoration: none; letter-spacing: -.6px; }
.brand h1 { font: inherit; letter-spacing: inherit; margin: 0; }
.game-layout { max-width: 1260px; margin: 12px auto 36px; display: grid; grid-template-columns: 260px minmax(340px, 460px) minmax(260px, 320px); gap: 28px; align-items: start; padding: 0 24px; }
.card { border: 1px solid var(--line); background: #fffdf7; border-radius: 16px; padding: 22px; }
.profile-column, .leaderboard-column { padding-top: 12px; }
.field-label { display: block; font-weight: 650; margin-bottom: 8px; }
input[type=text] { width: 100%; min-height: 56px; background: #f3f5ed; border: 1px solid #bacbbd; border-radius: 8px; padding: 12px; font-size: 19px; color: var(--ink); }
input::placeholder { color: #6e8178; }
.button { min-height: 54px; width: 100%; padding: 12px 16px; display: block; border: 0; border-radius: 9px; font-size: 18px; font-weight: 650; line-height: 1.3; }
.button:not(:disabled):hover { filter: brightness(.96); }
.button-outline { background: transparent; color: var(--ink); border: 2px solid #a9c0ae; }
.button-gold { background: var(--gold); color: #153c35; font-size: 24px; min-height: 64px; }
.button-green { background: var(--green); color: white; }
.button-subtle { background: #ecf0e5; color: var(--ink); font-size: 16px; }
.button-light { background: #ffffff12; border: 1px solid #b6cec2; color: #eff5eb; margin-top: 12px; }
.sound-button { width: auto; min-width: 124px; }
.photo-buttons { display: grid; gap: 10px; margin-top: 14px; }
.profile-actions { display: grid; gap: 10px; margin-top: 12px; }
.profile-actions:not(:has(button:not([hidden]))) { display: none; }
.fine-print { color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.status-line { font-size: 15px; color: #8e5148; margin: 10px 0 0; }
.status-line:empty { display: none; }
/* The profile preview is decorative. Only the in-game bird is scaled down. */
.pilot-preview { width: 100%; height: 150px; border: 0; border-radius: 10px; background: transparent; padding: 0; position: relative; display: flex; justify-content: center; align-items: center; }
.pilot-preview:hover { background: #edf2e5; }
.preview-robin { position: relative; width: 87px; height: 79px; background: #cf9470; border-radius: 50%; transform: rotate(-7deg); box-shadow: inset -12px -15px #bc5550; }
.preview-face { position: absolute; width: 60px; height: 60px; object-fit: cover; border-radius: 50%; left: 22px; top: -5px; z-index: 3; }
.robin-eyes { position: absolute; background: #f7dfc0; border-radius: 50%; width: 60px; height: 60px; left: 22px; top: -5px; text-align: center; font-size: 25px; padding-top: 8px; letter-spacing: 5px; white-space: nowrap; color: #28454a; }
.robin-beak { position: absolute; right: -15px; top: 27px; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 22px solid #edbd70; z-index: 4; }
.robin-wing { position: absolute; left: -10px; top: 42px; width: 40px; height: 26px; background: #a67253; border-radius: 60%; transform: rotate(-23deg); z-index: 4; }
.robin-hat { position: absolute; left: 20px; top: -44px; border-left: 30px solid transparent; border-right: 30px solid transparent; border-bottom: 47px solid #bd5455; transform: rotate(-5deg); z-index: 5; }
.robin-hat:before { content: ''; position: absolute; top: 40px; left: -38px; width: 76px; height: 14px; border-radius: 9px; background: #fff3da; }
.robin-hat:after { content: ''; position: absolute; left: -8px; top: -4px; width: 20px; height: 20px; border-radius: 50%; background: #fff3da; }
.robin-scarf { position: absolute; top: 61px; left: 15px; width: 70px; height: 10px; background: #368575; border-radius: 5px; z-index: 5; }
.robin-scarf:after { content: ''; position: absolute; left: 6px; top: 5px; width: 13px; height: 29px; background: #368575; transform: rotate(20deg); }
.preview-shadow { position: absolute; bottom: 9px; width: 80px; height: 9px; border-radius: 50%; background: #e1e4d9; }
.game-frame { position: relative; width: 100%; aspect-ratio: 2 / 3; border: 6px solid #fffdf6; border-radius: 18px; overflow: hidden; background: #122d40; box-shadow: 0 8px 30px #143b3420, 0 0 0 1px var(--line); isolation: isolate; }
#unity-canvas { display: block; width: 100%; height: 100%; touch-action: none; background: #122d40; }
#unity-canvas:focus-visible { outline-offset: -4px; }
.game-hud { position: absolute; left: 20px; right: 20px; top: 16px; display: flex; justify-content: space-between; pointer-events: none; color: #fff1d0; }
.game-hud span { display: block; font-size: 17px; font-weight: 650; }
.game-hud strong { display: block; font-size: 54px; line-height: 1.1; text-shadow: 0 2px 5px #0005; }
.hud-best { text-align: right; }
.hud-best strong { font-size: 38px; }
.game-overlay { position: absolute; inset: 0; display: grid; justify-items: center; align-items: safe center; overflow-y: auto; background: #102c3e33; padding: 22px; }
.overlay-card { text-align: center; color: #fff5df; width: 100%; max-width: 330px; padding: 28px 22px; background: #173849f0; border: 1px solid #b3c8b13b; border-radius: 14px; }
.overlay-card h2 { font-size: 34px; margin-bottom: 14px; }
.overlay-card > p { font-size: 18px; color: #d5e2d9; margin-bottom: 24px; }
.overlay-card .overlay-status { font-size: 15px; line-height: 1.5; margin: 16px 0 0; }
.overlay-status:empty { display: none; }
.result-score { font-size: 78px; font-weight: 750; color: var(--gold); line-height: 1; margin: 10px 0; }
#result-caption { margin-bottom: 0; }
#results-panel .button-gold { margin-top: 22px; }
#load-progress { height: 6px; margin-top: 16px; background: #ffffff22; border-radius: 4px; overflow: hidden; }
#load-progress span { display: block; width: 0; height: 100%; background: var(--gold); }
.pause-button { position: absolute; bottom: 14px; right: 14px; width: 54px; height: 54px; border: 2px solid #eff5ebaa; border-radius: 12px; background: #173f3de8; color: white; font-size: 24px; }
.prize-card { margin-top: 22px; }
.prize-image { display: block; width: 100%; height: auto; margin: 18px auto; }
.prize-name { font-size: 19px; margin-bottom: 20px; }
.prize-challenge { padding: 16px; background: #f4e6c3; border-radius: 10px; }
.prize-challenge h3 { font-size: 23px; margin: 0 0 10px; }
.prize-challenge p { font-size: 17px; margin: 0; }
.board-heading { font-size: 15px; font-weight: 650; display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.leaderboard { list-style: none; margin: 0; padding: 0; }
.leaderboard li { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-bottom: 1px solid #e3e8dc; }
.rank { width: 22px; flex-shrink: 0; font-size: 19px; color: #5a7665; }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: #e1e9dc; display: grid; place-items: center; color: #42664a; font-size: 19px; }
.pilot-name { font-size: 17px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pilot-points { margin-left: auto; flex-shrink: 0; font-size: 28px; font-weight: 700; }
.is-me { background: #edf2e5; }
.empty-board { text-align: center; padding: 30px 0; }
.empty-board strong { font-size: 24px; }
.empty-board p { font-size: 16px; color: var(--muted); margin: 12px 0 0; }
.my-rank { background: #e7eee0; border-radius: 9px; font-size: 17px; font-weight: 650; margin-top: 16px; padding: 14px; }
.board-footer { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; font-size: 14px; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; max-width: 460px; max-height: calc(100dvh - 24px); width: calc(100% - 24px); color: var(--ink); background: #fffdf7; }
dialog::backdrop { background: #102d3ac4; }
.crop-card, .camera-card { padding: 22px; }
#camera-preview { display: block; width: 100%; max-height: calc(100dvh - 320px); aspect-ratio: 4 / 3; object-fit: contain; background: #122d40; border-radius: 10px; transform: scaleX(-1); margin: 18px 0; }
#camera-status { font-size: 17px; }
#camera-status:empty { display: none; }
.camera-actions { display: grid; gap: 12px; }
.crop-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crop-heading h2 { font-size: 26px; margin-bottom: 0; }
.close-button { width: 48px; min-width: 48px; min-height: 48px; }
.crop-card > p { font-size: 16px; margin: 14px 0; }
#crop-canvas { display: block; width: 100%; aspect-ratio: 1; border-radius: 9px; touch-action: none; background: #dce4d7; margin: 18px 0; }
.crop-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 16px; margin-bottom: 14px; }
.crop-label input { width: 60%; min-height: 30px; accent-color: var(--green); }
#crop-status { color: #984b40; }
#crop-status:empty { display: none; }
@media (max-width: 1050px) {
  .game-layout { grid-template-columns: 220px minmax(300px, 420px) minmax(230px, 280px); gap: 18px; padding: 0 18px; }
  .card { padding: 18px; }
  .overlay-card { padding: 24px 18px; }
}
@media (max-width: 860px) {
  .game-layout { grid-template-columns: minmax(280px, 430px) minmax(230px, 310px); max-width: 790px; gap: 22px; }
  .profile-column { grid-column: 1 / -1; padding-top: 0; }
  .profile-card { display: grid; grid-template-columns: 110px 1fr 190px; column-gap: 18px; align-items: center; }
  .profile-card h2 { display: none; }
  .pilot-preview { grid-column: 1; grid-row: 1 / 5; height: 130px; }
  .field-label { grid-column: 2; grid-row: 1; }
  #player-name { grid-column: 2; grid-row: 2; }
  .photo-buttons { grid-column: 3; grid-row: 1 / 3; margin: 0; }
  .profile-actions { grid-column: 2 / -1; grid-row: 3; }
  .fine-print { grid-column: 2 / -1; grid-row: 4; margin-top: 10px; }
  .status-line { grid-column: 2 / -1; grid-row: 5; }
  .leaderboard-column { padding-top: 0; }
}
@media (max-width: 560px) {
  .site-header { padding: 14px; gap: 12px; }
  .brand { font-size: 21px; gap: 8px; }
  .brand img { width: 38px; height: 38px; }
  .sound-button { min-width: 100px; min-height: 48px; font-size: 16px; padding: 10px; }
  .game-layout { display: flex; flex-direction: column; gap: 20px; padding: 0 14px; max-width: 460px; }
  .profile-column, .play-column, .leaderboard-column { width: 100%; }
  .profile-card { grid-template-columns: 72px 1fr; gap: 0 14px; padding: 16px; }
  .pilot-preview { grid-column: 1; grid-row: 1 / 3; transform: scale(.7); height: 110px; width: 72px; }
  .field-label { grid-column: 2; grid-row: 1; font-size: 16px; }
  #player-name { grid-column: 2; grid-row: 2; min-height: 52px; font-size: 18px; }
  .photo-buttons { grid-column: 1 / -1; grid-row: 3; grid-template-columns: 1fr 1fr; margin-top: 14px; }
  .profile-actions { grid-column: 1 / -1; grid-row: 4; gap: 10px; }
  .fine-print { grid-column: 1 / -1; grid-row: 5; font-size: 14px; }
  .status-line { grid-column: 1 / -1; grid-row: 6; }
  .game-frame { border-width: 5px; }
  .game-hud { left: 14px; right: 14px; top: 12px; }
  .game-hud strong { font-size: 46px; }
  .hud-best strong { font-size: 32px; }
  .game-overlay { padding: 18px; }
  .overlay-card { padding: 24px 18px; }
  .overlay-card h2 { font-size: 30px; }
  .overlay-card > p { font-size: 17px; }
  .overlay-card .overlay-status { font-size: 14px; }
  .result-score { font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
