* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #22303c; font-family: system-ui, "Microsoft JhengHei", "PingFang TC", sans-serif; font-size: 14px; color: #f2f2f2; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; }
.panel { position: fixed; background: rgba(20, 28, 36, 0.88); border-radius: 10px; padding: 8px 10px; }
#top { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
#title { color: #ffd76a; font-size: 16px; }
#goal { color: #9fd3ff; }
.up { color: #7be07b; }
.down { color: #ff8a7a; }
#side { right: 8px; top: calc(96px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 8px; width: 150px; }
#speeds { display: flex; flex-direction: column; gap: 4px; }
#side label { display: flex; flex-direction: column; gap: 2px; }
#tools { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); display: flex; gap: 6px; overflow-x: auto; }
button { font: inherit; color: #f2f2f2; background: #33424f; border: 2px solid transparent; border-radius: 8px; padding: 8px 10px; white-space: nowrap; cursor: pointer; }
button.on { border-color: #ffd76a; background: #46596b; }
#toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.82); padding: 12px 18px; border-radius: 10px; font-size: 16px; opacity: 0; pointer-events: none; transition: opacity 0.3s; text-align: center; max-width: 90%; }
#toast.show { opacity: 1; }
@media (max-width: 600px) {
  #side { top: auto; bottom: calc(68px + env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; }
  #speeds { flex-direction: row; }
  #side button { padding: 6px 8px; }
  #side label { flex: 1; min-width: 60px; }
  #top { font-size: 13px; gap: 2px 12px; }
}
button:disabled { opacity: 0.4; cursor: default; }
[hidden] { display: none !important; }
#saveStatus { color: #c9d3dc; }
#gate { position: fixed; inset: 0; background: rgba(15, 22, 30, 0.82); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.card { background: #24323f; border-radius: 14px; padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.card h1 { margin: 0; font-size: 22px; text-align: center; }
.card p { margin: 0; line-height: 1.5; }
.card form, #slots, #slotList { display: flex; flex-direction: column; gap: 10px; }
.card label { display: flex; flex-direction: column; gap: 4px; }
.card input { font: inherit; font-size: 16px; padding: 10px; border-radius: 8px; border: 1px solid #55697b; background: #16202a; color: #f2f2f2; -webkit-user-select: text; user-select: text; }
button.primary { background: #e0a93a; color: #1c1c1c; font-weight: bold; padding: 12px; }
#slotList button { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px; white-space: normal; text-align: left; }
#slotList span { color: #c9d3dc; }
#advice { flex-basis: 100%; color: #ffe9a8; }
button.locked { opacity: 0.45; }
#info { left: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); max-width: min(360px, calc(100% - 16px)); padding: 10px 40px 10px 12px; line-height: 1.6; }
#infoTitle { color: #ffd76a; font-size: 16px; }
#infoClose { position: absolute; top: 6px; right: 6px; padding: 2px 8px; }
@media (max-width: 600px) { #info { bottom: calc(142px + env(safe-area-inset-bottom)); } }
#toast { white-space: pre-line; }
