* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: #222; }

#app { display: flex; height: 100vh; }

#map-region { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

#zoom-indicator { position: absolute; bottom: 12px; left: 12px; z-index: 500; background: rgba(255,255,255,0.92); padding: 4px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 12px; font-weight: 600; color: #555; user-select: none; }

#draw-status { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 500; background: #f60; color: #fff; padding: 8px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,0.25); pointer-events: none; }

#circle-overlay { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1000; background: #fff; border: 1px solid #bbb; border-radius: 6px; padding: 12px 14px; box-shadow: 0 4px 14px rgba(0,0,0,0.18); width: 260px; }
#circle-overlay #ov-name { width: 100%; font: inherit; font-size: 15px; font-weight: 500; padding: 4px 6px; border: 1px solid #06c; border-radius: 3px; box-sizing: border-box; margin-bottom: 8px; }
#circle-overlay .ov-row { display: flex; justify-content: space-between; font-size: 12px; padding: 2px 0; color: #444; }
#circle-overlay .ov-label { color: #888; }
#toolbar { display: flex; gap: 8px; padding: 8px 12px; background: #f4f4f4; border-bottom: 1px solid #ddd; }
.tb-btn { padding: 6px 14px; background: #fff; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; }
.tb-btn:hover { background: #eee; }
.tb-btn.is-active { background: #06c; color: #fff; border-color: #06c; }
#map { flex: 1; }

#list-panel { width: 220px; border-left: 1px solid #ddd; background: #fafafa; display: flex; flex-direction: column; }
#list-header { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid #ddd; background: #f4f4f4; }
#circle-list { list-style: none; overflow-y: auto; flex: 1; }

.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #eee; }
.row.locked { background: #f0f0f0; color: #888; }
.row.selected { background: #fff3d6; border-left: 3px solid #f60; padding-left: 9px; }
.row.is-dragging { opacity: 0.5; }

.radius-tooltip { background: #fff; border: 1px solid #f60; color: #f60; font-weight: 600; font-size: 12px; padding: 2px 8px; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.radius-tooltip::before { display: none; }

.priority { background: #e0e0e0; color: #555; border-radius: 10px; padding: 2px 0; font-size: 12px; font-weight: 600; width: 32px; text-align: center; cursor: grab; user-select: none; flex-shrink: 0; }
.priority:active { cursor: grabbing; }
.priority-spacer { width: 32px; flex-shrink: 0; }
.name { width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; cursor: text; flex-shrink: 0; }
.name-input { width: 90px; font: inherit; padding: 1px 4px; border: 1px solid #06c; border-radius: 3px; box-sizing: border-box; flex-shrink: 0; }
.username { color: #888; font-size: 12px; flex: 0 0 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.circle-label { background: transparent; border: none; box-shadow: none; color: #222; font-weight: 600; font-size: 11px; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }

#help-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; }
#help-overlay-content { background: #fff; border-radius: 8px; padding: 24px 32px; width: min(640px, 90vw); max-height: 80vh; overflow-y: auto; position: relative; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
#help-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: #888; padding: 4px 8px; }
#help-close:hover { color: #333; }
#help-content h1 { font-size: 1.5em; margin: 0 0 0.5em; }
#help-content h2 { font-size: 1.15em; margin: 1em 0 0.4em; padding-top: 0.4em; border-top: 1px solid #eee; }
#help-content h2:first-of-type { border-top: none; padding-top: 0; }
#help-content h3 { font-size: 1.05em; margin: 0.8em 0 0.3em; }
#help-content p { margin: 0.5em 0; line-height: 1.5; }
#help-content ul, #help-content ol { padding-left: 1.5em; margin: 0.5em 0; }
#help-content li { margin: 0.3em 0; line-height: 1.45; }
#help-content code { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
#help-content strong { font-weight: 600; }

#user-indicator { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #555; }
#user-name { font-weight: 500; }
#signOutBtn { background: transparent; color: #06c; border: none; padding: 4px 6px; font-size: 13px; cursor: pointer; text-decoration: underline; font-family: inherit; }
#signOutBtn:hover { color: #058; }

#login-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #f4f4f4; z-index: 3000; display: flex; align-items: center; justify-content: center; }
#login-box { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 28px 36px; width: min(380px, 90vw); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
#login-box h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; color: #222; }
.login-hint { margin: 0 0 18px; font-size: 13px; color: #666; }
#login-form label { display: block; font-size: 13px; font-weight: 500; margin-top: 12px; margin-bottom: 4px; color: #444; }
#login-form input { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
#login-form input:focus { outline: none; border-color: #06c; }
#login-submit { margin-top: 20px; width: 100%; padding: 10px; background: #06c; color: #fff; border: none; border-radius: 4px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
#login-submit:hover:not(:disabled) { background: #058; }
#login-submit:disabled { background: #999; cursor: not-allowed; }
#login-error { margin-top: 12px; padding: 8px 10px; background: #ffeaea; color: #b00; border-radius: 4px; font-size: 13px; border: 1px solid #f5c2c2; }
