html, body { margin: 0; height: 100%; overflow: hidden; background: #f0dcae; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.2rem; color: #7a3e1d; gap: 8px; }
#loading .hero { font-size: 4rem; animation: sway 1.6s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(-8deg); } }

.hud { position: fixed; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
#hud-top { top: 0; padding-top: max(10px, env(safe-area-inset-top)); justify-content: space-between; }
#hud-bottom { bottom: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); justify-content: center; }

.pill { background: rgba(255, 250, 240, .95); border-radius: 999px; padding: 8px 14px; font-weight: 800; box-shadow: 0 2px 0 #e8d3a8; }
#coins { font-size: 1.15rem; color: #7a3e1d; }
#farmTitle { font-size: .95rem; color: #2d5e29; max-width: 45vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sync { font-size: 1.1rem; padding: 6px 10px; }

.hud-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; padding: 8px 10px; font-size: 1.7rem; line-height: 1; border-radius: 18px; background: #fffaf0; color: #3b2a1a; box-shadow: 0 3px 0 #e8d3a8; }
.hud-btn span { font-size: .85rem; font-weight: 800; }
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #e8d3a8; background: #fff; }

#toast { position: fixed; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 56px); transform: translate(-50%, -20px); opacity: 0; transition: .25s; background: #3b2a1a; color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 700; z-index: 20; max-width: 90vw; text-align: center; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#modal { position: fixed; inset: 0; background: rgba(59, 42, 26, .45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
#modal .sheet { background: #fffaf0; width: 100%; max-width: 520px; max-height: 80vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 16px 16px max(20px, env(safe-area-inset-bottom)); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; }
#mClose { background: #e8d3a8; color: #3b2a1a; width: 40px; height: 40px; padding: 0; border-radius: 50%; }
#mBody h3 { margin: 16px 0 8px; color: #2d5e29; font-size: 1.05rem; }

.g-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0e2c4; }
.g-row-text { flex: 1; }
.g-choice { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 10px; background: #fff; color: #3b2a1a; border: 2px solid #e8d3a8; font-size: 1.1rem; padding: 14px; }
.g-coins { font-size: 1.1rem; font-weight: 800; color: #7a3e1d; margin: 4px 0; }
.g-need { background: #fbe3e0; color: #b3261e; padding: 10px 14px; border-radius: 12px; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; border: 2px solid rgba(0,0,0,.15); }
.muted { color: #8a7458; font-weight: 400; }
.small-text { font-size: .9rem; margin-top: 14px; }
