:root {
  --accent: #ffb300;
  --accent2: #00acc1;
  --panel: rgba(12, 22, 34, 0.86);
  --text: #f4f7fb;
  --muted: #a9b6c6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1622; color: var(--text); font: 15px/1.45 "Segoe UI", system-ui, Roboto, sans-serif; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.glass { background: rgba(5, 12, 20, 0.45); backdrop-filter: blur(3px); }
/* màn hình rộng: bảng bắt đầu lệch trái, không làm mờ / phủ tối vùng nhân vật bên phải */
@media (min-width: 900px) {
  #startPanel.glass { justify-content: flex-start; padding-left: 5vw; backdrop-filter: none; background: linear-gradient(90deg, rgba(5,12,20,.62) 0%, rgba(5,12,20,.35) 45%, rgba(5,12,20,0) 62%); }
}
#loading { background: radial-gradient(circle at 50% 40%, #134e6f, #06121d 70%); z-index: 30; }
.load-box { width: min(460px, 100%); text-align: center; }
h1 { font-size: 40px; margin: 0 0 14px; letter-spacing: 1px; text-shadow: 0 3px 12px rgba(0,0,0,.5); }
h1 span { color: var(--accent); font-weight: 300; }
.bar { height: 8px; background: rgba(255,255,255,.12); border-radius: 99px; overflow: hidden; }
#loadBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .2s; }
#loadText { color: var(--muted); }

.panel { background: var(--panel); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 24px 28px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.panel.start { text-align: center; }
.panel h2 { margin: 0 0 14px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); }
.lead { color: #d5dee9; }
.controls { text-align: left; margin: 16px 0 20px; display: grid; gap: 6px; font-size: 14px; color: #dbe4ee; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px; border-radius: 5px; background: #24384d; border: 1px solid #3c5670; border-bottom-width: 2px; font: 12px/1.5 Consolas, monospace; text-align: center; color: #fff; }
.hint { color: var(--muted); font-size: 12px; margin-bottom: 0; }

.btn { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 9px 16px; background: #2b4157; color: #fff; }
.btn:hover { filter: brightness(1.15); }
.btn.big { width: 100%; padding: 14px; font-size: 18px; font-weight: 600; background: linear-gradient(90deg, #00a3b8, #ff9f1c); }
.btn.small { padding: 6px 12px; font-size: 13px; }

.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 18px; }
.settings label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.settings label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.settings select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid #3c5670; background: #172636; color: #fff; }

.place-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.place-list li { display: flex; align-items: center; gap: 6px; }
.place-list button { flex: 1; text-align: left; font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid #2f475f; background: #142231; color: #e6edf5; cursor: pointer; }
.place-list button:hover, .place-list button.active { border-color: var(--accent); }
.place-list li.found button { background: #173a2a; }
.place-list span { color: #66bb6a; width: 14px; }

.map-wrap { width: min(1500px, 100%); height: min(96vh, 1100px); display: flex; flex-direction: column; background: var(--panel); border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.map-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.map-head span { color: var(--muted); font-size: 13px; flex: 1; }
.map-canvas { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 6px; }
#bigmap { border-radius: 8px; cursor: grab; width: 100%; height: 100%; display: block; }
#bigmap:active { cursor: grabbing; }
.map-canvas { position: relative; }
.map-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.map-tools button { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid #3c5670; background: #172636; color: #e6edf5; cursor: pointer; min-width: 34px; }
.map-tools button:hover { border-color: #5b85ad; }
.map-tools .seg { display: inline-flex; gap: 0; }
.map-tools .seg button { border-radius: 0; margin-left: -1px; }
.map-tools .seg button:first-child { border-radius: 8px 0 0 8px; }
.map-tools .seg button:last-child { border-radius: 0 8px 8px 0; }
.map-tools button.on { background: #1f6f99; border-color: #4fb3e8; font-weight: 700; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; text-shadow: 0 1px 4px rgba(0,0,0,.8); }
#hud .tl { position: absolute; left: 16px; top: 14px; display: grid; gap: 6px; }
#hud .tr { position: absolute; right: 16px; top: 14px; text-align: right; }
#progress, #wpInfo, #zone { background: rgba(0,0,0,.42); padding: 5px 12px; border-radius: 8px; font-size: 14px; }
#wpInfo { display: none; color: #ffe066; }
#wpInfo.show { display: block; }
#clock { font: 600 28px/1 "Segoe UI", sans-serif; }
#weatherHud { font: 500 13px/1.2 "Segoe UI", sans-serif; margin-top: 5px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
#fps { font-size: 11px; color: var(--muted); margin-top: 4px; }
#hud .bl { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#minimap { width: 210px; height: 210px; border-radius: 50%; border: 3px solid rgba(255,255,255,.75); box-shadow: 0 4px 18px rgba(0,0,0,.5); }
#speed { position: absolute; right: 24px; bottom: 22px; font: 700 54px/1 "Segoe UI", sans-serif; display: none; }
#speed small { font-size: 18px; font-weight: 400; }
#speed.show { display: block; }
#prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 8px 18px; border-radius: 10px; font-size: 16px; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#prompt.show { opacity: 1; }
#toast { position: absolute; top: 70px; left: 50%; transform: translate(-50%, -20px); width: min(520px, calc(100% - 32px)); background: rgba(10, 24, 38, .9); border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 10px; opacity: 0; transition: all .35s; text-shadow: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast b { font-size: 18px; color: var(--accent); }
#toast p { margin: 6px 0 0; color: #dbe4ee; font-size: 14px; white-space: pre-line; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(255,255,255,.5); }
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s; z-index: 20; }
#fade.on { opacity: 1; }

/* ---- v2: thiết lập, nhiệm vụ, hộ chiếu, chat, cảm ứng ---- */
.panel.wide { width: min(860px, 100%); }
.setup { display: grid; gap: 10px; margin: 14px 0 6px; text-align: left; }
.setup label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.setup label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.setup input[type=text], .setup input:not([type]) { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid #3c5670; background: #172636; color: #fff; }
.avatars { display: flex; gap: 10px; }
.avatars label { flex: 1; flex-direction: row !important; align-items: center; justify-content: center; gap: 6px; padding: 8px; border: 1px solid #3c5670; border-radius: 10px; cursor: pointer; color: var(--text) !important; }
.avatars input:checked + span { color: var(--accent); font-weight: 700; }
/* chọn điểm xuất phát */
.startpick { display: flex; flex-direction: column; gap: 6px; }
.startpick .lbl { font-size: 13px; color: var(--muted); }
.startpick .lbl small { color: var(--accent); margin-left: 6px; }
.start-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 172px; overflow-y: auto; padding-right: 2px; }
.start-list button { display: flex; align-items: center; gap: 6px; text-align: left; font: inherit; font-size: 13px; line-height: 1.2; padding: 7px 9px; border-radius: 9px; border: 1px solid #3c5670; background: #172636; color: var(--text); cursor: pointer; }
.start-list button:hover { border-color: #5b85ad; }
.start-list button.active { border-color: var(--accent); color: var(--accent); font-weight: 700; background: #1f3346; }
.start-list button i { font-style: normal; font-size: 16px; }
code { background: #24384d; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
#mission { background: rgba(0,0,0,.45); padding: 7px 12px; border-radius: 8px; font-size: 13px; max-width: 340px; border-left: 3px solid var(--accent); }
#mission b { color: var(--accent); display: block; font-size: 14px; }
#mission small { color: var(--muted); display: block; margin-top: 3px; }
#online { font-size: 12px; color: #9be7ff; margin-top: 4px; }
#chatLog { display: flex; flex-direction: column; gap: 3px; max-width: 360px; font-size: 13px; }
#chatLog div { background: rgba(0,0,0,.5); padding: 3px 9px; border-radius: 6px; transition: opacity 1s; }
#chatLog div.old { opacity: .35; }
#chatLog div.mine b { color: var(--accent); }
#chatLog b { color: #9be7ff; }
#chatInput { position: fixed; left: 16px; bottom: 250px; width: min(420px, calc(100% - 32px)); z-index: 12; font: inherit; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--accent); background: rgba(10,20,30,.9); color: #fff; }
.journal-head { display: flex; align-items: center; gap: 14px; }
.journal-head h2 { margin: 0; flex: 1; }
#pointsTotal { color: var(--accent); font-weight: 700; }
.mission-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mission-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: #142231; border: 1px solid #2f475f; cursor: pointer; }
.mission-list li:hover { border-color: var(--accent); }
.mission-list li.done { background: #173a2a; opacity: .85; }
.mission-list li span { color: #66bb6a; width: 16px; }
.mission-list li div { flex: 1; }
.mission-list li p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.mission-list li em { color: var(--accent); font-style: normal; font-weight: 700; }
.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 2px dashed #3c5670; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 10px; color: var(--muted); padding: 6px; filter: grayscale(1); opacity: .5; }
.stamp i { font-style: normal; font-size: 24px; }
.stamp.got { border: 3px double #e53935; color: #ffcdd2; filter: none; opacity: 1; transform: rotate(-8deg); background: rgba(229,57,53,.08); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; color: var(--muted); font-size: 13px; }
.photos img { width: 100%; border-radius: 4px; display: block; box-shadow: 0 3px 10px rgba(0,0,0,.4); }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 19; }
#flash.on { animation: flash .45s ease-out; }
@keyframes flash { from { opacity: .85; } to { opacity: 0; } }
#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#touch .look { position: absolute; right: 0; top: 0; width: 55%; height: 100%; pointer-events: auto; }
#touch .stick { position: absolute; left: 28px; bottom: 34px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35); pointer-events: auto; }
#touch .knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.55); }
#touch .btns { position: absolute; right: 14px; bottom: 18px; display: grid; grid-template-columns: repeat(3, 56px); gap: 8px; pointer-events: auto; }
#touch .btns button { width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(10,20,30,.45); color: #fff; font-size: 22px; }
#touch .btns button.on { background: rgba(255,179,0,.7); }
#tourCap { position: fixed; left: 50%; bottom: 7vh; transform: translateX(-50%); z-index: 9; width: min(640px, calc(100% - 32px)); text-align: center; padding: 14px 20px; border-radius: 14px; background: linear-gradient(0deg, rgba(5,12,20,.78), rgba(5,12,20,.45)); text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none; }
#tourCap b { font-size: 24px; color: var(--accent); }
#tourCap p { margin: 6px 0 8px; font-size: 15px; color: #e8eef5; }
#tourCap small { color: #aab7c6; }
/* cửa sổ thấp (máy tính 800×600, laptop nhỏ): thu minimap, menu gọn hơn để không phải cuộn */
@media (max-height: 640px) and (pointer: fine) {
  #minimap { width: 140px; height: 140px; border-width: 2px; }
  .panel { padding: 14px 20px; }
  .panel h2 { margin-bottom: 8px; }
  .panel h3 { margin: 10px 0 6px; }
  h1 { font-size: 30px; margin-bottom: 8px; }
}
/* máy tính, cửa sổ vừa: thông báo nổi nằm bên phải cột nhiệm vụ để không che mục tiêu */
@media (pointer: fine) and (min-width: 700px) and (max-width: 1500px) {
  #toast { left: calc(430px + (100% - 430px) / 2); width: min(520px, calc(100% - 460px)); }
}
@media (pointer: coarse) {
  .desktop-only { display: none; }
  #hud .bl { left: auto; right: 12px; top: 64px; bottom: auto; align-items: flex-end; }
  #minimap { width: 112px; height: 112px; border-width: 2px; }
  #zone, #fps { display: none; }
  #clock { font-size: 20px; }
  #mission { max-width: 240px; font-size: 12px; padding: 5px 10px; }
  #mission div, #mission small { display: none; }
  #progress, #wpInfo { font-size: 12px; padding: 4px 10px; }
  #toast { top: 8px; width: min(420px, 56%); padding: 8px 12px; }
  #toast b { font-size: 14px; }
  #toast p { font-size: 12px; }
  #speed { right: 200px; bottom: 26px; font-size: 32px; }
  #prompt { bottom: 64px; font-size: 14px; }
  #touch .btns { grid-template-columns: repeat(3, 50px); gap: 7px; }
  #touch .btns button { width: 50px; height: 50px; font-size: 19px; }
  #touch .stick { left: 22px; bottom: 22px; width: 120px; height: 120px; }
  #touch .knob { left: 35px; top: 35px; }
  #chatLog { display: none; }
}

@media (max-width: 700px) {
  h1 { font-size: 30px; }
  #minimap { width: 140px; height: 140px; }
  .settings, .place-list { grid-template-columns: 1fr; }
  #speed { font-size: 38px; }
}

/* ---- tủ đồ / cửa hàng thời trang */
#money { font: 600 15px/1 "Segoe UI", sans-serif; color: #ffe08a; margin-top: 6px; transition: transform .25s, color .25s; }
#money.gain { transform: scale(1.25); color: #9cff9c; }
.dress { position: fixed; right: 16px; top: 16px; bottom: 16px; width: min(440px, calc(100% - 32px)); z-index: 12; display: flex; flex-direction: column; gap: 8px;
  background: rgba(12, 24, 36, .92); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; padding: 14px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); color: var(--text); }
.dress-head { display: flex; align-items: center; gap: 10px; }
.dress-head b { flex: 1; font-size: 17px; }
.dress-money { color: #ffe08a; font-weight: 600; white-space: nowrap; }
.dress-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.dress-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dress-row .lbl { font-size: 12px; color: var(--muted); width: 74px; }
.chip { font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid #3c5670; background: #172636; color: var(--text); cursor: pointer; }
.chip:hover { border-color: #5b85ad; }
.chip.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.dress-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid #2c4258; padding-bottom: 6px; }
.dress-tabs .tab { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 0; background: transparent; color: #c9d6e3; cursor: pointer; }
.dress-tabs .tab.on { background: #24425f; color: #fff; font-weight: 600; }
.dress-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; align-content: start; padding-right: 2px; }
.dress-grid .card { background: #172636; border: 2px solid #2c4258; border-radius: 12px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.dress-grid .card:hover { border-color: #5b85ad; }
.dress-grid .card.on { border-color: var(--accent); }
.dress-grid .card .pic { height: 64px; border-radius: 8px; background: #2a3b4d center/cover; display: flex; align-items: center; justify-content: center; font-size: 30px; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.dress-grid .card .nm { font-size: 12.5px; line-height: 1.25; min-height: 31px; }
.dress-grid .card .st { font-size: 12px; color: var(--muted); }
.dress-grid .card.on .st { color: var(--accent); font-weight: 600; }
.dress-grid .card.locked .st { color: #ffe08a; }
.dress-grid .card .buy { width: 100%; background: linear-gradient(90deg, #00a3b8, #2bb673); }
.dress-grid .card .buy:disabled { background: #33414f; color: #8b99a8; cursor: not-allowed; }
.dress-foot { display: flex; align-items: center; gap: 8px; }
.dress-foot .dress-hint { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.style-list { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 700px) {
  .dress { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 56vh; padding: 10px 12px; }
  .dress-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .dress-foot .dress-hint { display: none; }
}

/* --- bản phát hành --- */
#fps { display: none; }
body.debug #fps { display: block; }
#fatal { z-index: 100; }
.setupbox { margin: 10px 0 4px; text-align: left; }
.setupbox summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.photo { display: flex; flex-direction: column; gap: 4px; }
.photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.credits { max-height: 88vh; overflow: auto; text-align: left; }
.credits ul { padding-left: 18px; line-height: 1.5; font-size: 14px; }
.credits li { margin-bottom: 8px; }
.credits a, .hint a { color: #8fd3f4; }
#disclaimer { display: block; margin-top: 6px; opacity: .8; }
