:root {
  --cream: #fffaf0;
  --paper: #fffef9;
  --ink: #3b302b;
  --muted: #8c7c71;
  --line: #eadfce;
  --pink: #f3b4af;
  --pink-dark: #cb726c;
  --peach: #f8d5b6;
  --green: #a8bf83;
  --green-dark: #6d8757;
  --purple: #392055;
  --shadow: 0 18px 45px rgba(106, 78, 58, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(243, 180, 175, 0.18), transparent 28rem),
    radial-gradient(circle at 92% 95%, rgba(168, 191, 131, 0.2), transparent 30rem),
    var(--cream);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow-x: hidden;
}

button, canvas, .virtual-joystick { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; }

.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: 0 30px 30px; }

.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font-family: "STKaiti", "KaiTi", serif; font-size: 21px; letter-spacing: 0.08em; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: 0.18em; margin-top: 2px; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 5px 7px rgba(62,35,50,.18)); }

.topbar-stats { display: flex; align-items: center; gap: 10px; }
.stat-pill { height: 42px; display: flex; align-items: center; padding: 0 15px; border: 1px solid var(--line); background: rgba(255,255,255,.72); border-radius: 999px; box-shadow: 0 8px 20px rgba(100,70,50,.05); }
.stat-pill span { font-size: 11px; color: var(--muted); margin-right: 8px; }
.stat-pill strong { font-size: 16px; }
.stat-pill em { font-size: 11px; font-style: normal; color: #b7a89d; margin-left: 2px; }
.stat-pill .heart-icon { font-size: 17px; color: #e87975; }
.coin-pill { cursor: pointer; min-width: 76px; justify-content: center; transition: .2s ease; }
.coin-pill:hover { transform: translateY(-2px); background: white; }
.stat-pill .coin-icon, .coin-dot { color: #e9ad39; font-size: 15px; margin-right: 7px; text-shadow: 0 1px 0 #b77a1a; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.72); cursor: pointer; font-size: 18px; transition: .2s ease; }
.icon-button:hover { transform: translateY(-2px); background: white; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; align-items: start; }
.game-card, .panel-card { background: rgba(255,255,255,.82); border: 1px solid rgba(224,208,190,.9); box-shadow: var(--shadow); }
.game-card { min-width: 0; border-radius: 30px; overflow: hidden; }

.objective-bar { position: relative; min-height: 77px; padding: 12px 22px; display: flex; align-items: center; gap: 14px; background: linear-gradient(90deg, #fffefd, #fffaf3); border-bottom: 1px solid var(--line); }
.objective-food { min-width: 50px; height: 50px; padding: 3px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 31px; background: #fff3e7; border: 1px solid #f1ddca; border-radius: 17px; box-shadow: 0 7px 15px rgba(129,87,53,.08); }
.objective-food span { width: 39px; height: 43px; display: grid; place-items: center; }
.objective-food span + span { margin-left: -8px; }
.objective-food img { width: 43px; height: 43px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(93,57,31,.16)); }
.objective-copy { display: grid; min-width: 130px; }
.objective-copy span, .timer span { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.objective-copy strong { font-size: 16px; margin-top: 3px; }
.objective-progress { flex: 1; display: flex; align-items: center; gap: 11px; margin-left: 8px; }
.objective-progress > strong { min-width: 38px; font-size: 12px; color: var(--pink-dark); }
.objective-progress > div { flex: 1; height: 8px; border-radius: 99px; background: #f4e9df; overflow: hidden; }
.objective-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #edaaa5, #d77773); border-radius: inherit; transition: width .35s ease; }
.timer { min-width: 106px; padding-left: 18px; border-left: 1px solid var(--line); text-align: right; }
.timer strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 22px; margin-left: 4px; }
.timer em { font-style: normal; font-size: 10px; color: var(--muted); margin-left: 2px; }
.timer.danger strong { color: #dd645e; animation: timerPulse .7s infinite alternate; }

.canvas-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9.2; min-height: 460px; overflow: hidden; background: #f5efd9; }
#gameCanvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.ambient-label { position: absolute; pointer-events: none; color: rgba(88,104,62,.36); font-family: "STKaiti", "KaiTi", serif; }
.ambient-label-one { left: 18px; bottom: 16px; font-size: 12px; letter-spacing: .35em; }
.ambient-label-two { right: 20px; bottom: 17px; font-size: 10px; letter-spacing: .18em; }
.mobile-controls { display: none; }

.game-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(255, 251, 241, .73); backdrop-filter: blur(5px); opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }
.game-overlay.show { opacity: 1; visibility: visible; }
.overlay-card { display: flex; width: min(780px, 94%); align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.eyebrow { color: var(--pink-dark); font: 700 10px/1 system-ui, sans-serif; letter-spacing: .32em; margin-bottom: 11px; }
.hero-hole { position: relative; width: 132px; height: 132px; margin: 0 auto 9px; display: grid; place-items: center; }
.hole-core, .mini-hole {
  position: relative; border-radius: 47% 53% 51% 49%;
  background: radial-gradient(circle at 48% 44%, #5a2c7e 0 6%, #261037 37%, #0c0714 68%, #020203 100%);
  box-shadow: 0 0 0 10px #faece5, 0 0 0 13px #e9bbb0, 0 10px 25px rgba(44,21,58,.26), inset 0 0 18px #8c4ba6;
}
.hole-core { width: 88px; height: 88px; animation: breathe 2.6s ease-in-out infinite; }
.hole-core::after, .mini-hole::after { content: ""; position: absolute; inset: 15%; border-radius: 50%; background-image: radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 1.6px); background-size: 19px 17px; opacity: .35; }
.hole-core span, .mini-hole span { position: absolute; z-index: 2; font-size: 30px; right: -22px; top: 23px; filter: drop-shadow(0 2px 1px white); }
.hole-core span:has(img) { inset: 50% auto auto 50%; width: 142px; height: 142px; transform: translate(-50%, -50%); }
.hole-core span img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 7px 9px rgba(47,25,55,.2)); }
.hero-orbit { position: absolute; font-size: 27px; animation: orbitBob 2.2s ease-in-out infinite alternate; }
.hero-orbit img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(83,53,32,.2)); }
.fruit-one { left: -4px; top: 12px; transform: rotate(-15deg); }
.fruit-two { right: -2px; bottom: 12px; animation-delay: -.7s; }
.fruit-three { right: 2px; top: 1px; font-size: 23px; animation-delay: -1.3s; }
.overlay-card h1 { font-family: "STKaiti", "KaiTi", serif; font-size: clamp(31px, 4vw, 47px); line-height: 1.03; margin: 3px 0 9px; font-weight: 700; letter-spacing: .03em; }
.overlay-card h1 em { color: var(--pink-dark); font-style: normal; }
.overlay-card > p { max-width: 540px; color: #76675e; line-height: 1.65; font-size: 13px; margin: 0 0 19px; }
.primary-button { border: 0; border-radius: 999px; background: var(--ink); color: white; min-width: 218px; height: 50px; padding: 0 12px 0 27px; cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; gap: 22px; font-weight: 700; box-shadow: 0 12px 22px rgba(47,37,32,.18); transition: .2s ease; }
.primary-button i { height: 34px; min-width: 62px; padding: 0 10px; border-radius: 99px; display: grid; place-items: center; background: rgba(255,255,255,.12); font-size: 11px; font-style: normal; color: #f5ccc9; }
.primary-button:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 15px 26px rgba(47,37,32,.23); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.compact-button { min-width: 0; height: 44px; padding-left: 20px; }
.compact-button i { min-width: 54px; height: 30px; }
.ghost-button { min-width: 0; height: 42px; padding: 0 18px; font-weight: 700; }
.control-hint { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: #9b8c82; font-size: 10px; }
.control-hint span { padding: 5px 10px; border: 1px solid #ded2c5; background: rgba(255,255,255,.6); border-radius: 6px; }
.control-hint b { font-weight: 400; }
.mode-actions { display: grid; gap: 8px; margin-top: 12px; place-items: center; }
.mode-actions p { margin: 0; max-width: 420px; color: #8f7e74; font-size: 11px; line-height: 1.6; }

.multiplayer-panel { position: absolute; z-index: 9; inset: 0; padding: 22px; background: rgba(255, 250, 241, .84); backdrop-filter: blur(6px); display: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.multiplayer-panel.show { display: grid; place-items: center; align-content: start; }
.multiplayer-card { width: min(720px, 100%); padding: 22px 24px 24px; border-radius: 28px; border: 1px solid rgba(224,208,190,.95); background: rgba(255,255,255,.97); box-shadow: 0 24px 70px rgba(49,25,43,.18); }
.multiplayer-heading { margin-bottom: 8px; }
.multiplayer-description { margin: 0; color: #756860; font-size: 12px; line-height: 1.7; }
.multiplayer-room-badge { display: inline-flex; align-items: center; margin-top: 14px; padding: 7px 12px; border-radius: 999px; background: #fff5eb; border: 1px solid #efd8c2; color: #b26d43; font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.multiplayer-view { margin-top: 18px; }
.multiplayer-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.multiplayer-choice-card { padding: 18px; border: 1px solid #ecd8c7; border-radius: 24px; background: linear-gradient(180deg, #fffdf9, #fff6ec); text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.multiplayer-choice-card:hover { transform: translateY(-2px); border-color: #d5a38b; box-shadow: 0 12px 24px rgba(117,78,52,.08); }
.multiplayer-choice-card strong { display: block; font-size: 18px; font-family: "STKaiti", "KaiTi", serif; }
.multiplayer-choice-card span { display: block; margin-top: 8px; color: #786961; font-size: 12px; line-height: 1.65; }
.multiplayer-form { margin-top: 16px; display: grid; gap: 8px; }
.multiplayer-form label { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.multiplayer-input-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.multiplayer-input-row input { flex: 0 1 220px; min-width: 0; max-width: 220px; height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid #e5d8cb; background: #fffefb; color: var(--ink); font: inherit; font-size: 13px; }
.multiplayer-input-row input:focus { outline: 2px solid rgba(203,114,108,.22); border-color: #d89a95; }
#joinRoomCodeInput { flex-basis: 132px; max-width: 132px; text-align: center; letter-spacing: .18em; }
.multiplayer-self-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 12px 14px; border-radius: 18px; background: #fffaf4; border: 1px solid #efdfcf; }
.multiplayer-self-summary span { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.multiplayer-self-summary strong { font-size: 16px; }
.multiplayer-status-strip { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.multiplayer-status-strip > div { min-width: 0; padding: 13px 14px; border-radius: 18px; background: #fff9f1; border: 1px solid #f0dfcb; }
.multiplayer-status-strip span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.multiplayer-status-strip strong { display: block; margin-top: 5px; font-size: 16px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.multiplayer-roster-wrap { margin-top: 18px; padding: 14px; border-radius: 22px; background: linear-gradient(180deg, #fffdf9, #fff8f0); border: 1px solid #efe0d4; }
.multiplayer-roster-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.multiplayer-roster-heading span { color: var(--muted); font-size: 10px; }
.multiplayer-roster-heading strong { font-size: 12px; }
.multiplayer-roster { display: grid; gap: 10px; }
.multiplayer-roster-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 18px; background: white; border: 1px solid #eee4d8; min-width: 0; }
.multiplayer-roster-item.self { border-color: #d9a29d; background: #fff5f2; }
.multiplayer-roster-item strong { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.multiplayer-roster-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; flex-wrap: wrap; justify-content: flex-end; }
.multiplayer-tag { padding: 4px 8px; border-radius: 999px; background: #f4e8db; color: #9d7258; font-size: 9px; font-weight: 700; letter-spacing: .06em; }
.multiplayer-tag.host { background: #ffe7db; color: #c87148; }
.multiplayer-tag.ready { background: #eef5e3; color: #6d8757; }
.multiplayer-tag.waiting { background: #f8ebe2; color: #b1785f; }
.multiplayer-footer { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.multiplayer-footer p { margin: 0; color: #7a6b62; font-size: 11px; line-height: 1.7; }
.multiplayer-action-row { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.multiplayer-action-row .primary-button { min-width: 178px; }

body.multiplayer-open { overflow: hidden; }
body.multiplayer-open .side-panel { display: none !important; }
body.multiplayer-open .game-layout { grid-template-columns: 1fr; }

.toast { position: absolute; z-index: 6; left: 50%; top: 90px; transform: translate(-50%, -14px); background: rgba(59,48,43,.9); color: white; padding: 9px 15px; border-radius: 99px; font-size: 12px; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: 0 8px 22px rgba(0,0,0,.16); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.game-footer { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 10px 22px; border-top: 1px solid var(--line); }
.status-copy { display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 9px; }
.live-dot { grid-row: 1 / 3; width: 8px; height: 8px; border-radius: 50%; background: #9aaf71; box-shadow: 0 0 0 4px rgba(154,175,113,.16); }
.status-copy strong { font-size: 12px; }
.status-copy small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.footer-actions { display: flex; gap: 8px; }
.secondary-button { height: 36px; padding: 0 15px; border-radius: 99px; border: 1px solid var(--line); background: white; cursor: pointer; font-size: 11px; transition: .2s ease; }
.secondary-button:hover:not(:disabled) { border-color: #d4b6a2; transform: translateY(-1px); }
.secondary-button:disabled { opacity: .4; cursor: not-allowed; }

.side-panel { display: grid; gap: 15px; }
.panel-card { border-radius: 24px; padding: 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.panel-heading span { color: var(--pink-dark); font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.panel-heading h2 { font-family: "STKaiti", "KaiTi", serif; margin: 3px 0 0; font-size: 20px; }
.mission-stamp { display: grid; place-items: center; width: 43px; height: 43px; border: 1px dashed #ce8881; border-radius: 50%; color: #c36e68; font-family: "STKaiti", "KaiTi", serif; font-size: 12px; transform: rotate(7deg); background: #fff5f1; }
.mission-target { display: flex; align-items: center; gap: 13px; background: #fff7ed; border: 1px solid #f0dfcb; border-radius: 18px; padding: 12px; }
.mission-target > div { min-width: 48px; height: 48px; padding: 2px; border-radius: 14px; background: white; display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 6px 15px rgba(100,60,30,.08); }
.mission-target > div span { width: 36px; height: 43px; display: grid; place-items: center; }
.mission-target > div span + span { margin-left: -8px; }
.mission-target > div img { width: 43px; height: 43px; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(93,57,31,.14)); }
.mission-target p { margin: 0; display: grid; gap: 3px; }
.mission-target p span { font-size: 10px; color: var(--muted); }
.mission-target p strong { display: grid; gap: 1px; font-size: 14px; }
.mission-target p strong b { font: inherit; white-space: nowrap; }
.mission-card ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.mission-card li { display: flex; align-items: center; gap: 9px; font-size: 10px; color: #796b63; }
.mission-card li i { font: 700 9px/21px system-ui; text-align: center; width: 21px; height: 21px; flex: 0 0 auto; color: #7f9460; background: #eff3e7; border-radius: 50%; }
.text-button { border: 0; background: transparent; color: #9b7d6c; font-size: 10px; cursor: pointer; padding: 5px 0; border-bottom: 1px solid #d7c7bb; }
.level-reward-card { position: relative; display: grid; grid-template-columns: 58px minmax(0,1fr) 68px; align-items: center; gap: 9px; min-height: 82px; margin-bottom: 11px; padding: 9px 8px; overflow: hidden; background: #fff5eb; border: 1px solid #efd9c9; border-radius: 18px; }
.level-reward-card.owned { background: #f3f7ec; border-color: #dce5cb; }
.reward-animal-preview { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(78,47,32,.16)); }
.reward-skin-preview { width: 68px; height: 68px; object-fit: contain; filter: drop-shadow(0 5px 6px rgba(47,25,55,.18)); }
.reward-preview-copy { display: grid; min-width: 0; gap: 2px; }
.reward-preview-copy span { color: var(--pink-dark); font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.reward-preview-copy strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reward-preview-copy small { color: var(--muted); font-size: 8px; line-height: 1.45; }
.selected-skin { display: flex; align-items: center; gap: 13px; padding: 10px 11px; background: linear-gradient(105deg, #fff4f0, #fffaf3); border: 1px solid #f0ddd3; border-radius: 18px; margin-bottom: 13px; }
.mini-hole { width: 42px; height: 42px; flex: 0 0 auto; box-shadow: 0 0 0 5px #faece5, 0 0 0 7px #e9bbb0, 0 6px 15px rgba(44,21,58,.16), inset 0 0 9px #8c4ba6; }
.mini-hole span { right: -10px; top: 11px; font-size: 17px; }
.mini-hole span:has(img) { inset: 50% auto auto 50%; width: 66px; height: 66px; transform: translate(-50%, -50%); }
.mini-hole span img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(47,25,55,.18)); }
.selected-skin > div:nth-child(2) { display: grid; flex: 1; }
.selected-skin > div:nth-child(2) span { font-size: 9px; color: var(--muted); }
.selected-skin > div:nth-child(2) strong { font-size: 12px; margin-top: 2px; }
.collection-count { display: flex; align-items: baseline; color: var(--pink-dark); }
.collection-count strong { font-size: 17px; }
.collection-count span { font-size: 9px; color: var(--muted); }
.skin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.skin-collection-item { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; position: relative; border-radius: 14px; border: 1px solid var(--line); background: #fffdf9; overflow: hidden; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.skin-collection-item:hover { transform: translateY(-2px); border-color: #d7aaa2; }
.skin-collection-item:focus-visible { outline: 2px solid #d97e78; outline-offset: 2px; }
.skin-collection-item.wearing { border: 2px solid #de8f89; background: #fff1ed; box-shadow: 0 5px 12px rgba(192,102,95,.1); }
.skin-collection-item .skin-sprite { width: 58px; height: 58px; max-width: 96%; max-height: 96%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(61,39,28,.15)); }
.skin-collection-item .collection-mark { position: absolute; right: 3px; top: 3px; width: 13px; height: 13px; display: grid; place-items: center; border-radius: 50%; background: #84a066; color: white; font-size: 8px; }
.skin-tip { text-align: center; color: var(--muted); font-size: 9px; margin: 11px 0 0; }
.skin-tip b { color: var(--pink-dark); font-weight: 600; }

.art-dialog { width: min(820px, calc(100% - 30px)); padding: 22px; border: 1px solid var(--line); border-radius: 26px; color: var(--ink); background: #fffdf8; box-shadow: 0 30px 80px rgba(50,34,26,.25); }
.art-dialog::backdrop { background: rgba(53,43,37,.48); backdrop-filter: blur(5px); }
.art-dialog > div span { color: var(--pink-dark); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.art-dialog h2 { margin: 4px 0; font: 700 24px/1.2 "STKaiti", "KaiTi", serif; }
.art-dialog p { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.art-dialog img { display: block; width: 100%; border-radius: 16px; border: 1px solid #eee4da; }
.dialog-close { position: absolute; right: 16px; top: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f2e8df; cursor: pointer; font-size: 19px; }

.exchange-dialog { width: min(430px, calc(100% - 30px)); padding: 30px; border: 1px solid var(--line); border-radius: 28px; color: var(--ink); background: #fffdf8; box-shadow: 0 30px 80px rgba(50,34,26,.25); text-align: center; }
.exchange-dialog::backdrop { background: rgba(53,43,37,.48); backdrop-filter: blur(5px); }
.exchange-icon { position: relative; width: 76px; height: 76px; display: grid; place-items: center; margin: 2px auto 18px; border-radius: 50%; background: #fff0e8; border: 1px solid #efd7ca; }
.exchange-icon > span { color: #e97c77; font-size: 34px; }
.exchange-icon > i { position: absolute; right: -2px; bottom: 1px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: #f3bc4f; border: 3px solid #fffdf8; color: #d79220; font-size: 13px; font-style: normal; }
.dialog-eyebrow { color: var(--pink-dark); font-size: 8px; font-weight: 800; letter-spacing: .22em; }
.exchange-dialog h2 { margin: 5px 0 6px; font: 700 27px/1.2 "STKaiti", "KaiTi", serif; }
.exchange-dialog > p { margin: 0; color: var(--muted); font-size: 11px; }
.exchange-rate { margin: 20px 0 14px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.exchange-rate > div { min-height: 84px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; padding: 12px; border-radius: 18px; background: #fff7eb; border: 1px solid #f0dfc9; }
.exchange-rate > div:last-child { background: #fff2ef; border-color: #efd7d3; }
.exchange-rate strong { font-size: 22px; }
.exchange-rate small { flex-basis: 100%; color: var(--muted); font-size: 9px; }
.exchange-rate b { color: #b7a79a; font-size: 9px; font-weight: 500; }
.exchange-heart { color: #e87b76; font-size: 20px; }
.exchange-balance { display: flex; justify-content: space-between; align-items: center; margin: 0 3px 14px; color: var(--muted); font-size: 10px; }
.exchange-balance strong { color: var(--ink); }
.exchange-balance i { color: #e9ad39; font-style: normal; }
.exchange-balance em { font-size: 14px; font-style: normal; }
.exchange-button { width: 100%; }
.exchange-note { display: block; margin-top: 10px; color: var(--muted); font-size: 9px; }
.exchange-note.warning { color: #d06d68; }

@keyframes breathe { 50% { transform: scale(1.045) rotate(2deg); } }
@keyframes orbitBob { to { transform: translateY(7px) rotate(7deg); } }
@keyframes timerPulse { to { transform: scale(1.06); } }

@media (max-width: 1050px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px), (max-width: 950px) and (max-height: 560px), (hover: none) and (pointer: coarse) {
  html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { position: fixed; inset: 0; height: 100dvh; touch-action: none; }
  .app-shell { width: 100%; height: 100%; padding: 0; }
  .topbar, .side-panel, .game-footer { display: none; }
  .game-layout { display: block; width: 100%; height: 100%; }
  .game-card { width: 100%; height: 100%; display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; }
  .objective-bar { flex: 0 0 auto; min-height: 70px; padding: max(8px, env(safe-area-inset-top)) 10px 9px; gap: 8px; }
  .objective-food { width: auto; min-width: 40px; height: 44px; padding: 2px; font-size: 25px; border-radius: 13px; }
  .objective-food span { width: 28px; height: 38px; }
  .objective-food span + span { margin-left: -8px; }
  .objective-food img { width: 35px; height: 35px; }
  .objective-copy { min-width: 0; }
  .objective-copy span { display: block; font-size: 8px; }
  .objective-copy strong { display: -webkit-box; overflow: hidden; font-size: 11px; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .objective-progress { position: absolute; top: auto; bottom: 0; left: 0; right: 0; z-index: 4; margin: 0; }
  .objective-progress > strong { display: none; }
  .objective-progress > div { height: 5px; border-radius: 0; background: rgba(236,225,214,.85); }
  .timer { margin-left: auto; min-width: 76px; padding-left: 8px; }
  .timer span { display: block; font-size: 8px; }
  .timer strong { font-size: 18px; }
  .timer em { display: none; }
  .canvas-wrap { flex: 1 1 auto; width: 100%; min-height: 0; height: auto; aspect-ratio: auto; }
  .game-overlay { z-index: 8; padding: max(16px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom)); }
  .overlay-card { width: min(430px, 96%); }
  .overlay-card > p { max-width: 330px; font-size: 11px; line-height: 1.55; }
  .hero-hole { width: 115px; height: 115px; }
  .hole-core { width: 76px; height: 76px; }
  .overlay-card h1 { font-size: 32px; }
  .mode-actions { display: grid; width: min(320px, 100%); margin-top: 14px; gap: 10px; }
  .mode-actions .secondary-button { width: 100%; height: 44px; font-size: 13px; }
  .mode-actions p { max-width: none; font-size: 11px; line-height: 1.6; }
  .control-hint { display: none !important; }
  body.multiplayer-open .app-shell,
  body.multiplayer-open .game-layout,
  body.multiplayer-open .game-card,
  body.multiplayer-open .canvas-wrap { height: 100%; }
  body.multiplayer-open .game-card { border-radius: 0; }
  body.multiplayer-open .objective-bar,
  body.multiplayer-open .ambient-label,
  body.multiplayer-open .game-footer,
  body.multiplayer-open .mobile-controls,
  body.multiplayer-open .game-overlay { display: none !important; }
  body.multiplayer-open .multiplayer-panel { position: fixed; inset: 0; z-index: 20; display: none; padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); background: rgba(255, 250, 241, .98); }
  body.multiplayer-open .multiplayer-panel.show { display: block !important; }
  body.multiplayer-open .multiplayer-card { width: 100%; max-width: none; min-height: calc(100dvh - max(22px, env(safe-area-inset-top) + env(safe-area-inset-bottom))); margin: 0 auto; padding: 16px 14px 22px; border-radius: 18px; box-shadow: none; }
  body.multiplayer-open .multiplayer-choice-grid,
  body.multiplayer-open .multiplayer-status-strip { grid-template-columns: 1fr; }
  body.multiplayer-open .multiplayer-self-summary { align-items: flex-start; flex-direction: column; }
  body.multiplayer-open .multiplayer-footer,
  body.multiplayer-open .multiplayer-input-row,
  body.multiplayer-open .multiplayer-action-row { flex-direction: column; align-items: stretch; }
  body.multiplayer-open .multiplayer-footer .primary-button,
  body.multiplayer-open .multiplayer-action-row .secondary-button,
  body.multiplayer-open .multiplayer-action-row .primary-button,
  body.multiplayer-open .multiplayer-input-row .primary-button,
  body.multiplayer-open .multiplayer-input-row .secondary-button { width: 100%; }
  body.multiplayer-open .multiplayer-footer { align-items: stretch; }
  body.multiplayer-open .multiplayer-footer p { font-size: 12px; }
  body.multiplayer-open .multiplayer-choice-card { padding: 16px; }

  .mobile-controls { position: absolute; z-index: 6; inset: 0; display: block; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .18s ease, visibility .18s ease; }
  .mobile-controls.active { opacity: 1; visibility: visible; }
  .virtual-joystick { position: fixed; left: var(--joystick-left, 50%); top: var(--joystick-top, 70%); width: 150px; height: 150px; border-radius: 50%; opacity: 0; visibility: hidden; pointer-events: none; touch-action: none; user-select: none; transform: translate(-50%, -50%) scale(.78); transition: opacity .1s ease, visibility .1s ease, transform .12s ease; }
  .virtual-joystick.engaged { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
  .mobile-controls.paused .virtual-joystick { opacity: 0; visibility: hidden; }
  .joystick-ring { position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(55,42,37,.18); box-shadow: inset 0 0 0 7px rgba(255,255,255,.13), 0 8px 26px rgba(50,35,28,.16); backdrop-filter: blur(5px); }
  .joystick-ring::before, .joystick-ring::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgba(255,255,255,.28); transform: translate(-50%, -50%); }
  .joystick-ring::before { width: 1px; height: 72%; }
  .joystick-ring::after { width: 72%; height: 1px; }
  .joystick-thumb { --joystick-x: 0px; --joystick-y: 0px; position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.86); border-radius: 50%; background: linear-gradient(145deg, rgba(255,251,244,.95), rgba(238,196,185,.92)); box-shadow: 0 7px 15px rgba(58,36,36,.26); transform: translate(calc(-50% + var(--joystick-x)), calc(-50% + var(--joystick-y))); transition: transform .06s ease-out, box-shadow .12s ease; will-change: transform; }
  .virtual-joystick.engaged .joystick-thumb { transition: box-shadow .12s ease; box-shadow: 0 4px 10px rgba(58,36,36,.3), 0 0 0 5px rgba(255,255,255,.2); }
  .joystick-thumb i { width: 15px; height: 15px; border-radius: 50%; background: #845d72; box-shadow: inset 0 2px 3px rgba(255,255,255,.35); }
  .joystick-label { position: absolute; left: 50%; bottom: -19px; color: rgba(59,48,43,.72); font-size: 9px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; transform: translateX(-50%); text-shadow: 0 1px 2px rgba(255,255,255,.85); }
  .mobile-game-actions { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: grid; gap: 10px; pointer-events: auto; }
  .mobile-game-actions button { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(255,255,255,.76); color: #594a43; font-size: 17px; font-weight: 800; box-shadow: 0 7px 18px rgba(50,35,28,.16); backdrop-filter: blur(7px); touch-action: manipulation; }
}

@media (max-width: 430px) {
  .objective-bar { gap: 6px; }
  .objective-copy strong { font-size: 10px; }
  .timer { min-width: 70px; }
  .timer strong { font-size: 17px; }
}

@media (max-height: 560px) and (orientation: landscape) and (max-width: 950px) {
  .objective-bar { min-height: 58px; padding-top: max(5px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .objective-food { height: 38px; }
  .objective-food span { height: 32px; }
  .objective-food img { width: 31px; height: 31px; }
  .hero-hole, .overlay-card > p, .mode-actions, .control-hint { display: none; }
  .overlay-card h1 { font-size: 27px; margin-bottom: 15px; }
  .virtual-joystick { width: 128px; height: 128px; }
  .joystick-thumb { width: 48px; height: 48px; }
  .joystick-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
