:root {
    --surface: rgba(255, 255, 255, 0.94);
    --surface-solid: #ffffff;
    --text: #1d2330;
    --muted: #677084;
    --line: rgba(29, 35, 48, 0.1);
    --accent: #e8590c;
    --shadow: 0 6px 24px rgba(20, 28, 45, 0.14), 0 1px 3px rgba(20, 28, 45, 0.08);
    --radius: 14px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: #eff1f4;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

#map {
    inset: 0;
    position: absolute;
}

[hidden] {
    display: none !important;
}

.card,
.floors,
.sheet {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: absolute;
    z-index: 3;
}

/* ---- 教室のカード ---- */

.card {
    left: calc(12px + var(--safe-left));
    max-width: calc(100% - 24px - var(--safe-left) - var(--safe-right) - 64px);
    padding: 10px 14px 11px;
    top: calc(12px + var(--safe-top));
}

.card__eyebrow {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.card__title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    margin: 1px 0 0;
    overflow-wrap: anywhere;
}

.card__meta {
    color: var(--muted);
    font-size: 13px;
    margin: 2px 0 0;
}

.card__meta strong {
    color: var(--accent);
    font-weight: 700;
}

.card__note {
    color: var(--muted);
    font-size: 12px;
    margin: 6px 0 0;
}

.card__link {
    background: none;
    border: 0;
    color: #1a5fd6;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    padding: 0;
}

/* ---- 候補の選択 ---- */

.sheet {
    bottom: calc(12px + var(--safe-bottom));
    left: calc(12px + var(--safe-left));
    max-height: 60%;
    overflow-y: auto;
    padding: 14px 0 6px;
    right: calc(12px + var(--safe-right));
    z-index: 4;
}

.sheet__title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 16px 6px;
}

.sheet__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sheet__list button {
    background: none;
    border: 0;
    border-top: 1px solid var(--line);
    color: inherit;
    cursor: pointer;
    display: block;
    font: inherit;
    padding: 11px 16px;
    text-align: left;
    width: 100%;
}

.sheet__list strong {
    display: block;
    font-size: 16px;
}

.sheet__list span {
    color: var(--muted);
    font-size: 13px;
}

/* ---- 階の切り替え ---- */

.floors {
    display: flex;
    flex-direction: column;
    max-height: calc(100% - 200px - var(--safe-top) - var(--safe-bottom));
    overflow: hidden;
    right: calc(12px + var(--safe-right));
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
}

/* 操作中の建物名 (階ボタンの選択色と同じ地色) */
.floors__building {
    background: var(--text);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
    padding: 7px 4px;
    text-align: center;
}

.floors__list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: none;
}

.floor-button {
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    flex: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    height: 40px;
    position: relative;
}

.floor-button.is-active {
    background: var(--text);
    color: #ffffff;
}

.floor-button.has-target::after {
    background: var(--accent);
    border: 2px solid var(--surface-solid);
    border-radius: 50%;
    content: "";
    height: 9px;
    position: absolute;
    right: 3px;
    top: 4px;
    width: 9px;
}

/* ---- 現在地へ戻るボタン ---- */

.locate {
    align-items: center;
    background: var(--surface-solid);
    border: 0;
    border-radius: 50%;
    bottom: calc(32px + var(--safe-bottom));
    box-shadow: var(--shadow);
    color: #1a73e8;
    cursor: pointer;
    display: flex;
    height: 44px;
    justify-content: center;
    position: absolute;
    right: calc(14px + var(--safe-right));
    width: 44px;
    z-index: 3;
}

.locate svg {
    fill: currentColor;
    height: 20px;
    transform: rotate(45deg);
    width: 20px;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
    margin-bottom: var(--safe-bottom);
}

.maplibregl-ctrl-bottom-left {
    margin-left: var(--safe-left);
}

.maplibregl-ctrl-bottom-right {
    margin-right: var(--safe-right);
}
