:root {
  --cream: #fffaf0;
  --cream2: #fff3dc;
  --line: #f1e3c8;
  --ink: #6b4f3a;
  --ink2: #9a7b62;
  --teal: #4fb3a9;
  --pink: #ff8fab;
  --green: #7cc464;
  --yellow: #ffd34d;
  --red: #ff7b6b;
  --shadow: 0 4px 0 rgba(160, 120, 80, 0.18), 0 8px 18px rgba(90, 60, 30, 0.12);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #a6dc7e;
  font-family: 'Gowun Dodum', 'Apple SD Gothic Neo', sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}
#app canvas { display: block; }
.hidden { display: none !important; }
b, h1, h2, h3, .pill, button { font-family: 'Jua', 'Gowun Dodum', sans-serif; font-weight: normal; }

kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 7px; margin: 0 2px;
  border-radius: 7px; background: #fff; border: 2px solid var(--line); border-bottom-width: 4px;
  font-family: 'Jua', sans-serif; font-size: 0.85em; color: var(--ink); text-align: center;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#top-left { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: var(--cream); border: 3px solid var(--line); box-shadow: var(--shadow); font-size: 20px;
}
.pill .ico { font-size: 20px; }
.pill.coin { color: #b07a1f; }
.pill.coin.bump { animation: bump 0.45s ease; }
.pill.small { font-size: 16px; padding: 4px 12px; box-shadow: none; }
.pill.fert { font-size: 15px; color: #4f9e3a; background: #effbe6; border-color: #cfeebd; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(-3deg); } 100% { transform: scale(1); } }

#top-right { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
.round-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  width: 62px; height: 62px; border-radius: 22px; border: 3px solid var(--line); background: var(--cream);
  color: var(--ink); font-size: 13px; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.12s;
}
.round-btn .i { font-size: 22px; line-height: 1.1; }
.round-btn:hover { transform: translateY(-2px) scale(1.04); }
.round-btn:active { transform: translateY(1px) scale(0.97); }
.round-btn.off { opacity: 0.5; }

#minimap {
  position: absolute; top: 88px; right: 14px; width: 180px; height: 180px; border-radius: 50%;
  box-shadow: var(--shadow); background: var(--cream);
}

