:root {
  --bg: rgba(255, 253, 243, 0.95);
  --bg-solid: #fffdf3;
  --line: #e2dfcc;
  --text: #394e43;
  --muted: #69765f;
  --accent: #668b5f;
  --accent-2: #a66b35;
  --good: #4f835c;
  --bad: #b95350;
  --info: #608b99;
  --radius: 22px;
  --shadow: 0 5px 0 rgba(91, 109, 71, 0.12), 0 12px 30px rgba(60, 81, 55, 0.12);
  --display: 'Nunito', 'Be Vietnam Pro', sans-serif;
  font-family: 'Be Vietnam Pro', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1220; }
body { font-size: 14px; user-select: none; -webkit-font-smoothing: antialiased; }
input, select, button { font: inherit; color: inherit; }
.hidden { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

.card { background: var(--bg-solid); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.glass { background: var(--bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Nút & form ---------- */
.btn {
  background: linear-gradient(180deg, #ffad5c, #f2851f); color: #2a1500; border: 0; border-radius: 10px;
  padding: 9px 16px; font-weight: 700; cursor: pointer; transition: transform 0.08s, filter 0.15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(1) brightness(0.7); cursor: not-allowed; }
.btn.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(180deg, #ff7b7b, #e04848); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; margin-top: 6px; }
.icon-btn { background: rgba(255, 255, 255, 0.08); border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; flex: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }
.chip { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.chip:hover, .chip.active { background: rgba(255, 159, 67, 0.25); border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 13px; }
.field input, .field select, input.qty, input.price-input, select {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; color: var(--text); outline: none; user-select: text;
}
.field input:focus, input.qty:focus, input.price-input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.1); }
input.qty { width: 64px; padding: 6px 8px; text-align: center; }
input.price-input { width: 110px; padding: 6px 8px; }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; line-height: 1.5; }
.warn { background: rgba(255, 184, 77, 0.12); border: 1px solid rgba(255, 184, 77, 0.35); padding: 8px 12px; border-radius: 10px; color: #ffd8a1; font-size: 13px; }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); }
b.bad { color: var(--bad); }

.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.05); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tabs button { flex: 1; background: transparent; border: 0; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.active { background: rgba(255, 159, 67, 0.2); color: var(--text); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; }
.swatches.small .swatch { width: 24px; height: 24px; }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }

.bar { position: relative; height: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffd166, #ff9f43); transition: width 0.3s; }
.bar > span { position: absolute; inset: 0; font-size: 9.5px; line-height: 10px; text-align: center; font-weight: 700; color: rgba(0, 0, 0, 0.7); }

/* ---------- Loading ---------- */
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; background: rgba(10, 14, 24, 0.75); z-index: 100; font-weight: 600; }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Đăng nhập ---------- */
#auth { position: fixed; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 4vh 6vw; z-index: 20; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 12, 24, 0.55), rgba(10, 12, 24, 0) 45%, rgba(10, 12, 24, 0.35)); }
#auth > * { pointer-events: auto; }
.auth-brand { max-width: 460px; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5); align-self: flex-start; margin-top: 4vh; }
#auth.previewing .auth-brand { visibility: hidden; }
.brand-sun { font-size: 54px; }
.auth-brand h1 { font-size: 52px; line-height: 1.05; margin: 8px 0 14px; font-weight: 800; letter-spacing: -1px; }
.auth-brand h1 span { color: var(--accent-2); display: block; }
.auth-brand p { font-size: 16px; line-height: 1.6; color: #e8ecf4; }
.brand-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; font-weight: 600; }
.auth-card { width: 400px; max-height: 92vh; overflow-y: auto; padding: 20px 22px; background: rgba(18, 22, 34, 0.9); backdrop-filter: blur(12px); }
.auth-error { color: var(--bad); min-height: 18px; margin: 10px 0 0; font-weight: 600; }
#look-picker { margin: 8px 0 4px; display: grid; gap: 8px; }
.look-row { display: flex; align-items: center; gap: 10px; }
.look-row > span { width: 40px; color: var(--muted); font-size: 13px; }

/* ---------- HUD ---------- */
#hud > * { position: fixed; z-index: 5; }
#hud-stats { top: 14px; left: 14px; width: 260px; padding: 12px 14px; }
.hud-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#hud-name { font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: linear-gradient(180deg, #ffd166, #ff9f43); color: #2a1500; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 99px; }
.bar.xp { height: 10px; }
.hud-money { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.hud-money small { display: block; color: var(--muted); font-size: 11px; }
.hud-money b { font-size: 15px; color: var(--accent-2); }
.energy-row { display: flex; align-items: center; gap: 8px; }
.energy-row .bar { flex: 1; height: 12px; }
.bar.energy > div { background: linear-gradient(90deg, #2ecc71, #a3e635); }
.bar.energy > div.low { background: linear-gradient(90deg, #ff6b6b, #ffa94d); }
.bar.energy > span { line-height: 12px; }
.hud-tax { margin-top: 10px; font-size: 12.5px; font-weight: 600; color: #ffd8a1; background: rgba(255, 184, 77, 0.12); padding: 6px 9px; border-radius: 8px; }
.hud-tax.overdue { color: #ffb3b3; background: rgba(255, 107, 107, 0.15); }

#hud-clock { top: 14px; left: 50%; transform: translateX(-50%); padding: 8px 18px; text-align: center; }
#clock-time { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.clock-sub { color: var(--muted); font-size: 12px; }
#clock-shops { color: #8ce99a; }
#clock-shops.closed { color: #ffa8a8; }

#map-wrap { top: 14px; right: 14px; padding: 6px; line-height: 0; }
#minimap { border-radius: 9px; }
#quest { top: 220px; right: 14px; width: 222px; padding: 11px 13px; }
.quest-tag { font-size: 11px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.quest-title { font-weight: 800; margin: 3px 0 5px; font-size: 15px; }
.quest-desc { color: #d5dbe6; font-size: 12.5px; line-height: 1.45; }
.quest-reward { margin-top: 7px; font-size: 12px; color: var(--accent-2); font-weight: 700; }

#menu { bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; }
#menu button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: 0; border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 20px; min-width: 64px; }
#menu button span { font-size: 11px; color: var(--muted); font-weight: 600; }
#menu button:hover { background: rgba(255, 255, 255, 0.1); }
#menu kbd { position: absolute; top: 3px; right: 5px; font-size: 9px; color: var(--muted); font-family: inherit; opacity: 0.7; }

#chat { bottom: 14px; left: 14px; width: 340px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
#chat-log { height: 150px; overflow-y: auto; font-size: 12.5px; line-height: 1.45; padding: 2px 4px; user-select: text; }
#chat-log::-webkit-scrollbar { width: 6px; }
#chat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.chat-line { word-wrap: break-word; }
.chat-line b { color: #9ad0ff; }
.chat-line b.me { color: var(--accent-2); }
.chat-line.sys { color: #b8c2d4; font-style: italic; }
.chat-time { color: rgba(255, 255, 255, 0.35); font-size: 10.5px; margin-right: 6px; font-style: normal; }
#chat-input { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; user-select: text; }
#chat-input:focus { border-color: var(--accent); }

#prompt { bottom: 96px; left: 50%; transform: translateX(-50%); background: rgba(16, 20, 30, 0.85); border: 1px solid rgba(255, 209, 102, 0.4); padding: 9px 16px 9px 9px; border-radius: 99px; display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; animation: pop 0.2s ease-out; white-space: nowrap; }
.key { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 7px; background: var(--accent-2); color: #2a1500; font-weight: 800; font-size: 12px; padding: 0 6px; }
@keyframes pop { from { transform: translateX(-50%) scale(0.9); opacity: 0; } }

/* ---------- Hộp thoại NPC ---------- */
#dialog { position: fixed; z-index: 15; bottom: 96px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 16px 18px; animation: rise 0.18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }
.dialog-head { display: flex; align-items: center; gap: 12px; }
.dialog-head > div:nth-child(2) { flex: 1; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.4); flex: none; }
.dialog-name { font-weight: 800; font-size: 17px; }
.dialog-title { color: var(--accent-2); font-size: 12.5px; font-weight: 600; }
.dialog-text { font-size: 14.5px; line-height: 1.6; margin: 12px 0; color: #eef1f6; }
.dialog-options { display: grid; gap: 6px; }
.option { display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: background 0.12s; }
.option:hover:not(:disabled) { background: rgba(255, 159, 67, 0.18); border-color: rgba(255, 159, 67, 0.5); }
.option:disabled { opacity: 0.45; cursor: not-allowed; }
.option .key { background: rgba(255, 255, 255, 0.12); color: var(--text); min-width: 22px; height: 22px; font-size: 11px; }
.option-label { display: block; font-weight: 600; }
.option-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- Modal ---------- */
#modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(5, 8, 15, 0.45); animation: fadein 0.15s; }
@keyframes fadein { from { opacity: 0; } }
.modal-card { width: min(520px, calc(100vw - 24px)); max-height: 86vh; display: flex; flex-direction: column; background: rgba(20, 25, 37, 0.96); }
.modal-card.wide { width: min(820px, calc(100vw - 24px)); }
.modal-card header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-body { padding: 14px 20px 18px; overflow-y: auto; user-select: text; }
.modal-body h3 { margin: 16px 0 8px; font-size: 15px; }

.item-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); margin-bottom: 6px; }
.item-icon { font-size: 24px; width: 34px; text-align: center; flex: none; }
.item-main { flex: 1; min-width: 0; }
.item-main b { display: block; }
.item-main small { color: var(--muted); font-size: 12px; }
.price { font-weight: 800; color: var(--accent-2); min-width: 86px; text-align: right; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 9px 12px; }
.stat small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.stat b { font-size: 15px; }

.pill { display: inline-block; padding: 5px 12px; border-radius: 99px; font-weight: 800; font-size: 12px; letter-spacing: 0.4px; }
.pill.good { background: rgba(46, 204, 113, 0.2); color: #8ce99a; }
.pill.bad { background: rgba(255, 107, 107, 0.2); color: #ffa8a8; }
.pill.muted { background: rgba(255, 255, 255, 0.1); color: var(--muted); }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag.good { background: rgba(46, 204, 113, 0.18); color: #8ce99a; }
.tag.ok { background: rgba(77, 171, 247, 0.18); color: #a5d8ff; }
.tag.warn { background: rgba(255, 184, 77, 0.18); color: #ffd8a1; }
.tag.bad { background: rgba(255, 107, 107, 0.18); color: #ffa8a8; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 7px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.table tr.me td { background: rgba(255, 159, 67, 0.12); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; }

.job-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 159, 67, 0.12); border: 1px solid rgba(255, 159, 67, 0.35); }
.job-card small { display: block; color: var(--muted); margin-top: 2px; }

.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.inv-cell { background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.inv-icon { font-size: 32px; }
.inv-cell small { color: var(--muted); }
/* Sổ câu cá: loài chưa bắt được */
.inv-cell.unknown { opacity: 0.62; border-style: dashed; }
.inv-cell.unknown .inv-icon { filter: grayscale(1); }
.plant-corner { margin-top: 12px; }

.skills { display: grid; gap: 8px; }
.skill { display: grid; grid-template-columns: 110px 1fr 48px; gap: 10px; align-items: center; }
.skill b { text-align: right; color: var(--accent-2); }

.help-sec ul { margin: 0; padding-left: 20px; line-height: 1.7; color: #dde3ec; }

/* ---------- Ca làm ---------- */
#work { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(5, 8, 15, 0.35); }
.work-card { width: min(440px, calc(100vw - 24px)); padding: 20px 22px; text-align: center; background: rgba(20, 25, 37, 0.95); }
.work-title { font-weight: 800; font-size: 19px; }
.work-verb { color: var(--accent-2); margin: 4px 0 12px; font-weight: 600; }
.rounds { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.round { width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); }
.round.hit { background: var(--good); box-shadow: 0 0 10px var(--good); }
.round.miss { background: var(--bad); }
.track { position: relative; height: 26px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-bottom: 12px; }
.zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(180deg, #51cf66, #2f9e44); }
.needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 8px #fff; border-radius: 2px; }
.work-progress { margin-top: 14px; height: 8px; }
.work-progress > div { transition: none; background: linear-gradient(90deg, #4dabf7, #74c0fc); }
.work-feedback { margin: 10px 0; min-height: 20px; font-weight: 600; }

/* ---------- Thông báo ---------- */
#toasts { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: rgba(16, 20, 30, 0.92); border: 1px solid var(--line); border-left: 4px solid var(--info); padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; max-width: min(620px, 90vw); animation: rise2 0.2s ease-out; transition: opacity 0.4s, transform 0.4s; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.money { border-left-color: var(--accent-2); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes rise2 { from { opacity: 0; transform: translateY(-8px); } }

.banner { position: fixed; top: 26%; left: 50%; transform: translate(-50%, -50%); z-index: 45; text-align: center; pointer-events: none; animation: bannerIn 0.45s cubic-bezier(.2, 1.4, .4, 1); transition: opacity 0.5s; }
.banner.out { opacity: 0; }
.banner-title { font-size: 40px; font-weight: 800; color: var(--accent-2); text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 159, 67, 0.5); }
.banner-sub { font-size: 17px; font-weight: 600; margin-top: 6px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7); }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); } }

.float-text { position: fixed; z-index: 35; font-weight: 800; font-size: 22px; pointer-events: none; transform: translate(-50%, -50%); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); animation: floatUp 1.6s ease-out forwards; }
@keyframes floatUp { to { transform: translate(-50%, -150%); opacity: 0; } }

.fade { position: fixed; inset: 0; z-index: 50; background: #05070d; display: grid; place-items: center; font-size: 28px; font-weight: 800; animation: fadein 0.5s; transition: opacity 0.8s; }
.fade.out { opacity: 0; }

.confirm { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 8, 15, 0.5); }
.confirm-card { width: min(400px, calc(100vw - 24px)); padding: 18px 20px; }
.confirm-card p { margin: 0 0 12px; line-height: 1.5; font-size: 15px; }

#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.bubble { position: absolute; left: 0; top: 0; max-width: 220px; background: #fff; color: #1d2433; padding: 6px 11px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); word-wrap: break-word; }
.bubble::after { content: ''; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #fff; }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 900px) {
  #auth { flex-direction: column; justify-content: flex-end; padding: 16px; }
  .auth-brand { display: none; }
  .auth-card { width: 100%; max-height: 70vh; }
  #quest, #map-wrap { display: none; }
  #chat { width: calc(100vw - 28px); bottom: 84px; }
  #chat-log { height: 80px; }
  #menu button { min-width: 48px; padding: 6px; }
  #menu button span, #menu kbd { display: none; }
  #prompt { bottom: 250px; }
  #hud-stats { width: 210px; }
  #hud-clock { left: auto; right: 14px; transform: none; }
}

/* Bình Minh — soft paper, garden greens and little toy details. */
html, body { background: #dce8cb; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #d7ae69; outline-offset: 3px; }
button { touch-action: manipulation; }
button, .card, .glass { transition: background .18s, box-shadow .18s, transform .18s; }
.card, .glass { border: 2px solid var(--line); box-shadow: var(--shadow); }
.glass { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn { background: #749466; color: #fffdf2; border: 1px solid #607f54; border-radius: 14px; box-shadow: 0 4px 0 #526e45, inset 0 1px 0 #a2b594; padding: 11px 17px; }
.btn:hover { background: #648658; filter: none; transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #526e45; }
.btn:disabled { opacity: .55; filter: grayscale(.5); box-shadow: none; transform: none; }
.btn.ghost { background: #f3f0e3; border-color: #dedac7; color: #61725a; box-shadow: 0 3px 0 #dedac7; }
.btn.danger { background: #bd7269; border-color: #ac665e; box-shadow: 0 4px 0 #94544e; }
.btn.big { padding: 15px 17px; margin-top: 14px; display: flex; justify-content: center; align-items: center; gap: 20px; }
.btn.big > span { font-size: 23px; line-height: 20px; }
.icon-btn { background: #eeecdf; color: #6a7965; border: 1px solid #dedcca; }
.icon-btn:hover { background: #e3e9d8; }
.field { margin: 17px 0; gap: 9px; color: #56684f; font-size: 12px; font-weight: 600; }
.field input, .field select, input.qty, input.price-input, select { background: #f6f4ea; border: 1.5px solid #dedfce; border-radius: 13px; padding: 12px 14px; color: var(--text); box-shadow: inset 0 2px 2px #64774a06; }
input::placeholder { color: #77816b; font-weight: 400; font-size: 12px; }
.field input:focus, input.qty:focus, input.price-input:focus { background: #fffef8; border-color: #8fa780; }
.tabs { background: #eceee0; border: 1px solid #e1e3d2; border-radius: 14px; padding: 5px; margin-bottom: 22px; }
.tabs button { padding: 11px 8px; border-radius: 10px; color: #77816b; font-size: 12px; }
.tabs button.active { background: #fffef6; color: #466143; box-shadow: 0 2px 4px #65724b18; }
.chip { background: #f1efdf; border-color: #dedfcc; color: #65715a; }
.chip:hover, .chip.active { background: #e0e9d3; border-color: #94aa7c; }
.swatch { border: 2px solid #fffef4; box-shadow: 0 2px 0 #52643e20; }
.swatch.active { border-color: #fffdf3; box-shadow: 0 0 0 2px #6e8f59; }
.bar { background: #e8e7d9; border: 1px solid #d9dbc7; }
.bar > div { background: linear-gradient(90deg, #efc982, #e3b46e); }
.bar > span { color: #535e45; }
.bar.energy > div { background: linear-gradient(90deg, #91b480, #b1c98c); }
.bar.energy > div.low { background: #e7a178; }
.badge { color: #846a39; background: #f8e7b5; border: 1px solid #e9d699; }
.warn, .hud-tax { color: #946b34; background: #fbefd2; border-color: #e9d4a5; }
.hud-tax.overdue { color: #a45146; background: #f7e0d7; }
.hud-law { display: block; width: 100%; border: 0; text-align: left; cursor: pointer; font: inherit; }
#bigmap { position: fixed; inset: 14px; z-index: 60; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; background: #fffaf0f5; border: 1px solid #e4dcc4; box-shadow: 0 18px 50px rgba(40, 35, 20, 0.35); }
#bigmap.hidden { display: none; }
.bigmap-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bigmap-head b { font-size: 16px; color: #5a4632; margin-right: auto; }
.bigmap-head select { max-width: 260px; padding: 7px 10px; border-radius: 10px; border: 1px solid #e0d6bd; background: #fff; font: inherit; font-size: 13px; }
.bigmap-tools { display: flex; gap: 6px; }
.bigmap-tools button, .bigmap-info button { min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid #e0d6bd; border-radius: 10px; background: #f6efdc; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.bigmap-tools button:hover, .bigmap-info button:hover { background: #efe4c6; }
#bigmap canvas { flex: 1; min-height: 0; width: 100%; border-radius: 12px; background: #a2d4d5; touch-action: none; cursor: grab; }
#bigmap canvas:active { cursor: grabbing; }
.bigmap-info { display: flex; align-items: center; gap: 8px; min-height: 38px; font-size: 13px; color: #5a4632; }
.bigmap-text { flex: 1; }
.bigmap-info .bigmap-go { background: #f2b24c; border-color: #e09a2c; color: #3d2f25; font-size: 14px; }
.bigmap-info .hidden { display: none; }
@media (max-width: 700px) {
  #bigmap { inset: 6px; padding: 8px; }
  .bigmap-head b { font-size: 14px; width: 100%; }
  .bigmap-head select { flex: 1; max-width: none; }
  .bigmap-info { flex-wrap: wrap; }
}
canvas.park-map { display: block; width: 100%; height: auto; border-radius: 12px; border: 2px solid #e9d4a5; margin-bottom: 10px; cursor: pointer; }
.item-row.picked { background: #fff1c7; border-radius: 10px; }
.hud-law.hidden { display: none; }
.law-list { margin: 6px 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; line-height: 1.45; }
.pill.good, .tag.good { background: #e0edda; color: #507345; }
.pill.bad, .tag.bad { background: #f4ded8; color: #a3544c; }
.pill.muted { background: #eeecdf; }
.tag.ok { color: #527e89; background: #e0ecea; }
.tag.warn { color: #967141; background: #f4e7c6; }

#loading { background: #f3f2e4; color: #5b7350; gap: 13px; }
#loading small { color: #8c957e; font-weight: 400; }
.loading-sun { font-size: 80px; color: #d9ab60; font-family: var(--display); line-height: 1; animation: bob 3s ease-in-out infinite; }
.spinner { width: 27px; height: 27px; border: 3px solid #dee4cd; border-top-color: #7a985f; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(5deg); } }

#auth { padding: 110px 5.2vw 86px; align-items: center; background: linear-gradient(90deg, #f4f5e5dc, #f4f5e530 48%, #edf0dc28 65%, #f4f1e2a8), linear-gradient(0deg, #eef0dfec, transparent 22%, transparent 60%, #f0f3e2c9); overflow-y: auto; }
.auth-header { position: absolute; inset: 26px 5.2vw auto; display: flex; justify-content: space-between; align-items: center; }
.wordmark { display: flex; align-items: center; gap: 10px; color: #435f42; font-family: var(--display); font-size: 27px; font-weight: 1000; line-height: 1.05; }
.wordmark small { display: block; font-family: 'Be Vietnam Pro', sans-serif; font-size: 7px; letter-spacing: 1.7px; margin-top: 7px; font-weight: 600; }
.sun-mark { background: #f7d58e; color: #a67b43; width: 47px; height: 47px; display: grid; place-items: center; border-radius: 16px; font-size: 38px; box-shadow: 0 3px 0 #b9ae7930; transform: rotate(-8deg); }
.world-label { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border: 1px solid #d3dcc2; border-radius: 20px; background: #f8faedc9; font-size: 10px; color: #718067; }
.world-label i, .map-foot i { width: 6px; height: 6px; background: #8ea475; border-radius: 50%; box-shadow: 0 0 0 3px #8ea47518; }
.auth-brand { align-self: flex-start; margin-top: 34px; max-width: 550px; text-shadow: none; }
.eyebrow { display: block; color: #7c8b64; font-size: 9px; font-weight: 700; letter-spacing: 2.2px; }
.auth-brand h1 { position: relative; font-family: var(--display); font-size: clamp(43px, 4.5vw, 68px); line-height: 1.12; letter-spacing: -2.4px; font-weight: 1000; color: #3f634b; margin: 16px 0; }
.auth-brand h1 span { color: #749064; display: inline; }
.auth-brand h1 .title-spark { display: inline-block; color: #c69755; vertical-align: top; font-size: 33px; margin: -10px 0 0 10px; }
.auth-brand p { color: #6f7b63; font-size: 13px; line-height: 1.9; margin: 16px 0; }
.brand-points { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; font-size: 10px; font-weight: 500; }
.brand-points span { border: 1px solid #dce2cb; background: #fbfbefae; border-radius: 18px; padding: 8px 11px; }
.auth-card { position: relative; overflow: visible; width: 368px; flex: 0 0 368px; max-height: none; padding: 30px 28px 22px; background: #fffdf3f7; border: 2px solid #fffef7; outline: 1px solid #dcdccb; border-radius: 28px; box-shadow: 0 8px 0 #7e8b5d15, 0 22px 55px #435c3b22; margin-left: 36px; }
.welcome-sticker { position: absolute; right: 23px; top: -22px; width: 47px; height: 47px; display: grid; place-items: center; background: #f7d59d; border: 3px solid #fffdf3; color: #b77e46; font-size: 34px; line-height: 1; border-radius: 17px; transform: rotate(13deg); box-shadow: 0 3px 0 #b9ae7920; }
.auth-intro { margin-bottom: 22px; }
.auth-intro .eyebrow { font-size: 8px; letter-spacing: 1.6px; }
.auth-intro h2 { font-family: var(--display); font-weight: 900; font-size: 27px; letter-spacing: -.6px; margin: 10px 0 4px; color: #486346; }
.auth-intro p { font-size: 11px; color: #758067; margin: 0; }
.auth-error { font-size: 11px; line-height: 1.5; min-height: 0; margin: 14px 0 0; }
.auth-error:empty { display: none; }
.auth-note { border-top: 1px dashed #dedfcc; margin-top: 24px; padding-top: 16px; color: #919780; font-size: 9px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.auth-note > span { color: #ba967d; font-size: 17px; }
.town-caption { position: absolute; bottom: 112px; left: 5.2vw; display: flex; align-items: center; gap: 13px; background: #fffdf3e8; border: 2px solid #fffdf3; outline: 1px solid #d9ddc6; border-radius: 20px; box-shadow: 0 5px 0 #71885413; padding: 15px 20px 15px 14px; transform: rotate(-2deg); }
.caption-icon { color: #d7a064; background: #f8e5ba; border-radius: 13px; display: grid; place-items: center; font-size: 29px; width: 43px; height: 43px; }
.town-caption b { display: block; font-family: var(--display); font-size: 16px; font-weight: 800; color: #637950; }
.town-caption div > span { display: block; font-size: 9px; color: #92967e; margin-top: 4px; }
.caption-star { color: #b0ba8b; margin-left: 8px; font-size: 23px; }
.auth-footer { position: absolute; bottom: 25px; left: 5.2vw; right: 5.2vw; display: flex; justify-content: space-between; gap: 20px; color: #758464; font-size: 8px; letter-spacing: .7px; }
.auth-footer > span:last-child { letter-spacing: 0; }
.preview-caption { display: none; position: absolute; left: 5.2vw; top: 120px; }
.preview-caption h2 { font: 900 32px/1.2 var(--display); color: #506f4b; margin: 12px 0; }
.preview-caption p { font-size: 11px; color: #7f8a70; }
#auth.previewing .preview-caption { display: block; }
#auth.previewing { background: linear-gradient(90deg, #f4f5e57a, #f4f5e510 48%, #edf0dc28 65%, #f4f1e28a), linear-gradient(0deg, #eef0dfec, transparent 24%, transparent 73%, #f0f3e2c9); }
#auth.previewing .town-caption { display: none; }
#auth.previewing .auth-card { padding-top: 21px; }
#auth.previewing .auth-intro { margin-bottom: 15px; }
#auth.previewing .tabs { margin-bottom: 13px; }
#auth.previewing .field { margin: 11px 0; }
#auth.previewing .field input { padding-top: 9px; padding-bottom: 9px; }
#auth.previewing .auth-note { margin-top: 15px; padding-top: 12px; }
#look-picker { border-top: 1px dashed #dedfcc; padding-top: 13px; margin-top: 15px; gap: 10px; }
.look-row { gap: 8px; }
.look-row > span { width: 35px; flex: none; font-size: 11px; }
.look-row .row { gap: 5px; margin: 0; }
.look-row .chip { padding: 5px 8px; font-size: 9px; }

#hud-stats { top: 20px; left: 20px; width: 248px; padding: 16px; }
.panel-label { font-size: 8px; font-weight: 700; letter-spacing: 1.4px; color: #8b9877; margin-bottom: 11px; }
#hud-name { font: 900 19px var(--display); color: #4e6948; }
.hud-money { gap: 6px; margin: 12px 0; }
.hud-money > div { background: #f0efdf; border-radius: 11px; padding: 8px; }
.hud-money small { font-size: 9px; margin-bottom: 4px; }
.hud-money b { font-size: 13px; color: #856b42; }
.energy-row > span { font-size: 14px; }
#hud-clock { top: 20px; padding: 11px 23px; border-radius: 20px; }
.clock-label { font-size: 7px; letter-spacing: 1.4px; font-weight: 700; color: #90977c; margin-bottom: 4px; }
#clock-time { font-family: var(--display); font-size: 25px; color: #63744c; }
.clock-sub { font-size: 9px; margin-top: 3px; }
#clock-shops { color: #6b8b59; }
#clock-shops.closed { color: #aa786d; }
#map-wrap { top: 20px; right: 20px; padding: 11px; border-radius: 20px; }
.map-heading { display: flex; align-items: center; justify-content: space-between; line-height: 1.2; padding: 0 2px 10px; font-size: 10px; font-weight: 700; color: #637453; }
.map-heading > span:last-child { font-size: 7px; color: #92987d; letter-spacing: 1px; }
#minimap { border-radius: 12px; border: 1px solid #d7dfc6; }
.map-foot { line-height: 1.2; padding: 9px 2px 0; display: flex; gap: 5px; align-items: center; color: #899276; font-size: 8px; }
.map-foot > span { margin-left: auto; color: #718962; }
#quest { top: 286px; right: 20px; width: 222px; padding: 15px; background: #fffae9f5; }
.quest-tag { font-size: 8px; color: #9a8864; letter-spacing: 1px; }
.quest-tag::before { content: '✦ '; color: #cba25d; }
.quest-title { font: 900 17px/1.25 var(--display); color: #68774f; margin: 8px 0; }
.quest-desc { color: #6c785d; font-size: 11px; line-height: 1.65; }
.quest-reward { border-top: 1px dashed #e5dfc6; padding-top: 9px; margin-top: 10px; font-size: 10px; color: #a18445; }
#menu { bottom: 21px; padding: 7px; gap: 5px; border-radius: 23px; background: #fffdf2f5; }
#menu button { min-width: 68px; padding: 10px 9px 8px; border: 1px solid #e4e3cf; border-radius: 15px; background: #f0f0df; font-size: 23px; transition: transform .18s, background .18s; }
#menu button:nth-child(2) { background: #f0e7dc; }
#menu button:nth-child(3) { background: #e3ecdb; }
#menu button:nth-child(4) { background: #f6ebcd; }
#menu button:nth-child(5) { background: #e4ebea; }
#menu button:last-child { background: #f0e9e2; }
#menu button span { color: #758068; font-size: 9px; margin-top: 4px; }
#menu button:hover { transform: translateY(-5px); background: #e2eacb; box-shadow: 0 4px 0 #80916c30; }
#menu kbd { top: 4px; right: 6px; color: #9a9f87; font-size: 8px; }
#chat { bottom: 21px; left: 20px; width: min(295px, 24vw); padding: 12px; border-radius: 19px; }
.chat-heading { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed #dfe1ce; padding-bottom: 9px; font-size: 10px; font-weight: 700; color: #6c805c; }
.chat-heading > span:last-child { font-size: 6px; letter-spacing: .7px; color: #9b9e89; }
#chat-log { height: 100px; font-size: 10px; line-height: 1.7; }
.chat-line b { color: #648795; }
.chat-line b.me { color: #ad8951; }
.chat-line.sys { color: #727d65; }
.chat-time { color: #a3aa92; font-size: 8px; }
#chat-input { background: #f1f1e2; border: 1px solid #dedfcc; border-radius: 11px; padding: 10px; font-size: 11px; }
#chat-input::placeholder { font-size: 10px; }
#prompt { bottom: 118px; background: #fffbeaf5; border: 2px solid #e1dab8; color: #6a754b; padding: 10px 20px 10px 10px; box-shadow: 0 4px 0 #6a784522; font-size: 12px; }
.key { background: #e6d59b; color: #756333; box-shadow: 0 2px 0 #d0bd84; }

#dialog { bottom: 120px; max-height: calc(100dvh - 140px); overflow-y: auto; padding: 22px; border-color: #d8dfc6; background: #fffdf3fa; }
.avatar { border: 3px solid #fffdf3; box-shadow: 0 0 0 1px #dbddc9; text-shadow: 0 1px 2px #35482b33; }
.dialog-name { color: #54704b; font: 900 23px var(--display); }
.dialog-title { color: #a08852; font-size: 11px; }
.dialog-text { color: #68765d; line-height: 1.8; font-size: 13px; }
.option { background: #f2f3e5; border: 1px solid #dfe4cf; border-radius: 13px; padding: 11px; }
.option:hover:not(:disabled) { background: #e6eed8; border-color: #a9ba92; }
.option .key { background: #e4e8d2; color: #7f8d68; box-shadow: none; }
.option-label { font-size: 12px; }
.option-sub { font-size: 10px; }
#modal, #work, .confirm { background: #374c3652; backdrop-filter: blur(5px); }
.modal-card, .work-card { background: #fffdf3; border: 2px solid #fefef8; outline: 1px solid #e0dfca; border-radius: 26px; }
.modal-card header { padding: 18px 20px; background: #f1f3e4; border-radius: 24px 24px 0 0; }
.modal-card h2, .work-title { font-family: var(--display); font-size: 23px; color: #586f49; }
.modal-body { padding: 18px 22px 22px; }
.work-card, .confirm-card { max-height: calc(100dvh - 24px); overflow-y: auto; }
.modal-body h3 { color: #687c55; }
.item-row, .stat, .inv-cell { background: #f0f1e3; border: 1px solid #e6e6d4; border-radius: 13px; }
.stat { padding: 12px; }
.item-row { padding: 12px; }
.price { color: #a07c40; }
.table th { color: #7c886b; background: #f0f2e3; }
.table td { border-color: #e6e7d7; }
.table tr.me td { background: #e9eedb; }
.job-card { background: #f4eed8; border-color: #e7dcb4; }
.help-sec ul { color: #68765d; }
.round, .track { background: #e5e7d3; }
.round.hit { background: #9fb981; box-shadow: 0 0 0 3px #deebd1; }
.zone { background: #95b57a; }
.needle { background: #8b6b45; box-shadow: 0 0 0 2px #fff9e3; }
.work-progress > div { background: #9bbeb7; }
.toast { color: #667854; background: #fffdf1; box-shadow: var(--shadow); border-radius: 14px; }
.banner { background: #fffdf1ee; border: 2px solid #e3ddbd; border-radius: 25px; padding: 20px 35px; box-shadow: var(--shadow); }
.banner-title { font: 1000 36px var(--display); color: #b08a49; text-shadow: none; }
.banner-sub { color: #7d8c64; text-shadow: none; font-size: 13px; }
.fade { background: #edf0dc; color: #758963; font-family: var(--display); }
.bubble { background: #fffdf1; color: #5c7050; border: 1px solid #e1e3cd; box-shadow: 0 4px 0 #55663c16; border-radius: 16px; }
.bubble::after { border-top-color: #fffdf1; }
* { scrollbar-width: thin; scrollbar-color: #c7cfb4 transparent; }
#chat-log::-webkit-scrollbar-thumb { background: #c7cfb4; }

@media (min-width: 901px) and (max-height: 760px) {
  #auth { padding-top: 85px; padding-bottom: 55px; }
  .auth-brand { margin-top: 17px; }
  .auth-header { top: 19px; }
  .auth-footer { bottom: 18px; }
  .town-caption { bottom: 77px; }
  #auth.previewing .auth-card { margin-top: 7px; padding: 16px 23px; }
  #auth.previewing .auth-intro { display: none; }
  .preview-caption { top: 110px; }
}
@media (min-width: 901px) and (max-width: 1150px) {
  #auth { padding-left: 4vw; padding-right: 4vw; }
  .auth-brand h1 { font-size: 46px; }
  .auth-brand h1 .title-spark { display: none; }
  .auth-card { width: 340px; flex-basis: 340px; padding: 25px; }
  #chat { width: 230px; bottom: 120px; }
  #chat-log { height: 70px; }
  #quest { width: 200px; }
}
@media (max-width: 900px) {
  #auth { display: flex; flex-direction: column; padding: 115px 24px 55px; justify-content: flex-start; background: linear-gradient(#edf1dfb8, #f1f1e164); }
  .auth-header { inset: 22px 25px auto; }
  .wordmark { font-size: 24px; }
  .world-label { display: none; }
  .auth-brand { display: block; align-self: auto; margin: 5px 0 25px; text-align: center; max-width: 100%; }
  .auth-brand h1 { font-size: 42px; margin: 12px 0; letter-spacing: -1.3px; }
  .auth-brand h1 br { display: block; }
  .auth-brand .eyebrow, .auth-brand h1 .title-spark, .brand-points, .town-caption { display: none; }
  .auth-brand p { font-size: 11px; margin: 8px 0; }
  .auth-card { margin: 0; width: min(390px, 100%); flex: none; max-height: none; padding: 25px; }
  .auth-footer { position: static; width: 100%; margin-top: 28px; justify-content: center; text-align: center; font-size: 7px; }
  .auth-footer > span:first-child { display: none; }
  #auth.previewing { padding-top: 280px; }
  #auth.previewing .auth-brand, #auth.previewing .preview-caption { display: none; }
  #auth.previewing .auth-intro { margin-bottom: 16px; }
  #hud-stats { top: 12px; left: 12px; width: 215px; padding: 12px; }
  #hud-clock { top: 12px; right: 12px; padding: 10px 13px; }
  #clock-time { font-size: 21px; }
  .clock-label { font-size: 6px; }
  #chat { left: 12px; bottom: 102px; width: 235px; padding: 9px; }
  #chat-log { height: 55px; }
  #menu { bottom: 16px; padding: 6px; gap: 4px; }
  #menu button { min-width: 47px; padding: 9px 7px; }
  #menu button span { display: block; font-size: 7px; }
  #prompt { bottom: 255px; max-width: calc(100vw - 24px); white-space: normal; }
  #dialog { bottom: 101px; max-height: calc(100dvh - 135px); overflow-y: auto; }
}
@media (max-width: 500px) {
  #auth { padding-left: 18px; padding-right: 18px; }
  .auth-brand h1 { font-size: 32px; }
  .auth-brand p { font-size: 10px; }
  .auth-card { padding: 25px 22px; }
  #hud-stats { width: 195px; }
  #hud-name { font-size: 16px; }
  .panel-label { font-size: 6px; }
  .hud-money b { font-size: 11px; }
  #hud-clock { padding: 9px 11px; }
  #clock-time { font-size: 19px; }
  .clock-sub { font-size: 7px; }
  .clock-label { display: none; }
  #chat { width: 210px; }
  .item-row { flex-wrap: wrap; }
  /* Tên món giữ tối thiểu 150 px: giá và nút bấm xuống dòng thay vì bóp tên thành mỗi chữ một dòng. */
  .item-row .item-main { min-width: min(150px, calc(100% - 48px)); }
  .item-row .item-main + .price { margin-left: auto; }
  .modal-body { padding: 15px; }
  .modal-card h2 { font-size: 20px; }
  .row { flex-wrap: wrap; }
}
/* Thời tiết dùng cùng một nhịp với đồng hồ thị trấn. */
.weather-pill { display: flex; align-items: center; gap: 9px; margin: 10px -10px -1px; padding: 9px 11px; border: 1px solid #e1ddbd; border-radius: 13px; background: #f8efd5; color: #8b7446; text-align: left; transition: background 2s ease, border-color 2s ease, color 2s ease; }
#weather-icon { width: 27px; flex: none; text-align: center; font-size: 23px; line-height: 1; }
.weather-copy { flex: 1; min-width: 0; }
.weather-copy b { display: block; font-family: var(--display); font-size: 13px; font-weight: 900; line-height: 1.2; }
.weather-copy small { display: block; font-size: 8px; line-height: 1.5; margin-top: 3px; opacity: .88; white-space: nowrap; }
.weather-pill[data-weather="cloudy"] { background: #e9ede4; color: #657a74; border-color: #d7e0d4; }
.weather-pill[data-weather="drizzle"] { background: #e1eeed; color: #547e86; border-color: #cbdedc; }
.weather-dots { display: none; flex-direction: column; gap: 3px; }
.weather-dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .4; }
.weather-pill.changing .weather-dots { display: flex; }
.weather-pill.changing .weather-dots i { animation: weatherPulse 1.8s ease-in-out infinite; }
.weather-dots i:nth-child(2) { animation-delay: .2s !important; }
.weather-dots i:nth-child(3) { animation-delay: .4s !important; }
@keyframes weatherPulse { 50% { opacity: 1; transform: translateY(1px); } }
#toasts { top: 178px; }
@media (max-width: 900px) {
  .weather-pill { gap: 6px; margin: 8px -4px -1px; padding: 7px; border-radius: 10px; }
  #weather-icon { width: 21px; font-size: 19px; }
  .weather-copy b { font-size: 11px; }
  .weather-copy small { font-size: 7px; }
  .weather-dots { display: none !important; }
  #toasts { top: 208px; }
}
@media (max-width: 500px) {
  .weather-copy small { display: none; }
  .weather-pill { gap: 5px; padding: 7px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 380px) {
  #hud-stats { width: calc(100vw - 170px); }
  .hud-money { grid-template-columns: 1fr; gap: 4px; }
  .hud-money > div { padding: 5px 7px; }
  .hud-money small { margin-bottom: 1px; }
  #hud-clock { max-width: 140px; }
}

/* ---------- Câu cá ---------- */
.fishing-hud { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 12; padding: 10px 18px; border-radius: 14px; text-align: center; font-weight: 700; color: #4f6346; background: #fbf6e6; border: 1px solid #e4dcc0; box-shadow: 0 6px 20px rgba(80, 90, 60, 0.18); pointer-events: none; }
.fishing-hud small { display: block; margin-top: 2px; font-weight: 600; color: #8a9078; font-size: 11.5px; }
.fishing-hud.bite { color: #fff; background: #e58b6f; border-color: #d97456; animation: fishBite 0.35s ease-in-out infinite alternate; }
.fishing-hud.bite small { color: #fff3e6; }

/* ---------- Phòng trọ & hợp đồng ---------- */
.housing-hero { display: flex; align-items: center; gap: 16px; padding: 17px; background: #e9efdf; border: 1px solid #d8e2cb; border-radius: 18px; }
.housing-icon { flex: none; font-size: 44px; }
.housing-hero small { font-size: 10px; letter-spacing: .1em; color: #7b8c6b; font-weight: 800; }
.housing-hero h3 { margin: 5px 0 !important; font-family: var(--display); font-size: 21px; }
.housing-hero p { margin: 0; font-size: 12px; line-height: 1.6; }
.housing-status { display: inline-block; border-radius: 999px; padding: 6px 12px; color: #57754b; background: #e8efdc; font-size: 12px; font-weight: 800; }
.housing-status[data-status="grace"], .housing-status[data-status="expired"] { color: #966a36; background: #f8e9c9; }
.housing-dates { display: grid; gap: 10px; margin: 2px 0 14px; }
.housing-dates small, .housing-summary small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; line-height: 1.6; }
.housing-dates b { font-size: 13px; }
.housing-terms { border-top: 1px dashed #d6d8c3; border-bottom: 1px dashed #d6d8c3; padding: 14px 0 8px; }
.housing-terms p { font-size: 12px; line-height: 1.7; margin: 6px 0; }
.housing-actions { gap: 10px; margin-top: 15px; }
.housing-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #edf0df; border: 1px solid #dee4cb; border-radius: 16px; padding: 14px; }
.housing-summary small { margin-top: 5px; margin-bottom: 0; }
.housing-summary button { flex: none; }
.housing-palettes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 22px; }
.housing-palette { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 2px solid #e1e2d0; border-radius: 16px; background: #f7f5e9; color: #607452; font: inherit; cursor: pointer; }
.housing-palette[aria-pressed="true"] { border-color: #7b9869; background: #edf3df; }
.housing-palette:disabled { opacity: .6; cursor: not-allowed; }
.housing-palette small { font-size: 10px; }
.housing-swatch { width: 48px; height: 48px; border: 3px solid #fffdf3; border-radius: 50%; box-shadow: 0 3px 0 #dcdcc9; }
@media (max-width: 500px) {
  .housing-hero { gap: 10px; padding: 12px; }
  .housing-icon { font-size: 32px; }
  .housing-hero h3 { font-size: 17px; }
  .housing-summary { flex-wrap: wrap; }
  .housing-stock { flex-wrap: wrap; }
  .housing-stock .item-main { min-width: calc(100% - 48px); }
  .housing-stock .qty { margin-left: 38px; }
  .housing-actions .btn { width: 100%; }
  .housing-palette { font-size: 12px; }
}
@keyframes fishBite { to { transform: translateX(-50%) scale(1.06); } }

/* ---------- HUD gọn: chừa tối đa màn hình cho thế giới game ---------- */
#hud-stats { top: 12px; left: 12px; width: 200px; padding: 9px 11px 10px; border-radius: 16px; }
.hud-top { margin-bottom: 6px; gap: 6px; }
#hud-name { font-size: 15px; }
.badge { font-size: 10px; padding: 2px 8px; }
.bar.xp { height: 5px; }
#hud-xp-text { display: none; }
.hud-money { display: flex; justify-content: space-between; gap: 8px; margin: 7px 0 6px; font-size: 11px; color: #8b8f78; }
.hud-money > span { white-space: nowrap; }
.hud-money b { font-size: 12.5px; }
.energy-row { gap: 6px; }
.energy-row > span { font-size: 11px; }
.energy-row .bar { height: 9px; }
.bar.energy > span { font-size: 7.5px; line-height: 9px; }
.hud-tax { margin-top: 6px; padding: 4px 8px; font-size: 10.5px; border-radius: 7px; }

#hud-clock { top: 12px; display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 13px; border-radius: 999px; white-space: nowrap; }
#clock-time { font-size: 16px; line-height: 1; }
#clock-day { font-size: 10.5px; color: #8b9479; font-weight: 600; }
#clock-shops { width: 7px; height: 7px; border-radius: 50%; background: #93bd7c; font-size: 0; overflow: hidden; flex: none; }
#clock-shops.closed { background: #d79c8a; }
#hud-clock .weather-pill { margin: 0; padding: 4px 10px 4px 7px; gap: 5px; border-radius: 999px; font-size: 11px; }
#hud-clock .weather-pill b { font-size: 11px; font-weight: 800; }
#weather-detail { display: none; }

#map-wrap { top: 12px; right: 12px; padding: 5px; border-radius: 14px; line-height: 0; }
#minimap { display: block; width: 150px !important; height: auto !important; border-radius: 10px; }
.hud-toggle { position: absolute; top: 9px; left: 9px; z-index: 1; width: 24px; height: 24px; padding: 0; border: 1px solid #dfe0cb; border-radius: 8px; background: #fffdf3e8; font-size: 12px; line-height: 1; cursor: pointer; }
.hud-toggle:hover { background: #f1efdc; }
#map-wrap.collapsed { padding: 4px; }
#map-wrap.collapsed #minimap { display: none; }
#map-wrap.collapsed .hud-toggle { position: static; width: 30px; height: 30px; font-size: 15px; }

#quest { top: 148px; right: 12px; width: 160px; padding: 7px 10px; border-radius: 12px; cursor: pointer; background: #fffae9eb; }
#map-wrap.collapsed + #quest { top: 54px; }
#quest .quest-tag { font-size: 8.5px; }
#quest .quest-title { font-size: 12.5px; margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#quest .quest-desc, #quest .quest-reward { display: none; }
#quest.open { width: 210px; }
#quest.open .quest-title { white-space: normal; margin-bottom: 5px; }
#quest.open .quest-desc, #quest.open .quest-reward { display: block; }
#quest .quest-reward { margin-top: 6px; padding-top: 6px; font-size: 9.5px; }

#menu { bottom: 12px; padding: 5px; gap: 4px; border-radius: 16px; }
#menu button { min-width: 0; width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 18px; border-radius: 11px; }
#menu button span { display: none; }
#menu kbd { top: 1px; right: 3px; font-size: 7px; }
#menu button:hover { transform: translateY(-2px); }

#chat { bottom: 12px; left: 12px; width: 270px; padding: 7px; gap: 5px; border-radius: 14px; transition: background .5s, border-color .5s, box-shadow .5s; }
.chat-heading { display: none; }
#chat-log { height: 70px; font-size: 10.5px; line-height: 1.55; transition: opacity .5s; }
#chat-input { padding: 7px 9px; font-size: 11px; border-radius: 9px; transition: opacity .5s; }
#chat.idle:not(:hover):not(:focus-within) { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; }
#chat.idle:not(:hover):not(:focus-within) #chat-log { opacity: 0; }
#chat.idle:not(:hover):not(:focus-within) #chat-input { opacity: .7; }

#prompt { bottom: 68px; padding: 7px 15px 7px 8px; font-size: 11.5px; }
#toasts { top: 52px; }
#dialog { bottom: 66px; }
.fishing-hud { bottom: 112px; }

@media (max-width: 900px) {
  #hud-stats { width: 180px; padding: 8px 10px; }
  #hud-clock { left: auto; right: 12px; transform: none; gap: 6px; padding-left: 10px; }
  #hud-clock .weather-pill b, #clock-day { display: none; }
  #map-wrap, #quest { display: block; }
  #map-wrap { top: 52px; }
  #minimap { width: 120px !important; }
  #quest { top: 168px; width: 140px; }
  #map-wrap.collapsed + #quest { top: 92px; }
  #chat { width: min(260px, calc(100vw - 24px)); bottom: 62px; }
  #chat-log { height: 52px; }
  #menu button { width: 36px; height: 36px; font-size: 16px; }
  #menu kbd { display: none; }
  #prompt { bottom: 140px; }
  #toasts { top: 96px; }
}

/* Trong sảnh, quầy và NPC nằm ở nửa trên màn hình: đưa thông báo xuống dưới */
body.in-interior #toasts { top: auto; bottom: 112px; flex-direction: column-reverse; }
@media (max-width: 900px) { body.in-interior #toasts { bottom: 184px; } }

/* ---------- Lái xe & giao hàng ---------- */
#drive-hud { position: fixed; left: 12px; top: 128px; z-index: 12; width: 236px; padding: 10px 12px; border-radius: 14px; font-size: 12px; color: #4f6346; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
#drive-hud .drive-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; font-size: 13px; }
#drive-hud .drive-title b { color: #c0703f; }
#drive-hud .drive-steps { margin: 0; padding-left: 18px; line-height: 1.5; color: #9aa08c; }
#drive-hud .drive-steps li.done { color: #7aa36d; text-decoration: line-through; }
#drive-hud .drive-steps li.now { color: #3f5a35; font-weight: 800; }
#drive-hud .drive-light { padding: 5px 8px; border-radius: 9px; background: #f7d9d2; color: #b2463a; font-weight: 800; text-align: center; }
#drive-hud .drive-order b { display: block; font-size: 13px; }
#drive-hud .drive-order span { color: #7d8670; }
#drive-hud .drive-target { font-weight: 800; color: #b26b2b; }
#drive-hud .drive-late { color: #b2463a; font-weight: 700; }
#drive-hud small { font-size: 10.5px; line-height: 1.4; }
@media (max-width: 900px) { #drive-hud { top: 112px; width: 190px; } }

/* ---------- Nhu cầu vệ sinh ---------- */
.bar.need > div { background: linear-gradient(90deg, #a9cbe0, #8fb6d3); transition: width .6s; }
.bar.need > div.warn { background: linear-gradient(90deg, #f6d79b, #eab26b); }
.bar.need > div.urgent { background: linear-gradient(90deg, #ef9f86, #e07a5f); animation: needPulse 1s ease-in-out infinite alternate; }
.bar.need > span { font-size: 7.5px; line-height: 9px; }
@keyframes needPulse { from { opacity: .75; } to { opacity: 1; } }
.hud-wc { margin-top: 4px; padding: 4px 8px; border-radius: 9px; background: #eef5f1; color: #3f6f62; font-size: 10.5px; font-weight: 700; }
.hud-wc.urgent { background: #f9e0d8; color: #b2463a; }

/* ---------- Dự án công cộng ---------- */
.project-card { flex-wrap: wrap; align-items: flex-end; }
.project-card .pillar { align-items: center; gap: 8px; margin-top: 4px; }
.project-card .pillar small { margin-top: 0; flex: 1 1 200px; }
.project-card > div:first-child { flex: 1 1 320px; min-width: 0; }
.project-card > .row { flex: none; }
.project-card progress { margin-top: 6px; }

/* ---------- Bình xăng HUD & Luống nông nghiệp ---------- */
.drive-fuel { display: flex; flex-direction: column; gap: 3px; margin: 2px 0; }
.drive-fuel-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; color: #5b6d50; }
.drive-fuel-bar { height: 7px; border-radius: 99px; background: #e5e6d5; border: 1px solid #d5d8c2; overflow: hidden; }
.drive-fuel-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6ab070, #9cd07b); transition: width 0.25s ease; }
.drive-fuel-bar > div.low { background: linear-gradient(90deg, #e58e49, #f3b963); }
.drive-fuel-bar > div.empty { background: #d9534f; }

.farm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.farm-bed { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 12px 13px; border-radius: 14px; background: #f2f3e5; border: 1.5px solid #e0e3cf; }
.farm-bed.ripe { background: #f9f2d8; border-color: #dec98a; box-shadow: 0 3px 0 rgba(186, 150, 72, 0.14); }
.farm-bed-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* Mũi tên chỉ hướng tới điểm cần đến khi điểm đó nằm ngoài khung nhìn */
#target-arrow { position: fixed; z-index: 5; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255, 140, 50, 0.92); border: 2px solid #fff6e6; box-shadow: 0 3px 10px #0004; color: #fff; display: grid; place-items: center; pointer-events: none; }
#target-arrow[hidden] { display: none; }
#target-arrow .tip { position: absolute; font-size: 20px; line-height: 1; }
#target-arrow b { position: absolute; bottom: -18px; font: 800 11px "Be Vietnam Pro", sans-serif; color: #5a3b17; background: #fff6e6; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }

/* ---------- Điện thoại / máy tính bảng: điều khiển cảm ứng ---------- */
body.touch, body.touch canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.touch canvas { touch-action: none; }
#touch-ui { display: none; }
body.touch #touch-ui { display: block; position: fixed; inset: 0; z-index: 8; pointer-events: none; }
body.touch #touch-ui[data-mode="hidden"] { display: none; }
.tc-stick { position: absolute; left: calc(18px + env(safe-area-inset-left)); bottom: calc(92px + env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%; pointer-events: auto; touch-action: none;
  background: radial-gradient(circle, #fffdf3cc 0 34%, #fffdf38c 35% 100%); border: 2px solid #ffffffd9; box-shadow: 0 6px 18px #2c3a2433; }
.tc-stick.active { background: radial-gradient(circle, #fffdf3e6 0 34%, #fffdf3b3 35% 100%); }
.tc-knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: #7da668; border: 3px solid #fffdf3; box-shadow: 0 4px 10px #2c3a2459; transition: transform .06s linear; }
.tc-stick:not(.active) .tc-knob { transition: transform .15s ease-out; }
.tc-buttons { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(92px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; grid-template-areas: "chat full" "run act" "brake act"; gap: 10px; align-items: end; justify-items: end; }
.tc-btn { pointer-events: auto; touch-action: none; display: grid; place-items: center; border: 2px solid #fffdf3; border-radius: 50%; width: 60px; height: 60px; padding: 0; font: 800 22px/1 var(--display, inherit); color: #4f6346; background: #fffdf3e0; box-shadow: 0 4px 12px #2c3a2440; }
.tc-btn span { display: block; margin-top: -10px; font-size: 9px; font-weight: 800; color: #6b7a5c; }
.tc-btn:active, .tc-btn.held { transform: scale(.94); background: #f3ead2; }
.tc-small { width: 44px; height: 44px; font-size: 18px; }
.tc-chat { grid-area: chat; } .tc-full { grid-area: full; }
.tc-run { grid-area: run; } .tc-brake { grid-area: brake; }
.tc-run[aria-pressed="true"] { background: #7da668; color: #fffdf3; } .tc-run[aria-pressed="true"] span { color: #f1f7e6; }
.tc-act { grid-area: act; width: 84px; height: 84px; font-size: 30px; color: #fffdf3; background: #d79a52; border-color: #fff6e3; }
.tc-act span { margin-top: -18px; color: #fff6e3; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-act.ready { animation: tcPulse 1.2s ease-in-out infinite; }
@keyframes tcPulse { 50% { box-shadow: 0 0 0 8px #d79a5240, 0 4px 12px #2c3a2440; } }
#touch-ui[data-mode="walk"] .tc-brake, #touch-ui[data-mode="fish"] .tc-brake { visibility: hidden; }
#touch-ui[data-mode="drive"] .tc-run { visibility: hidden; }
body.touch:not(:fullscreen) .tc-full { opacity: .85; }

/* Bố cục HUD gọn cho màn hình cảm ứng */
body.touch #menu { max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; bottom: calc(8px + env(safe-area-inset-bottom)); }
body.touch #menu::-webkit-scrollbar { display: none; }
body.touch #menu button { min-width: 44px; padding: 5px 4px; }
body.touch #menu button span, body.touch #menu kbd { display: none; }
body.touch #chat { display: none; }
body.touch.chat-open #chat { display: flex; top: 12px; bottom: auto; left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); z-index: 9; }
body.touch.chat-open #chat-log { height: 110px; }
body.touch #prompt { left: calc(12px + env(safe-area-inset-left)); transform: none; bottom: calc(236px + env(safe-area-inset-bottom)); max-width: calc(100vw - 150px); white-space: normal; font-size: 12px; }
@media (max-width: 520px) { body.touch #quest { display: none; } }
body.touch .fishing-hud { bottom: 240px; }
@media (max-height: 520px) {
  body.touch #hud-stats { transform: scale(.68); transform-origin: top left; }
  body.touch #hud-clock { transform: scale(.85); transform-origin: top right; }
  body.touch #quest { display: none; }
  body.touch #drive-hud { top: 84px; width: 200px; transform: scale(.8); transform-origin: top left; }
  body.touch .tc-stick { bottom: calc(40px + env(safe-area-inset-bottom)); width: 108px; height: 108px; }
  body.touch .tc-knob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  body.touch #menu { max-width: calc(100vw - 280px); }
  body.touch .tc-buttons { bottom: calc(70px + env(safe-area-inset-bottom)); grid-template-columns: auto auto auto; grid-template-areas: "chat run act" "full brake act"; }
  body.touch .tc-btn:not(.tc-small):not(.tc-act) { width: 52px; height: 52px; font-size: 19px; }
  body.touch .tc-act { width: 76px; height: 76px; }
  body.touch #prompt { bottom: calc(160px + env(safe-area-inset-bottom)); }
}

/* Ô chat + nút Gửi (điện thoại không có phím Enter) */
#chat-form { display: flex; gap: 6px; align-items: stretch; margin: 0; }
#chat-form #chat-input { flex: 1; min-width: 0; }
#chat-send { flex: none; padding: 0 12px; border: 0; border-radius: 9px; background: var(--accent, #2f9e6b); color: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: opacity .5s; }
#chat-send:active { transform: translateY(1px); }
#chat.idle:not(:hover):not(:focus-within) #chat-send { opacity: .7; }
body.touch #chat-send { min-width: 64px; min-height: 40px; font-size: 14px; }
body.touch #chat-input { font-size: 16px; }

/* Ô dán link YouTube (sân vận động, phòng VIP) */
.modal-body textarea, .field textarea { width: 100%; box-sizing: border-box; min-height: 72px; resize: vertical; padding: 10px 12px; border: 1.5px solid #dedfce; border-radius: 12px; background: #f6f4ea; color: var(--text); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: text; }
