@font-face {
  font-family: 'sansRm';
  src: url('/fonts/RusimezSans.otf') format('opentype');
  font-weight: 400;
}

@font-face {
  font-family: 'sansRm';
  src: url('/fonts/RusimezSansBold.otf') format('opentype');
  font-weight: 700;
}

@font-face {
  font-family: 'sansLa';
  font-weight: 400;
  src: url(/fonts/Pretendard-Regular.otf) format('opentype');
}

@font-face {
  font-family: 'sansLa';
  font-weight: 700;
  src: url(/fonts/Pretendard-Bold.otf) format('opentype');
}

@font-face {
  font-family: 'sansSc';
  font-weight: 400;
  src: url(/fonts/NotoSansSC-Regular.ttf) format('truetype');
  unicode-range: U+3400-4DBF, U+4E00-9FFF;
}

@font-face {
  font-family: 'sansSc';
  font-weight: 700;
  src: url(/fonts/NotoSansSC-Bold.ttf) format('truetype');
  unicode-range: U+3400-4DBF, U+4E00-9FFF;
}

:root {
  --sans-font: 'sansRm', 'sansLa', 'sansSc', sans-serif;
}

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

body {
    display: flex;
}

#panel input,
#panel button {
    box-sizing: border-box;
    height: 1.5rem;
    margin: 0;
    border-radius: 0;
    border: 1px solid #dddddd;
    font-size: 1rem;
    line-height: 1rem;
    font-family: var(--sans-font);
    color: #000000;
}

#panel input {
    width: 18rem;
    margin-bottom: 0.5rem;
    margin-right: 3rem;
    padding: 0.25rem;
}

#panel button {
    width: 6rem;
    background-color: #ffffff;
    margin-right: 0.5rem;
}

button:hover { background-color: #eeeeee; }

#map {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#map svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

#panel {
    flex: none;
    position: relative;
    width: 24rem;
    box-sizing: border-box;
    padding: 1rem;
    overflow: auto;
    border-left: 1px solid #dddddd;
}

#panel .result {
    white-space: pre-wrap;
    font-size: 1rem;
    line-height: 1.5rem;
    margin: 1rem 0;
    font-family: var(--sans-font);
}

.suggest {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    max-height: 18rem;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
    background-color: #ffffff;
    border: 1px solid #dddddd;
    border-top: none;
    font-size: 1rem;
    line-height: 1rem;
    font-family: var(--sans-font);
}

.suggest li {
    height: 1rem;
    padding: 0.25rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggest li:hover,
.suggest li.active { background-color: #eeeeee; }

.suggest li.empty {
    height: 1rem;
    color: #999999;
    cursor: default;
}

#panel .station-row,
#panel .line-row { white-space: nowrap; }

.station-mark {
    fill: none;
    stroke-width: 15;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.5;
    pointer-events: none;
}

.station-mark.departure { stroke: red; }
.station-mark.destination { stroke: blue; }

.line-box > svg,
.line-row > div { flex: none; }

.station-row {
    display: flex;
    align-items: center;
    height: 2rem;
    line-height: 2rem;
}

.line-box {
    display: flex;
    align-items: center;
}

.line-row {
    display: flex;
    align-items: center;
    height: 2rem;
    gap: 0.25rem;
    margin-top: 0.5rem;
    font-weight: 700;
    line-height: 2rem;
}

body.home {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center;
    gap: 1rem;
    padding: 1rem;
    box-sizing: border-box;
}

.city {
    position: relative;
    display: block;
    width: 12rem;
    aspect-ratio: 1;
    overflow: hidden;
    border: 1px solid #dddddd;
}

.city-map {
    position: absolute;
    max-width: none;
    width: calc(100% * var(--map) / 360);
    left: calc(-100% * (var(--x) - 360 / 2) / 360);
    top: calc(-100% * (var(--y) - 360 / 2) / 360);
    transition: filter 0.2s ease;
}

.city-name {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-family: var(--sans-font);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.city:hover .city-map,
.city:focus-visible .city-map { filter: brightness(0.45); }

.city:hover .city-name,
.city:focus-visible .city-name { opacity: 1; }

@media (hover: none) {
    .city-map { filter: brightness(0.45); }
    .city-name { opacity: 1; }
}

.handle { display: none; }

@media (max-width: 768px) {
    body:not(.home) { display: block; overflow: hidden; }

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

    #panel {
        position: fixed;
        z-index: 2;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: 85vh;
        height: 85dvh;
        padding-top: 0;
        border-left: none;
        border-top: 1px solid #dddddd;
        background-color: #ffffff;
        transform: translateY(calc(100% - 9rem));
        transition: transform 0.2s ease;
    }

    #panel.dragging { transition: none; }

    .handle {
        display: block;
        position: sticky;
        top: 0;
        z-index: 2;
        height: 1rem;
        background-color: #ffffff;
        cursor: grab;
        touch-action: none;
    }

    .handle::before {
        content: "";
        display: block;
        width: 3rem;
        height: 0.25rem;
        margin: 0.75rem auto 0;
        border-radius: 0.125rem;
        background-color: #cccccc;
    }
}
