/* ================= GIAO DIỆN TRONG TRƯỜNG HỌC & SƠ ĐỒ ================= */
#school-action, #school-way {
    position: fixed; z-index: 22; font: 600 14px Tahoma, sans-serif;
    color: #fffaf0; background: #24534f; border: 1px solid #bbd4ba;
    border-radius: 12px; padding: 11px 16px; box-shadow: 0 3px 10px #182c3545;
}
#school-action { right: 14px; bottom: max(24px, env(safe-area-inset-bottom)); cursor: pointer; min-height: 44px; }
#school-way { top: max(12px, env(safe-area-inset-top)); left: 12px; max-width: min(72vw, 310px); font-size: 12px; pointer-events: none; padding: 7px 12px; }
#school-way[hidden], #school-action[hidden] { display: none; }

#school-sheet {
    box-sizing: border-box; width: min(380px, 92vw); max-height: 84dvh; overflow: auto; margin: auto;
    border: 2px solid #8e7960; border-radius: 14px; box-shadow: 0 14px 60px #18282b66;
    padding: 22px; color: #2c3e39; background: #fff9e9; text-align: left; font: 15px/1.5 Tahoma, sans-serif;
}
#school-sheet::backdrop { background: #162a2c70; }
#school-sheet section { display: grid; gap: 10px; }
#school-sheet h2 { margin: 0 0 3px; color: #30564c; font-size: 22px; }
#school-sheet p { margin: 2px 0 10px; }
#school-sheet button, #school-sheet textarea, #school-sheet select {
    box-sizing: border-box; width: 100%; border: 1px solid #b8b49b; border-radius: 8px;
    background: #fffdf3; color: #263f37; font: inherit; padding: 10px;
}
#school-sheet button { cursor: pointer; text-align: left; }
#school-sheet .primary { background: #315e4e; color: white; text-align: center; }
#school-sheet button:disabled { opacity: .5; }
#school-sheet textarea { resize: vertical; font-size: 16px; user-select: text; -webkit-user-select: text; }

/* Mẹo thi & Điều ước */
#school-sheet[data-paper="tip"] { background: linear-gradient(105deg, #fffaf0, #f5e8c9); border-color: #ad9575; }
@media (prefers-reduced-motion: no-preference) {
    #school-sheet[data-paper="tip"][open] { animation: school-paper-in .38s ease-out; }
    @keyframes school-paper-in { from { transform: translateY(16px) rotate(-2deg); opacity: 0; } to { transform: none; opacity: 1; } }
}
#school-sheet[data-paper="wish"] {
    position: fixed; inset: auto; margin: 0; left: var(--wish-x, 50vw); top: var(--wish-y, 50dvh);
    transform: translate(-50%, -50%); width: min(380px, var(--wish-width, 92vw)); max-height: var(--wish-height, 88dvh);
}
#school-sheet[data-paper="wish"] h2 { padding-right: 30px; }
#school-sheet .wish-close { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; padding: 0; display: grid; place-items: center; background: transparent; color: white; }
#school-sheet .wish-close span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #b83b3b; font: 700 20px/1 sans-serif; }
#school-sheet .wish-close:hover span, #school-sheet .wish-close:focus-visible span { background: #8e2929; }

/* Sơ đồ hành lang */
#school-sheet[data-paper="directory"] { width: min(720px, 95vw); max-height: 90dvh; padding: 0; border: 4px solid #92735a; border-radius: 12px; background: #f6f2df; color: #334e42; box-shadow: 0 12px 52px #11261d70, inset 0 0 0 1px #dbcfad; }
#school-sheet[data-paper="directory"] section { position: relative; display: block; }
#school-sheet[data-paper="directory"] h2 { padding: 14px 54px 13px 22px; border-bottom: 3px solid #c8ad78; background: #315c50; color: #fff4ce; font: 600 clamp(20px,3vw,25px) Georgia, serif; letter-spacing: .02em; }
#school-sheet .map-close { position: absolute; right: 3px; top: 2px; width: 46px; height: 44px; text-align: center; border: 0; background: transparent; color: #fff4ce; font-size: 26px; line-height: 1; }
.hall-plan { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: 1fr 1fr; align-items: center; margin: 5px 12px 10px; height: clamp(215px, 37vh, 290px); isolation: isolate; }
.hall-plan::before { content: ''; position: absolute; left: 7%; right: 7%; top: 50%; height: 7px; transform: translateY(-50%); background: #bdd0b2; border-block: 1px solid #849e85; z-index: -1; }
#school-sheet .map-stop, .map-here { position: relative; justify-self: center; text-align: center; line-height: 1.18; }
#school-sheet .map-stop { grid-column: var(--col); width: clamp(92px, 19vw, 134px); min-height: 60px; padding: 3px 3px 6px; display: grid; justify-items: center; align-content: center; gap: 3px; border: 0; background: transparent; color: #2e5448; border-radius: 9px; font: 600 14px/1.18 Tahoma, sans-serif; }
#school-sheet .map-stop:hover, #school-sheet .map-stop:focus-visible { background: #dde8cf; outline: 2px solid #688c70; }
.map-stop canvas { width: 62px; height: 40px; pointer-events: none; }
.map-stop.upper { grid-row: 1; align-self: end; margin-bottom: 16px; }
.map-stop.lower { grid-row: 2; align-self: start; margin-top: 16px; }
.map-stop::before, .map-here::before { content: ''; position: absolute; left: 50%; height: 16px; width: 2px; background: #76917c; transform: translateX(-50%); }
.map-stop.upper::before { top: 100%; }
.map-stop.lower::before, .map-here::before { bottom: 100%; }
.map-stop::after, .map-here::after { content: ''; position: absolute; left: 50%; height: 8px; width: 8px; box-sizing: content-box; transform: translate(-50%, 50%); background: #f6f2df; border: 2px solid #698875; border-radius: 50%; }
.map-stop.upper::after { bottom: -16px; }
.map-stop.lower::after, .map-here::after { top: -16px; transform: translate(-50%, -50%); }
.map-here { grid-column: 1; grid-row: 2; align-self: start; margin-top: 16px; padding: 5px 0; font: bold 12px/1.2 Tahoma, sans-serif; color: #995b3d; }
.map-here::after { background: #b86f47; border-color: #fff3d5; }

@media (max-width: 520px) {
    .hall-plan { margin: 4px 14px 12px; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 245px; }
    .hall-plan::before { left: 3%; right: 8.5%; }
    #school-sheet .map-stop { grid-column: calc(var(--col) - 1); width: min(24vw, 90px); font-size: 13px; }
    .map-stop canvas { width: 50px; height: 32px; }
    .map-here { grid-column: 1; justify-self: start; width: 52px; font-size: 11px; transform: translateX(-5px); }
    .map-here::before, .map-here::after { left: 28%; }
}
@media (max-height: 450px) { .hall-plan { height: 180px; } .map-stop canvas { width: 44px; height: 28px; } }