#barn-panel { position: absolute; top: 72px; left: 14px; display: flex; flex-direction: column; gap: 8px; width: 214px; }
.card {
  background: var(--cream); border: 3px solid var(--line); border-radius: 18px; padding: 8px 12px 9px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.12s, border-color 0.2s;
}
.card:hover { transform: translateX(3px); }
.card.warn { border-color: #ffb3a7; animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-1.4deg); } 96% { transform: rotate(1.4deg); } }
.card-head { display: flex; align-items: center; gap: 6px; font-size: 17px; margin-bottom: 4px; }
.card-head .emoji { font-size: 20px; }
.card-head .count { margin-left: auto; font-family: 'Jua'; font-size: 14px; color: var(--ink2); background: var(--cream2); border-radius: 999px; padding: 1px 8px; }
.bar { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 12px; }
.bar .lbl { width: 26px; color: var(--ink2); }
.track { flex: 1; height: 10px; border-radius: 999px; background: #f1e6d2; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.fill.feed { background: linear-gradient(90deg, #f4d36b, #f2bf3d); }
.fill.clean { background: linear-gradient(90deg, #8ecae6, #5fb2d9); }
.fill.happy { background: linear-gradient(90deg, #ffa8c0, #ff7ea1); }
.fill.low { animation: blink 0.9s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.prod { margin-top: 5px; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.prod .pal { margin-left: auto; font-family: 'Jua'; color: #5a8fc9; }

@keyframes pop-in { from { opacity: 0; transform: translateY(-14px) scale(0.85); } to { opacity: 1; transform: none; } }

#prompt {
  position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: 20px; background: #fff; border: 3px solid var(--line); box-shadow: var(--shadow);
  font-family: 'Jua'; font-size: 18px; pointer-events: none; animation: float 1.6s ease-in-out infinite;
}
#prompt::after {
  content: ''; position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%) rotate(45deg);
  width: 16px; height: 16px; background: #fff; border-right: 3px solid var(--line); border-bottom: 3px solid var(--line);
}
@keyframes float { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }


#vehicle-dock { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.vcard {
  width: 150px; background: var(--cream); border: 3px solid var(--line); border-radius: 20px; padding: 8px 11px;
  box-shadow: var(--shadow); position: relative; transition: transform 0.15s, border-color 0.2s;
}
.vcard::before { content: ''; position: absolute; left: 14px; right: 14px; top: -3px; height: 5px; border-radius: 0 0 6px 6px; background: var(--vc); }
.vcard.driving { border-color: var(--vc); transform: translateY(-6px); }
.vcard.viewing { border-color: #8ecae6; transform: translateY(-4px); }
.v-top { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.v-num { font-family: 'Jua'; font-size: 11px; color: var(--ink2); background: var(--cream2); border-radius: 6px; padding: 0 5px; }
.v-ico { font-size: 20px; }
.v-status { font-size: 12px; color: var(--ink2); height: 32px; margin: 3px 0 4px; line-height: 1.3; overflow: hidden; }
.v-actions { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.v-assign { width: 100%; margin: 2px 0 4px; font: inherit; font-size: 11.5px; border: 2px solid var(--line); border-radius: 9px; background: #fff; padding: 1px 4px; color: #6b4f3a; cursor: pointer; }
.v-assign.on { border-color: var(--vc); background: #fff8ea; font-weight: 700; }
.v-actions .eye { margin-left: auto; border: 2px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; font-size: 14px; padding: 2px 8px; }
.v-actions .eye:hover { background: var(--cream2); }
.switch { position: relative; width: 40px; height: 22px; display: inline-block; cursor: pointer; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #e3d6bf; border-radius: 999px; transition: 0.2s; }
.switch span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }


#dpad { position: absolute; left: 20px; bottom: 150px; width: 150px; height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
#dpad button, #action-btns button {
  border: 3px solid var(--line); background: rgba(255, 250, 240, 0.9); border-radius: 16px; font-family: 'Jua'; color: var(--ink);
  font-size: 18px; box-shadow: var(--shadow); touch-action: none;
}
#dpad button.down, #action-btns button.down { transform: scale(0.92); background: var(--cream2); }
#pad-up { grid-column: 2; grid-row: 1; }
#pad-left { grid-column: 1; grid-row: 2; }
#pad-right { grid-column: 3; grid-row: 2; }
#pad-down { grid-column: 2; grid-row: 3; }
#action-btns { position: absolute; right: 20px; bottom: 150px; display: flex; flex-direction: column; gap: 10px; }
#action-btns button { width: 110px; height: 56px; font-size: 15px; }

/* ---------- 월드 라벨 ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.wlabel { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.barn-label {
  display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 250, 240, 0.94);
  border: 3px solid var(--line); box-shadow: var(--shadow); font-size: 14px;
}
.barn-label .alert { background: #ffe1dc; color: #d4574a; border-radius: 999px; padding: 1px 8px; font-size: 12px; animation: blink 1s steps(2) infinite; }
.barn-label .ok { background: #dff0ff; color: #3f7fbf; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.zone-label { padding: 3px 10px; border-radius: 10px; background: rgba(255, 250, 240, 0.85); border: 2px solid var(--line); font-family: 'Jua'; font-size: 13px; }
.zone-label.small { font-size: 11px; padding: 2px 8px; opacity: 0.9; }
.zone-label:empty { display: none; }
.veh-label { padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.82); font-size: 12px; border: 2px solid rgba(241, 227, 200, 0.9); }
.veh-label span { color: var(--ink2); }
.veh-label:empty { display: none; }
.float { position: absolute; left: 0; top: 0; font-family: 'Jua'; font-size: 20px; color: #fff; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(107, 79, 58, 0.55), 0 0 6px rgba(107, 79, 58, 0.4); }
.float.coin { color: #ffd34d; font-size: 24px; }
.float.good { color: #b9f29e; }

/* ---------- 모달 ---------- */
.modal { position: fixed; inset: 0; background: rgba(80, 60, 40, 0.28); display: flex; align-items: center; justify-content: center; z-index: 20; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(620px, 92vw); max-height: 84vh; overflow: auto; background: var(--cream); border: 4px solid var(--line); border-radius: 28px;
  padding: 18px 22px 22px; box-shadow: 0 8px 0 rgba(160, 120, 80, 0.2), 0 20px 50px rgba(60, 40, 20, 0.25); animation: pop-in 0.3s cubic-bezier(.34,1.56,.64,1);
}
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 0; font-size: 24px; flex: 1; }
.close { border: 3px solid var(--line); background: #fff; border-radius: 12px; width: 38px; height: 38px; font-size: 16px; cursor: pointer; color: var(--ink); }
#shop-list { display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: #fff; border: 3px solid var(--line); border-radius: 18px; }
.shop-item.maxed { opacity: 0.6; }
.crop-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.crop-btn { flex: 1 1 110px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 9px; border: 2px solid var(--line); border-radius: 12px; background: #fffaf0; cursor: pointer; font: inherit; color: #6b4f3a; text-align: left; }
.crop-btn b { font-size: 14px; }
.crop-btn small { font-size: 11.5px; color: var(--ink2); }
.crop-btn.on { border-color: #7fc464; background: #eefbe4; }
.crop-btn:disabled:not(.on) { opacity: 0.55; cursor: default; }
.crop-btn:hover:not(:disabled) { transform: translateY(-1px); background: #fff3d6; }
.s-ico { font-size: 30px; width: 44px; text-align: center; }
.s-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.s-txt b { font-size: 17px; }
.s-txt small { color: var(--ink2); font-size: 12.5px; }
.buy {
  border: none; border-radius: 14px; padding: 9px 14px; min-width: 100px; background: var(--yellow); color: #7a5418; font-size: 15px; cursor: pointer;
  box-shadow: 0 4px 0 #e0aa2a; transition: transform 0.1s;
}
.buy:hover:not(:disabled) { transform: translateY(-2px); }
.buy:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #e0aa2a; }
.buy:disabled { background: #eee3cf; color: #b3a089; box-shadow: 0 4px 0 #ddcfb6; cursor: default; }
.help section { background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 10px 16px; margin-bottom: 10px; }
.help h3 { margin: 4px 0 8px; font-size: 18px; }
.help ul, .help ol { margin: 0; padding-left: 20px; line-height: 1.9; font-size: 14px; }
.help p { margin: 4px 0; font-size: 14px; line-height: 1.6; }
.help em { font-style: normal; background: #fff3c4; border-radius: 6px; padding: 0 4px; }
.help .keys { list-style: none; padding-left: 0; }

/* ---------- 타이틀 ---------- */
#title {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30;
  background: radial-gradient(ellipse at center, rgba(255, 250, 240, 0.1), rgba(120, 180, 90, 0.25));
  transition: opacity 0.6s, transform 0.6s;
}
#title.out { opacity: 0; transform: scale(1.08); pointer-events: none; }
.title-card {
  text-align: center; background: rgba(255, 250, 240, 0.94); border: 5px solid var(--line); border-radius: 36px; padding: 28px 48px 24px;
  box-shadow: 0 10px 0 rgba(160, 120, 80, 0.2), 0 30px 60px rgba(60, 40, 20, 0.25); animation: pop-in 0.6s cubic-bezier(.34,1.56,.64,1);
}
.title-emoji { font-size: 40px; letter-spacing: 6px; animation: float2 2s ease-in-out infinite; }
@keyframes float2 { 50% { transform: translateY(-6px); } }
.title-card h1 { font-size: 56px; margin: 6px 0 0; color: #ff7ea1; text-shadow: 0 4px 0 #ffd6e0; letter-spacing: 2px; }
.title-card .sub { margin: 6px 0 20px; color: var(--ink2); font-size: 16px; }
.title-btns { display: flex; gap: 10px; justify-content: center; }
.big {
  border: none; border-radius: 20px; padding: 14px 34px; font-size: 22px; background: var(--green); color: #fff; cursor: pointer;
  box-shadow: 0 6px 0 #5aa645; transition: transform 0.1s;
}
.big:hover { transform: translateY(-2px); }
.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #5aa645; }
.big.ghost { background: #fff; color: var(--ink2); box-shadow: 0 6px 0 var(--line); border: 3px solid var(--line); }
.tip { margin: 18px 0 0; font-size: 13px; color: var(--ink2); }

@media (max-width: 1100px) {
  .vcard { width: 150px; }
  #barn-panel { width: 190px; }
  #minimap { width: 130px; height: 130px; }
}
@media (max-width: 820px) {
  #barn-panel { display: none; }
  #vehicle-dock { gap: 6px; }
  .vcard { width: 110px; padding: 6px 8px; }
  .v-status { display: none; }
}

/* ---------- 조작 방식 / 운전 패널 ---------- */
.pill.mode { font-size: 15px; cursor: pointer; color: var(--ink); pointer-events: auto; }
.pill.mode:hover { transform: translateY(-1px); }
#top-left { pointer-events: auto; }

#drive-panel {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); width: min(860px, 94vw);
  background: rgba(255, 250, 240, 0.96); border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 10px 16px 10px; pointer-events: none;
}
.dp-head { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.dp-ico { font-size: 24px; }
.dp-mode { font-family: 'Jua'; font-size: 12px; background: var(--cream2); padding: 2px 9px; border-radius: 999px; color: var(--ink2); }
.dp-speed { margin-left: auto; font-family: 'Jua'; color: var(--ink2); font-size: 14px; }
.dp-speed b { font-size: 24px; color: var(--ink); }
.dp-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 14px; margin: 6px 0 4px; }
.gauge { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.gauge .g-lbl { width: 64px; color: var(--ink2); white-space: nowrap; }
.gauge .g-val { width: 44px; text-align: right; font-family: 'Jua'; font-size: 13px; }
.gauge .track { height: 11px; }
.gauge .fill { background: linear-gradient(90deg, #8ecae6, #5fb2d9); transition: width 0.1s linear; }
.gauge.boost .fill { background: linear-gradient(90deg, #ffd34d, #ff9a3c); }
.gauge.boost.on .fill { background: linear-gradient(90deg, #ff9a3c, #ff5a5f); animation: blink 0.25s steps(2) infinite; }
.gauge.tilt .fill { background: linear-gradient(90deg, #c9a7ff, #a07de8); }
.dp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.chip { font-family: 'Jua'; font-size: 12.5px; background: #f1e6d2; border-radius: 999px; padding: 2px 10px; }
.chip.on { background: #dff5d2; color: #3f8a2c; }
.chip.warn { background: #ffe1dc; color: #d4574a; animation: blink 0.8s steps(2) infinite; }
.dp-tip { font-size: 13px; background: #fff3c4; border-radius: 10px; padding: 4px 10px; margin: 4px 0; }
.dp-keys { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink2); margin-top: 4px; }
.dp-keys kbd { font-size: 0.8em; padding: 0 5px; }

#crosshair { position: fixed; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 2px rgba(107, 79, 58, 0.45); pointer-events: none; z-index: 5; }
#touch-hyd { display: flex; gap: 6px; }
#touch-hyd button { width: 52px !important; }

/* ---------- 설정 ---------- */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; border-radius: 18px; cursor: pointer;
  border: 3px solid var(--line); background: var(--cream); color: var(--ink); font-family: 'Gowun Dodum'; transition: transform 0.12s;
}
.mode-card b { font-size: 18px; }
.mode-card small { font-size: 12px; color: var(--ink2); line-height: 1.6; text-align: center; }
.mode-card .mc-ico { font-size: 30px; }
.mode-card:hover { transform: translateY(-2px); }
.mode-card.on { border-color: var(--green); background: #effbe6; box-shadow: 0 4px 0 #cfeebd; }
.help .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; border-bottom: 1px dashed var(--line); }
.help .row:last-child { border-bottom: none; }
.seg { display: inline-flex; background: var(--cream2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; border-radius: 9px; padding: 5px 12px; font-family: 'Jua'; color: var(--ink2); cursor: pointer; font-size: 14px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 0 var(--line); }
.switch.big { width: 46px; height: 26px; flex: 0 0 46px; }
.switch.big span::after { width: 20px; height: 20px; }
.switch.big input:checked + span::after { transform: translateX(20px); }
.slider { width: 180px; accent-color: #7cc464; }
.danger { border: none; border-radius: 12px; padding: 7px 14px; background: #ffe1dc; color: #d4574a; font-family: 'Jua'; cursor: pointer; font-size: 14px; }

.mode-pick { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.mode-pick button {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 8px 16px; cursor: pointer; color: var(--ink); font-family: 'Gowun Dodum';
}
.mode-pick button span { grid-row: span 2; font-size: 24px; }
.mode-pick button b { font-size: 16px; }
.mode-pick button small { font-size: 11.5px; color: var(--ink2); }
.mode-pick button.on { border-color: var(--green); background: #effbe6; }
.shedrow { margin-top: 3px; font-size: 12px; color: #8a6a4f; }
.shed-label { display: flex; gap: 6px; align-items: center; }
.shed-label .raw { background: #f3e2c8; border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.shed-label .cmp { background: #e8dccf; border-radius: 999px; padding: 0 7px; font-size: 11.5px; color: #5a4130; }
.shed-label .steam { animation: float2 1.2s ease-in-out infinite; }

/* ---------- 배합기 / 사료 가게 ---------- */
.dp-mix { margin: 6px 0 2px; }
.mix-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mix-btns button {
  pointer-events: auto; border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 5px 12px; font-family: 'Jua';
  color: var(--ink); cursor: pointer; font-size: 14px; box-shadow: 0 3px 0 var(--line);
}
.mix-btns button small { color: var(--ink2); font-size: 11px; margin-left: 4px; }
.mix-btns button:hover:not(:disabled) { transform: translateY(-1px); background: #f6fff2; }
.mix-btns button:disabled { opacity: 0.45; cursor: default; }
.mix-btns kbd { font-size: 0.75em; }
.recipes { margin-top: 6px; font-size: 12.5px; color: var(--ink2); display: flex; gap: 12px; flex-wrap: wrap; }
.gauge.mix .fill { background: linear-gradient(90deg, #8fdcc8, #5fc4ae); }
.gauge.feedleft .fill { background: linear-gradient(90deg, #f4d36b, #e0b040); }
.store-info { margin: 0 0 10px; font-size: 14px; }
.recipes-box { margin-top: 12px; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 8px 16px; font-size: 14px; line-height: 1.8; }
.recipes-box h3 { margin: 4px 0; }
.card.boost { border-color: #b9f29e; }
.boost-tag { font-size: 10.5px; background: #effbe6; color: #3f8a2c; border-radius: 999px; padding: 0 6px; }
.vcard { width: 136px; }
.card-head b { white-space: nowrap; }
.card-head .count { white-space: nowrap; }
.vcard { width: 140px; padding: 7px 9px; }
.v-top { font-size: 14px; gap: 4px; min-width: 0; }
.v-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-ico { font-size: 17px; }
.v-actions .sw-lbl { white-space: nowrap; font-size: 12px; }
#vehicle-dock { gap: 7px; }

/* ---------- 배치 변경 / 집 HUD ---------- */
.mob-only { display: none !important; }
#build-hud {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px;
  background: var(--cream); border: 3px solid var(--line); border-radius: 22px; padding: 10px 14px 10px 20px; box-shadow: var(--shadow);
}
#build-hud > div { display: flex; flex-direction: column; gap: 2px; }
#build-hud b { font-size: 17px; }
#build-hud small { color: var(--ink2); font-size: 13px; }
#build-done { border: none; border-radius: 14px; padding: 10px 18px; background: var(--green); color: #fff; font-family: 'Jua'; font-size: 16px; cursor: pointer; box-shadow: 0 4px 0 #5aa645; }
body.mode-build #barn-panel, body.mode-build #vehicle-dock, body.mode-build #prompt, body.mode-build #touch,
body.mode-house #barn-panel, body.mode-house #vehicle-dock, body.mode-house #minimap, body.mode-house #drive-panel { display: none !important; }
#house-hud {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); width: min(860px, 94vw);
  background: rgba(255, 250, 240, 0.96); border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 10px 14px;
}
.hh-top { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.hh-top b { margin-right: auto; }
.hh-btn { border: 3px solid var(--line); background: #fff; border-radius: 12px; padding: 5px 12px; font-family: 'Jua'; color: var(--ink); cursor: pointer; font-size: 14px; }
.hh-btn.on { background: #effbe6; border-color: #b9f29e; }
.hh-tip { font-size: 13px; color: var(--ink2); margin-top: 6px; }
.hh-decor { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.hh-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.hh-row > span { font-family: 'Jua'; color: var(--ink2); margin-right: 2px; }
.hh-item { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 3px 9px; font-size: 13px; cursor: pointer; font-family: 'Gowun Dodum'; }
.sw { width: 24px; height: 24px; border-radius: 8px; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.sw.on { box-shadow: 0 0 0 3px var(--green); }
#shop-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
#shop-tabs button { border: 3px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 12px; font-family: 'Jua'; color: var(--ink2); cursor: pointer; font-size: 14px; }
#shop-tabs button.on { background: var(--yellow); color: #7a5418; border-color: #f2c94c; }
.ledger-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.ledger-top div { background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 6px 10px; display: flex; flex-direction: column; }
.ledger-top small { color: var(--ink2); font-size: 11.5px; }
.ledger-top b { font-size: 16px; }
.ledger table, .news table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; font-size: 13.5px; }
.ledger th, .ledger td, .news td { padding: 6px 8px; border-bottom: 1px dashed var(--line); text-align: center; }
.ledger th { font-family: 'Jua'; font-weight: normal; background: var(--cream2); }
.news .headline { font-family: 'Jua'; font-size: 18px; }
.news .up { color: #d4574a; font-family: 'Jua'; } .news .down { color: #3f7fbf; font-family: 'Jua'; }
.news .tip { font-size: 13px; color: var(--ink2); }
#piano { position: fixed; inset: auto 0 18px 0; display: flex; justify-content: center; z-index: 25; pointer-events: none; }
.piano-card { pointer-events: auto; background: var(--cream); border: 4px solid var(--line); border-radius: 24px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.piano-card small { color: var(--ink2); font-size: 12px; }
.piano-card .keys { display: flex; gap: 4px; }
.piano-card .keys button { width: 52px; height: 120px; border: 3px solid var(--line); border-radius: 0 0 12px 12px; background: #fff; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; padding-bottom: 8px; font-family: 'Jua'; color: var(--ink); cursor: pointer; touch-action: none; }
.piano-card .keys button.down { background: #ffe1ea; transform: translateY(3px); }
.close-piano { border: none; background: var(--pink); color: #fff; border-radius: 12px; padding: 6px 14px; font-family: 'Jua'; cursor: pointer; }
/* 🧑‍🌾 손 도구 바 (걸어 다닐 때) */
#toolbar { position: absolute; right: 14px; bottom: 168px; display: flex; flex-direction: row; gap: 6px; align-items: center; z-index: 2; }
#toolbar .tb-info { order: -1; }
#toolbar button { width: 58px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border: 3px solid var(--line); border-radius: 16px; background: rgba(255, 250, 240, 0.94); box-shadow: var(--shadow); font-size: 21px; cursor: pointer; font-family: 'Jua'; color: var(--ink); touch-action: none; }
#toolbar button small { font-size: 11px; line-height: 1; }
#toolbar button.on { border-color: #7fc464; background: #eefbe4; transform: translateY(-4px); }
#toolbar .tb-info { font-family: 'Jua'; font-size: 13px; background: rgba(255, 250, 240, 0.94); border: 2px solid var(--line); border-radius: 12px; padding: 3px 8px; white-space: nowrap; }
#toolbar .tb-info:empty { display: none; }
body.mobile #toolbar { right: auto; left: 12px; bottom: 172px; flex-direction: row; align-items: center; }
body.mobile #toolbar button { width: 48px; height: 44px; font-size: 18px; border-width: 2px; }
body.mobile.show-dock #toolbar { display: none; }

#fade { position: fixed; inset: 0; background: #1d2547; color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Jua'; font-size: 28px; opacity: 0; pointer-events: none; transition: opacity 0.6s; z-index: 40; }
#fade.on { opacity: 1; }

/* ---------- 모바일 ---------- */
#touch { display: none; }
body.mobile #touch { display: block; }
#joy { position: absolute; left: 22px; bottom: 26px; width: 132px; height: 132px; border-radius: 50%; background: rgba(255, 250, 240, 0.55); border: 3px solid rgba(241, 227, 200, 0.95); touch-action: none; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: var(--cream); border: 3px solid var(--line); box-shadow: var(--shadow); pointer-events: none; }
#action-btns { position: absolute; right: 16px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
#action-btns .row { display: flex; gap: 8px; }
#action-btns button { border: 3px solid var(--line); background: rgba(255, 250, 240, 0.92); border-radius: 18px; font-family: 'Jua'; color: var(--ink); box-shadow: var(--shadow); touch-action: none; }
#btn-space, #btn-e { width: 78px; height: 64px; font-size: 14px; }
#btn-e { background: #effbe6 !important; }
#action-btns button.small { width: 52px; height: 44px; font-size: 18px; }
#touch-hyd { display: grid !important; grid-template-columns: repeat(4, 46px); gap: 6px; }
#touch-hyd.hidden { display: none !important; }
#touch-hyd button { height: 44px; font-size: 13px; }
#action-btns button.down { transform: scale(0.92); background: var(--cream2) !important; }

body.mobile .mob-only { display: flex !important; }
body.mobile #top-left { top: 8px; left: 8px; gap: 5px; }
body.mobile .pill { font-size: 14px; padding: 5px 10px; border-width: 2px; gap: 5px; }
body.mobile .pill .ico { font-size: 15px; }
body.mobile #top-right { top: 8px; right: 8px; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 60vw; }
body.mobile .round-btn { width: 46px; height: 46px; border-radius: 15px; font-size: 10px; border-width: 2px; }
body.mobile .round-btn .i { font-size: 17px; }
body.mobile #minimap { width: 104px; height: 104px; top: auto; bottom: 178px; right: 10px; }
body.mobile #barn-panel { display: none; top: 62px; left: 8px; width: 200px; max-height: 60vh; overflow: auto; z-index: 3; }
body.mobile.show-panel #barn-panel { display: flex; }
body.mobile #vehicle-dock { display: none; position: absolute; left: 8px; right: 8px; bottom: 170px; transform: none; overflow-x: auto; justify-content: flex-start; padding: 6px 2px; z-index: 3; }
body.mobile.show-dock #vehicle-dock { display: flex; }
body.mobile .vcard { flex: 0 0 132px; }
body.mobile .v-status { display: block; height: 28px; font-size: 11px; }
body.mobile #prompt { bottom: 178px; font-size: 15px; }
body.mobile #drive-panel { bottom: auto; top: 60px; width: min(560px, 96vw); padding: 6px 10px; border-width: 2px; }
body.mobile .dp-keys { display: none; }
body.mobile .dp-tip { font-size: 12px; }
body.mobile .dp-head { font-size: 15px; }
body.mobile .dp-gauges { grid-template-columns: repeat(2, 1fr); gap: 2px 10px; }
body.mobile .gauge .g-lbl { width: 54px; font-size: 11px; }
body.mobile .mix-btns button { font-size: 12px; padding: 4px 8px; }
body.mobile #build-hud { bottom: 12px; width: 94vw; gap: 8px; padding: 8px 10px; }
body.mobile #build-hud b { font-size: 14px; }
body.mobile #house-hud { bottom: auto; top: 60px; }
body.mobile .wlabel.zone-label.small, body.mobile .veh-label { display: none !important; }
body.mobile .barn-label { font-size: 11px; padding: 3px 8px; }
body.mobile .zone-label { font-size: 11px; }
body.mobile .sheet { width: 96vw; max-height: 86vh; padding: 12px 12px 16px; border-radius: 22px; }
body.mobile .shop-item { gap: 8px; padding: 7px 8px; }
body.mobile .s-ico { font-size: 24px; width: 32px; }
body.mobile .buy { min-width: 76px; padding: 8px 8px; font-size: 13px; }
body.mobile .ledger-top { grid-template-columns: repeat(2, 1fr); }
body.mobile .piano-card .keys button { width: 38px; height: 96px; }
body.mobile .mode-cards { grid-template-columns: 1fr; }
@media (max-width: 640px) {
  .title-card { padding: 20px 18px; width: 92vw; border-radius: 26px; }
  .title-card h1 { font-size: 38px; }
  .mode-pick { flex-direction: column; }
  .big { padding: 12px 24px; font-size: 19px; }
  .tip { display: none; }
}
@media (max-height: 500px) {
  body.mobile #joy { width: 110px; height: 110px; bottom: 12px; }
  body.mobile #minimap { bottom: 130px; width: 84px; height: 84px; }
  body.mobile #drive-panel { top: 52px; }
  body.mobile #prompt { bottom: 130px; }
}
/* 모바일 상단 정리: 왼쪽 정보는 세로, 오른쪽 버튼은 4칸 격자 */
body.mobile #top-left { flex-direction: column; align-items: flex-start; }
body.mobile #top-right { display: grid; grid-template-columns: repeat(4, 42px); gap: 5px; max-width: none; }
body.mobile .round-btn { width: 42px; height: 42px; border-radius: 13px; }
body.mobile .round-btn span:not(.i) { display: none; }
body.mobile .round-btn .i { font-size: 19px; }
body.mobile #drive-panel { top: 104px; }
body.mobile #house-hud { top: 104px; }
body.mobile .pill.mode { font-size: 12px; padding: 3px 9px; }
body.mobile.show-panel #barn-panel { top: 104px; }

/* ---------- 멀티플레이 ---------- */
.multi { margin: 10px auto 0; max-width: 420px; background: rgba(255, 255, 255, 0.75); border: 3px solid var(--line); border-radius: 18px; padding: 8px 14px; text-align: left; }
.multi summary { cursor: pointer; font-family: 'Jua'; font-size: 17px; color: var(--ink); list-style: none; text-align: center; }
.multi summary::-webkit-details-marker { display: none; }
.multi-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.multi-body label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink2); }
.multi-body input { flex: 1; min-width: 0; border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 15px; background: #fff; text-transform: none; }
#mp-room { text-transform: uppercase; }
.multi-btns { display: flex; gap: 8px; }
.multi-btns .big { flex: 1; font-size: 16px; padding: 8px 10px; }
.multi-msg { margin: 0; font-size: 12.5px; color: var(--ink2); line-height: 1.4; }
.multi-msg.err { color: #d9534f; }
.pill.net { font-size: 13px; gap: 6px; max-width: 46vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pill.net span { color: var(--ink2); font-size: 12px; }

/* 차량이 많아져도 카드가 화면 밖으로 잘리지 않게: 좁아지면 카드가 줄어들고, 그래도 넘치면 가로 스크롤 */
body:not(.mobile) #vehicle-dock { max-width: calc(100vw - 24px); overflow-x: auto; overflow-y: visible; padding: 9px 4px 4px; scrollbar-width: thin; }
body:not(.mobile) .vcard { flex: 0 1 140px; min-width: 112px; }

/* ---------- 마을 광장 ---------- */
body.mode-plaza #hud > *:not(#touch) { display: none !important; }
body.mode-plaza #labels { display: none; }
body.mode-plaza #btn-e, body.mode-plaza #touch-hyd, body.mode-plaza #btn-v, body.mode-plaza #btn-boost { display: none !important; }
#plaza-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
body:not(.mode-plaza) #plaza-layer { display: none; }
.p-tag { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; font-family: 'Jua'; font-size: 13px; color: var(--ink);
  background: rgba(255, 250, 240, 0.92); border: 2px solid var(--line); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.p-tag.me { cursor: default; background: #ffe9f0; }
.p-tag:not(.me):hover { background: #fff; }
.p-bubble { position: absolute; left: 0; top: 0; max-width: 220px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 5px 10px;
  font-size: 13.5px; color: var(--ink); line-height: 1.35; box-shadow: var(--shadow); word-break: break-word; }
.p-bubble.big { font-size: 30px; padding: 2px 8px; border: none; background: transparent; box-shadow: none; }
.p-bubble.hidden { display: none !important; }
#plaza-hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#plaza-hud.hidden { display: none; }
#plaza-hud > * { pointer-events: auto; }
.p-top { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none !important; }
.p-top > * { pointer-events: auto; }
.p-top .pill span { color: var(--ink2); font-size: 14px; }
.p-btn { cursor: pointer; font-family: 'Jua'; font-size: 15px; color: var(--ink); }
.p-btn:hover { background: #fff; }
.mob-only-p { display: none; }
.p-side { position: absolute; top: 14px; right: 14px; width: 250px; max-height: calc(100vh - 250px); overflow-y: auto; background: rgba(255, 250, 240, 0.94);
  border: 3px solid var(--line); border-radius: 18px; padding: 8px 12px; box-shadow: var(--shadow); }
.p-side h4 { margin: 6px 0; font-family: 'Jua'; font-weight: normal; font-size: 15px; color: var(--ink); }
.p-side h4 small { font-size: 11px; color: var(--ink2); }
.p-person, .p-farm { display: flex; align-items: center; gap: 4px; padding: 4px 0; border-bottom: 1px dashed rgba(107, 79, 58, 0.2); font-size: 13.5px; }
.p-person span, .p-farm span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.p-farm small { color: var(--ink2); }
.p-person button, .p-farm button { border: 2px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; font-size: 13px; padding: 2px 7px; font-family: inherit; }
.p-person button:hover, .p-farm button:hover { background: #ffe9f0; }
.p-farm button:disabled { opacity: 0.5; cursor: default; }
.p-empty { font-size: 12.5px; color: var(--ink2); padding: 4px 0 8px; }
.p-chat { position: absolute; left: 14px; bottom: 14px; width: min(380px, calc(100vw - 28px)); }
#p-log { max-height: 150px; overflow-y: auto; font-size: 13px; color: var(--ink); background: rgba(255, 250, 240, 0.8); border-radius: 12px; padding: 4px 8px; margin-bottom: 6px; }
#p-log:empty { display: none; }
.p-line { padding: 1px 0; }
.p-line.sys { color: var(--ink2); font-size: 12px; }
.p-input { display: flex; gap: 6px; }
.p-input input { flex: 1; min-width: 0; border: 3px solid var(--line); border-radius: 14px; padding: 7px 12px; font: inherit; font-size: 15px; background: #fff; }
.p-input button, #p-emotes button { border: 3px solid var(--line); background: #fff; border-radius: 14px; cursor: pointer; font-size: 17px; padding: 3px 10px; }
#p-emotes { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
#p-emotes button { font-size: 18px; padding: 2px 6px; border-width: 2px; }
#p-emotes button:hover, .p-input button:hover { background: #ffe9f0; }
#p-pop { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--cream); border: 3px solid var(--line); border-radius: 18px;
  padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); min-width: 220px; text-align: center; font-family: 'Jua'; }
#p-pop.hidden { display: none; }
#p-pop button { border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: 7px 10px; cursor: pointer; font-family: 'Jua'; font-size: 15px; }
#p-pop button:hover { background: #ffe9f0; }
#p-invites { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 28px)); pointer-events: none !important; }
.p-invite { pointer-events: auto; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; background: #fff; border: 3px solid var(--line); border-radius: 18px;
  padding: 10px 14px; box-shadow: var(--shadow); animation: p-pop-in 0.3s ease-out; }
.p-inv-ico { font-size: 30px; grid-row: span 2; }
.p-inv-txt { font-size: 14.5px; color: var(--ink); }
.p-inv-btns { display: flex; gap: 6px; }
.p-inv-btns button { flex: 1; border: 3px solid var(--line); border-radius: 12px; padding: 5px 8px; cursor: pointer; font-family: 'Jua'; font-size: 14px; background: #fff; }
.p-inv-btns .yes { background: #ffd6e2; }
@keyframes p-pop-in { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.plaza-go { width: 100%; background: linear-gradient(180deg, #9fe0a0, #6fc47a) !important; }
.multi-or { text-align: center; font-size: 12px; color: var(--ink2); margin-top: 2px; }
.pill.net-btn { cursor: pointer; font-family: 'Jua'; font-size: 14px; color: var(--ink); }
.pill.net-btn:hover { background: #fff; }
.pill.net-btn.on { background: #d9f7d0; }
body.mobile .p-side { display: none; top: 64px; left: 8px; right: 8px; width: auto; max-height: 50vh; }
body.mobile #plaza-hud.side-open .p-side { display: block; }
body.mobile .mob-only-p { display: inline-flex; }
body.mobile .p-chat { bottom: 180px; width: calc(100vw - 180px); }
body.mobile #p-log { max-height: 90px; }

/* ---------- 🔔 알림: 화면 가운데 팝업 대신 왼쪽 위 한 줄 + 기록함 ---------- */
/* 오른쪽 미니맵 아래에 작게: 글자는 왼쪽으로 늘어나고 🔔은 오른쪽 끝에 고정 */
.pill.notice { position: absolute; top: 280px; right: 14px; flex-direction: row-reverse; font-size: 14px; padding: 6px 12px; gap: 6px; cursor: pointer; color: var(--ink); pointer-events: auto;
  background: rgba(255, 250, 240, 0.82); max-width: min(460px, 46vw); font-family: inherit; transition: background 0.2s; }
.pill.notice .n-bell { font-size: 16px; opacity: 0.7; }
.pill.notice .n-count { display: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff8a8a; color: #fff;
  font-family: 'Jua'; font-size: 11px; line-height: 18px; text-align: center; }
.pill.notice.has-unread .n-count { display: inline-block; }
.pill.notice.has-unread .n-bell { opacity: 1; }
.pill.notice .n-text { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.pill.notice.show .n-text { display: inline; animation: note-in 0.25s ease-out; }
.pill.notice.show { background: var(--cream); }
.pill.notice.ping .n-bell { animation: bell-ping 0.6s ease; }
@keyframes note-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bell-ping { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-18deg); } 60% { transform: rotate(14deg); } }
#notice-log { position: fixed; z-index: 6; width: min(380px, calc(100vw - 16px)); max-height: min(420px, 60vh); overflow-y: auto;
  background: var(--cream); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 8px 10px; pointer-events: auto; }
#notice-log.hidden { display: none; }
.nl-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 6px; border-bottom: 2px dashed var(--line); margin-bottom: 4px; }
.nl-head b { font-family: 'Jua'; font-size: 15px; }
.nl-head small, .nl-row small { color: var(--ink2); font-size: 11px; }
.nl-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: start; padding: 5px 4px; font-size: 13px; line-height: 1.35; border-bottom: 1px solid rgba(241, 227, 200, 0.6); }
.nl-row:last-child { border-bottom: none; }
.nl-row small { white-space: nowrap; padding-top: 1px; }
.nl-empty { padding: 14px 4px; text-align: center; color: var(--ink2); font-size: 13px; }
.set-note { margin: 4px 0 0; font-size: 12.5px; color: var(--ink2); }
body.mobile .pill.notice { top: 106px; right: 8px; font-size: 12px; padding: 4px 9px; max-width: 46vw; }
body.mobile .pill.notice .n-bell { font-size: 14px; }
body.mobile .pill.notice .n-text { white-space: normal; display: none; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
body.mobile .pill.notice.show .n-text { display: -webkit-box; }

/* 모바일: 말풍선 안내를 눌러도 행동(타기·들어가기)이 되게, 할 일 없을 땐 행동 버튼을 흐리게 */
body.mobile #prompt { pointer-events: auto; cursor: pointer; }
#action-btns button.idle { opacity: 0.55; }
#btn-e { min-width: 104px; padding: 0 6px; white-space: nowrap; font-size: 13.5px; }
.pill.notice { z-index: 5; }

/* ---------- 모바일 화면 정리 v2: 알림은 작게, 패널은 얇게, 서로 안 겹치게 ---------- */
#touch-hyd button.hidden { display: none !important; }
body.mobile #top-left { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: calc(100vw - 205px); gap: 5px; }
body.mobile #top-left .pill.coin { order: 1; }
body.mobile #top-left .pill.mode { order: 2; }
body.mobile #btn-open-farm { order: 3; }
body.mobile #btn-to-plaza { order: 4; }
body.mobile #top-left .pill.clock { order: 5; }
body.mobile #fert { order: 6; }
body.mobile #net-pill { order: 7; }
body.mobile .pill { font-size: 13px; padding: 4px 9px; }
body.mobile .pill .lbl { display: none; }
body.mobile .pill[data-armed] .lbl { display: inline; font-size: 11px; }
body.mobile .pill.mode, body.mobile .pill.net-btn { font-size: 15px; padding: 2px 7px; }
body.mobile .pill.net { max-width: 44vw; font-size: 11px; padding: 3px 8px; }
body.mobile .pill.fert { font-size: 11px; padding: 3px 8px; }
body.mobile #minimap { top: 104px; bottom: auto; right: 8px; width: 88px; height: 88px; }

body.mobile #prompt { bottom: 200px; font-size: 13px; padding: 6px 12px; border-width: 2px; }
body.mobile .float { font-size: 14px; }
body.mobile .float.coin { font-size: 17px; }

body.mobile #drive-panel { top: 104px; bottom: auto; left: 8px; right: 104px; width: auto; transform: none;
  padding: 5px 9px 6px; border-width: 2px; border-radius: 16px; background: rgba(255, 250, 240, 0.9); }
body.mobile .dp-head { font-size: 13px; gap: 5px; }
body.mobile .dp-ico { font-size: 16px; }
body.mobile .dp-mode { display: none; }
body.mobile .dp-speed { font-size: 10px; }
body.mobile .dp-speed b { font-size: 16px; }
body.mobile .dp-gauges { grid-template-columns: 1fr 1fr; gap: 1px 8px; margin: 3px 0 1px; }
body.mobile .gauge { font-size: 10px; gap: 4px; }
body.mobile .gauge.boost { display: none; }
body.mobile .gauge .g-lbl { width: 36px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
body.mobile .gauge .g-val { width: auto; min-width: 28px; font-size: 10.5px; white-space: nowrap; }
body.mobile .gauge .track { height: 7px; }
body.mobile .dp-chips { gap: 4px; margin: 2px 0; }
body.mobile .chip { font-size: 10.5px; padding: 1px 7px; }
body.mobile .dp-tip { font-size: 11px; padding: 2px 8px; margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mobile.show-panel #barn-panel { top: 104px; }

@media (max-height: 500px) {
  /* 가로 화면: 위쪽 한 줄 · 운전 패널은 아래 가운데(조이스틱과 버튼 사이) · 알림은 위 가운데 */
  body.mobile #top-left { max-width: calc(100vw - 400px); }
  body.mobile #top-right { grid-template-columns: repeat(8, 40px); }
  body.mobile .round-btn { width: 40px; height: 40px; }
  body.mobile #minimap { top: 54px; width: 76px; height: 76px; }
  body.mobile #drive-panel { top: auto; bottom: 8px; left: 150px; right: 240px; }
  body.mobile #prompt { bottom: 120px; }
  body.mobile #house-hud { top: 50px; }
  body.mobile.show-panel #barn-panel { top: 50px; max-height: calc(100vh - 60px); }
}

/* 🔔 알림은 모바일에서 미니맵 바로 아래 오른쪽 */
body.mobile .pill.notice { top: 200px; }
@media (max-height: 500px) {
  body.mobile .pill.notice { top: 138px; max-width: 40vw; }
}

/* PC 화면이 좁으면 왼쪽 위 '농장 문 열기·광장으로'는 아이콘만 (오른쪽 위 버튼과 겹치지 않게) */
@media (max-width: 1360px) {
  body:not(.mobile) #top-left .pill.net-btn .lbl { display: none; }
  body:not(.mobile) #top-left .pill.net-btn { padding: 8px 12px; }
  body:not(.mobile) #top-left .pill.net-btn[data-armed] .lbl { display: inline; font-size: 13px; }
}

/* ---------- 🪧 집 앞 알림판 · 방명록 ---------- */
.board-sheet { width: min(520px, 94vw); }
.board-notice { background: #2f5d4a; color: #fffaf0; border: 4px solid #b07a4f; border-radius: 18px; padding: 10px 14px 12px; margin-bottom: 12px; }
.bn-title { font-family: 'Jua'; color: #ffe9a8; font-size: 16px; margin-bottom: 4px; }
.bn-view { font-family: 'Jua'; font-size: 19px; line-height: 1.35; white-space: pre-wrap; word-break: break-all; }
.bn-view.empty { opacity: 0.55; font-size: 15px; }
.bn-edit { display: flex; gap: 6px; margin-top: 8px; }
.bn-edit.hidden { display: none; }
.board-sheet input { flex: 1; min-width: 0; border: 3px solid var(--line); border-radius: 14px; padding: 7px 12px; font: inherit; font-size: 15px; background: #fff; color: var(--ink); }
.board-sheet .btn { flex: none; border: 3px solid var(--line); background: var(--yellow); color: var(--ink); border-radius: 14px; padding: 6px 12px; font-family: 'Jua'; font-size: 15px; cursor: pointer; }
.board-sheet .btn:active { transform: translateY(1px); }
.board-book-head { font-family: 'Jua'; font-size: 17px; margin: 4px 2px 6px; }
.board-book-head span { color: var(--ink2); font-size: 13px; }
.board-write { display: flex; gap: 6px; margin-bottom: 10px; }
#board-book { display: grid; gap: 7px; }
.board-entry { background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 6px 10px 8px; }
.be-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); }
.be-head b { color: var(--ink); font-size: 14.5px; }
.be-head span { flex: 1; }
.be-del { border: none; background: none; color: var(--ink2); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.be-msg { font-size: 15.5px; margin-top: 2px; word-break: break-all; }
.board-empty { color: var(--ink2); text-align: center; margin: 8px 0; }
body.mobile .board-sheet { padding: 12px 14px 16px; }
body.mobile .bn-view { font-size: 16px; }

/* ---------- 🎨 차고 (상점 탭) ---------- */
.garage { display: grid; gap: 10px; }
.g-pick { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.g-car { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 70px; padding: 5px 6px; border: 3px solid var(--line); border-top: 5px solid var(--vc); border-radius: 14px; background: #fff; color: var(--ink); cursor: pointer; font: inherit; }
.g-car span { font-size: 22px; }
.g-car small { font-size: 11px; white-space: nowrap; }
.g-car.on { border-color: var(--pink); background: #fff0f4; border-top-color: var(--vc); }
.g-head { display: flex; align-items: center; gap: 10px; }
.g-ico { font-size: 34px; }
.g-head b { font-size: 19px; display: block; }
.g-head small { color: var(--ink2); }
.g-stats { display: grid; gap: 4px; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 8px 12px; }
.g-stat { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; }
.g-stat i { height: 9px; background: var(--cream2); border-radius: 99px; overflow: hidden; }
.g-stat i b { display: block; height: 100%; background: linear-gradient(90deg, #ffd34d, #ff8fab); border-radius: 99px; }
.g-stat em { font-style: normal; font-size: 12px; text-align: right; }
.g-stat em.up { color: #3f9f4f; }
.g-stat em.down { color: #d0605a; }
.g-title { font-family: 'Jua'; font-size: 17px; margin-top: 2px; }
.g-title small { font-family: 'Gowun Dodum', sans-serif; font-size: 12px; color: var(--ink2); }
.g-grades { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.g-grade { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px; border: 3px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); cursor: pointer; font: inherit; }
.g-grade b { font-size: 15px; }
.g-grade small { font-size: 11.5px; color: var(--ink2); line-height: 1.3; }
.g-grade .g-price { margin-top: 3px; font-family: 'Jua'; font-size: 13px; color: var(--ink); }
.g-grade.on { border-color: var(--pink); background: #fff0f4; }
.g-grade:disabled:not(.on), .g-skin:disabled:not(.on) { opacity: 0.55; cursor: default; }
.g-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 7px; }
.g-skin { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border: 3px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); cursor: pointer; font: inherit; }
.g-skin i { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.g-skin b { font-size: 13px; }
.g-skin small { font-size: 11px; color: var(--ink2); }
.g-skin.on { border-color: var(--pink); background: #fff0f4; }
.g-skin.locked i { filter: saturate(0.75); }
.g-eye { display: flex; justify-content: flex-end; }
.g-view { border: 3px solid var(--line); background: #fff; border-radius: 12px; padding: 5px 12px; font: inherit; color: var(--ink); cursor: pointer; }
.g-tier { display: inline-block; font-family: 'Jua'; font-size: 11px; color: #fff; background: var(--tc); border-radius: 99px; padding: 0 7px; line-height: 17px; }
.g-grade, .g-skin { border-color: color-mix(in srgb, var(--tc) 35%, var(--line)); }
.g-skin em { font-style: normal; font-size: 10.5px; color: #3f9f4f; text-align: center; line-height: 1.2; }
.g-skin.tier-legend { background: linear-gradient(180deg, #fffaf0, #fff3d6); }
.g-skin.tier-epic { background: linear-gradient(180deg, #fff, #f6efff); }
.g-skins { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.g-parts { display: grid; gap: 6px; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.g-slot { display: grid; grid-template-columns: 62px 1fr; align-items: start; gap: 6px; }
.g-slot-name { font-family: 'Jua'; font-size: 14px; padding-top: 4px; }
.g-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.g-chip { border: 2px solid var(--line); background: var(--cream); border-radius: 99px; padding: 3px 9px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.g-chip em { font-style: normal; font-size: 11px; color: var(--ink2); }
.g-chip.on { border-color: var(--pink); background: #fff0f4; font-weight: bold; }
.g-chip.locked { opacity: 0.85; }
.g-chip:disabled { opacity: 0.45; cursor: default; }

/* ✏️ 이름 짓기 */
.name-form { display: flex; flex-direction: column; gap: 10px; }
.name-form input { font: inherit; font-size: 18px; padding: 10px 12px; border-radius: 12px; border: 2px solid #f3c6d2; outline: none; }
.name-form input:focus { border-color: #ff8fab; }
.name-btns { display: flex; gap: 8px; }
.name-btns button { font: inherit; padding: 8px 14px; border-radius: 12px; border: none; cursor: pointer; background: #f1ecf7; }
.name-btns .buy { background: #ff8fab; color: #fff; font-weight: 700; }
#prompt .pr-name { margin-left: 8px; font: inherit; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; border: none; background: #fff3dc; color: #7a5a3a; cursor: pointer; pointer-events: auto; }
.wlabel.pet-name { font-size: 13px; padding: 2px 9px; background: rgba(255, 255, 255, 0.92); border-radius: 999px; color: #5b4a6b; font-weight: 700; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
