:root {
    --primary: #5b3c88;
    --primary-dark: #432a6a;
    --accent: #f0a830;
    --bg: #f5f5f7;
    --text: #1a1a1a;
    --text-muted: #666;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    --header-h: 56px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow: hidden;
}

/* ===== ヘッダー ===== */
#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

#app-header h1 {
    font-size: 16px;
    margin: 0;
    flex: 0 0 auto;
    font-weight: 600;
}

.header-controls {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.header-controls button {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.header-controls button:active {
    background: rgba(255, 255, 255, 0.3);
}

#filter-btn .icon {
    font-size: 10px;
}

#filter-label {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 現在地ボタン（FAB） ===== */
#locate-btn {
    position: fixed;
    right: 16px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

#locate-btn:active {
    background: var(--primary-dark);
    transform: scale(0.95);
}

#locate-btn .icon {
    font-size: 26px;
    line-height: 1;
}

/* ===== マップ ===== */
#map {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: #ddd;
}

/* ===== フィルタパネル ===== */
#filter-panel {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#filter-panel[hidden] {
    display: none;
}

.filter-panel-inner {
    background: #fff;
    width: 100%;
    max-width: 600px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.filter-panel-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.filter-panel-header span {
    flex: 1;
}

#filter-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
}

#store-search {
    margin: 12px 16px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.filter-options {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    -webkit-overflow-scrolling: touch;
}

.filter-options label {
    display: flex;
    align-items: center;
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
}

.filter-options label:active {
    background: #f0f0f0;
}

.filter-options input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
}

.filter-options .count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.filter-actions button {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.filter-actions button.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}

/* ===== ステータスバー ===== */
#status-bar {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 16px;
    z-index: 900;
    pointer-events: none;
    transition: opacity 0.3s;
}

#status-bar.hidden {
    opacity: 0;
}

/* ===== ポップアップ ===== */
.leaflet-popup-content {
    margin: 12px 14px;
    font-size: 14px;
    min-width: 200px;
}

.popup-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.popup-row {
    display: flex;
    gap: 6px;
    margin: 4px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.popup-row .label {
    flex: 0 0 56px;
    color: var(--text-muted);
}

.popup-row .value {
    flex: 1;
    color: var(--text);
}

.popup-row a {
    color: var(--primary);
    text-decoration: none;
}

.popup-row.precision {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: var(--text-muted);
}

.popup-warning {
    background: #fff8e1;
    border-left: 4px solid #f0a830;
    padding: 8px 10px;
    margin: 8px 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #614a00;
    border-radius: 4px;
}

.popup-warning strong {
    color: #4d3a00;
}

.popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.popup-actions a {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

/* ===== 現在位置マーカー ===== */
.current-location-marker {
    width: 18px;
    height: 18px;
    background: #4285f4;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== Leaflet調整 ===== */
.leaflet-control-attribution {
    font-size: 10px;
}

.leaflet-touch .leaflet-bar a {
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 20px;
}
