* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a8d0e6; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: #f4f4f4; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
.panel, #hud, #help, #chatlog, #bigmap { background: rgba(15, 25, 35, 0.78); border-radius: 10px; backdrop-filter: blur(4px); }
.small { font-size: 12px; opacity: 0.8; }

#start { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
#start h1 { margin: 0; font-size: 26px; }
#start .sub { margin: 0; opacity: 0.85; }
#start label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#start input[type=text], #start input:not([type]) { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid #567; background: #1d2b38; color: #fff; }
#start button { padding: 10px; font-size: 16px; border: 0; border-radius: 6px; background: #2f9e6e; color: #fff; cursor: pointer; }
#start button:disabled { background: #556; cursor: wait; }

#hud { position: fixed; top: 12px; left: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-width: 300px; }
#stats { white-space: pre-line; font-variant-numeric: tabular-nums; }
#modes { display: flex; gap: 4px; }
#modes button { flex: 1; padding: 6px 4px; border: 1px solid #567; border-radius: 6px; background: #1d2b38; color: #ddd; cursor: pointer; font-size: 12px; }
#modes button.on { background: #2f9e6e; border-color: #2f9e6e; color: #fff; }
#goto { padding: 6px; border-radius: 6px; background: #1d2b38; color: #fff; border: 1px solid #567; }
#online { font-size: 12px; opacity: 0.85; }

#minimap { position: fixed; top: 12px; right: 12px; width: 220px; height: 220px; border-radius: 50%; border: 3px solid rgba(15, 25, 35, 0.8); background: #1c4d80; }
#bigmap { position: fixed; inset: 40px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#bigcanvas { flex: 1; min-height: 0; max-width: 100%; cursor: crosshair; border-radius: 6px; }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; padding: 2px 6px; border-radius: 4px; background: rgba(15, 25, 35, 0.7); font-size: 12px; }
.label.poi { color: #ffe08a; }
.label.player { font-weight: 600; }
.label .bubble { display: block; margin-top: 2px; font-weight: 400; color: #fff; max-width: 220px; white-space: normal; }

#chatlog { position: fixed; left: 12px; bottom: 56px; width: min(360px, calc(100% - 24px)); max-height: 160px; overflow-y: auto; padding: 8px 10px; font-size: 13px; }
#chatbox { position: fixed; left: 12px; bottom: 16px; width: min(360px, calc(100% - 24px)); padding: 8px; border-radius: 6px; border: 1px solid #567; background: rgba(15, 25, 35, 0.9); color: #fff; }
#help { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 8px 14px; font-size: 12px; text-align: center; max-width: calc(100% - 24px); }
#credit { position: fixed; right: 8px; bottom: 4px; font-size: 10px; color: #234; opacity: 0.8; }

@media (max-width: 700px) {
  #minimap { width: 130px; height: 130px; }
  #help { display: none; }
}
#chatlog:empty { display: none; }
#modes button:disabled { opacity: 0.45; cursor: default; }
#modes button.on:disabled { opacity: 1; background: #2b78b8; border-color: #2b78b8; }
#follow { padding: 6px; border: 0; border-radius: 6px; background: #c9852b; color: #fff; cursor: pointer; }
.label.poi.port { color: #9fd8ff; }
#bigcanvas { cursor: grab; touch-action: none; }
#labels { z-index: 1; }
#hud, #minimap, #bigmap, #chatlog, #chatbox, #help, #start { z-index: 2; }
#hud { max-width: 340px; }
#garage { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 12px; }
#garage label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#garage select { flex: 1; max-width: 210px; padding: 4px; border-radius: 6px; background: #1d2b38; color: #fff; border: 1px solid #567; }
#garage input[type=color] { width: 44px; height: 24px; border: 0; background: none; }
#ridebtn { width: 100%; padding: 7px; border: 0; border-radius: 6px; background: #2b78b8; color: #fff; cursor: pointer; font-weight: 600; }
.label .riders { display: block; font-size: 11px; font-weight: 400; color: #ffe08a; }
.label .riders:empty { display: none; }
#compassbox { position: fixed; top: 242px; right: 12px; width: 220px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
#compass { position: relative; width: 74px; height: 74px; border-radius: 50%; background: rgba(15, 25, 35, 0.8); border: 2px solid rgba(255, 255, 255, 0.35); cursor: pointer; }
#dial { position: absolute; inset: 0; transition: transform 0.08s linear; }
#dial b { position: absolute; font-size: 12px; width: 18px; text-align: center; margin-left: -9px; }
#dial .n { top: 3px; left: 50%; color: #ff5a4a; } #dial .s { bottom: 3px; left: 50%; }
#dial .e { right: 3px; top: 50%; margin-top: -8px; margin-left: 0; } #dial .w { left: 3px; top: 50%; margin-top: -8px; margin-left: 0; }
#dial i { position: absolute; left: 50%; top: 18px; width: 0; height: 0; margin-left: -6px; border: 6px solid transparent; border-bottom: 18px solid #ff5a4a; border-top: 0; }
#compass .needle { position: absolute; left: 50%; top: -6px; margin-left: -5px; border: 5px solid transparent; border-top: 8px solid #ffd966; }
#heading { font-size: 12px; background: rgba(15, 25, 35, 0.75); padding: 2px 8px; border-radius: 4px; }
#chasebtn { padding: 4px 8px; border: 1px solid #567; border-radius: 6px; background: #1d2b38; color: #fff; font-size: 12px; cursor: pointer; }
@media (max-width: 700px) { #compassbox { top: 150px; width: 130px; } }
#dial b { transform: rotate(var(--upright, 0deg)); }
#mapbtn { padding: 7px; border: 0; border-radius: 6px; background: #3a6ea5; color: #fff; cursor: pointer; }
#destbar { display: flex; gap: 8px; align-items: center; width: 100%; flex-wrap: wrap; }
#destinfo { flex: 1; min-width: 200px; font-size: 13px; }
#gobtn { padding: 8px 14px; border: 0; border-radius: 6px; background: #e08a1e; color: #fff; font-weight: 700; cursor: pointer; }
#gobtn:disabled { background: #556; cursor: default; }
#closemap { padding: 8px 12px; border: 1px solid #567; border-radius: 6px; background: #1d2b38; color: #fff; cursor: pointer; }
#rotbar { display: flex; align-items: center; gap: 6px; }
#rotbar button { width: 30px; height: 26px; border: 1px solid #567; border-radius: 6px; background: #1d2b38; color: #fff; cursor: pointer; font-size: 15px; touch-action: none; }
#compass { touch-action: none; }
#bigmap { z-index: 3; }
#viewbar { display: flex; border: 1px solid #567; border-radius: 6px; overflow: hidden; }
#viewbar button { padding: 4px 12px; border: 0; background: #1d2b38; color: #aab; font-size: 12px; font-weight: 700; cursor: pointer; }
#viewbar button.on { background: #3a6ea5; color: #fff; }
#destmark { position: absolute; inset: 0; pointer-events: none; }
#destmark::before { content: ''; position: absolute; left: 50%; top: -2px; margin-left: -5px; border: 5px solid transparent; border-bottom: 10px solid #ffb02e; border-top: 0; }
#modes { flex-wrap: wrap; }
#modes button { flex: 1 0 30%; }
#helpbtn { margin-left: 8px; padding: 3px 10px; border: 1px solid #567; border-radius: 6px; background: #3a6ea5; color: #fff; font-size: 12px; cursor: pointer; }
#helpfull { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 40px); overflow: auto; padding: 14px 18px; font-size: 13px; }
#helpfull h3 { margin: 0 0 8px; }
#helpfull table { width: 100%; border-collapse: collapse; }
#helpfull th { text-align: left; padding: 10px 0 4px; color: #9fd8ff; font-size: 12px; text-transform: uppercase; }
#helpfull td { padding: 3px 8px 3px 0; vertical-align: top; }
#helpfull td:first-child { white-space: nowrap; width: 1%; }
#closehelp { margin-top: 10px; padding: 6px 16px; border: 1px solid #567; border-radius: 6px; background: #1d2b38; color: #fff; cursor: pointer; float: right; }
