/* 追加UI用の色設定 */
:root {
    color-scheme: light;
    --text: #30383d;
    --page-bg: #f5f5f3;
    --surface: #ffffff;
    --surface-soft: #f7f7f5;
    --text-muted: #70777b;
    --border: #d9dddf;
    --border-strong: #c5cbcd;
    --accent: #39758c;
    --accent-hover: #2e5e70;
    --accent-soft: #eaf1f2;
    --ui-font: "游明朝", YuMincho, "Hiragino Mincho ProN", "ヒラギノ明朝 ProN", "HG明朝E", "ＭＳ Ｐ明朝", "MS PMincho", "MS 明朝", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
}

/* LED用のドットフォントはゴシック体への変更対象にしない */
@font-face {
    font-family: "KH Kagurazaka 16";
    src: url("fonts/KH-Dot-Kagurazaka-16.ttf") format("truetype");
}

/* style2 に不足していた検索・地域選択・設定UIのスタイル */
#tittle {
    display: flex;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
    color: #193653;
    box-shadow: 0 2px 8px rgba(28, 52, 84, 0.035);
    width: 100%;
}

/* タイトルのスクロール連動アニメーション */
#tittle.scroll-fade-title {
    opacity: var(--title-opacity, 1);
    transform: translateY(var(--title-offset, 0px));
    will-change: opacity, transform;
}

#vehicleSelectMethod:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(40, 120, 208, 0.25);
    outline-offset: 2px;
}

#closeLinePanel {
    margin: 0;
    padding: 0;
    border-radius: 8px;
    font-family: var(--ui-font);
}

#closeLinePanel:hover {
    color: #9f2929;
    background: #fff1f1;
}

#prefectureList {
    padding: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 8px;
    background: transparent;
    border-radius: 12px;
    border: 2px solid var(--border);
}

#prefectureList[hidden] {
    display: none !important;
}

.prefectureGroupHeader {
    padding: 11.5px;
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: bold;
    background: rgb(227, 225, 225);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-family: var(--ui-font);
    font-size: 18px;
    transition: 0.05s;
}

.prefectureGroupHeader:hover {
    background: #e9e8e8;
}

.prefectureGroupHeader:active {
    transform: scale(0.98);
}

.prefectureGroupButtons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.prefectureGroupButtons button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.prefectureGroupButtons .vehicleIcons {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 4px;
    flex-shrink: 0;
}

.prefectureGroupButtons .vehicleIcon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.prefectureGroupButtons[hidden] {
    display: none;
}

#vehiclePrefectureSearchArea,
#vehicleSearchArea,
#vehicleCompanySearchArea {
    margin: 12px 0;
}

#vehiclePrefectureSearchArea[hidden],
#vehicleSearchArea[hidden],
#vehicleCompanySearchArea[hidden] {
    display: none !important;
}

#vehiclePrefectureSearchInput,
#vehicleSearchInput,
#vehicleCompanySearchInput {
    width: calc(100% - 20px);
    position: relative;
    -webkit-appearance: searchfield;
    appearance: auto;
    box-sizing: border-box;
    margin-left: 10px;
    margin-right: 10px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}

#vehiclePrefectureSearchResults,
#vehicleSearchResults,
#vehicleCompanySearchResults {
    padding: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 8px;
    background: transparent;
}

#vehiclePrefectureSearchResults h3,
#vehicleSearchResults h3,
#vehicleCompanySearchResults h3 {
    margin: 4px 0 0;
    font-size: 24px;
}

#vehiclePrefectureSearchResults button,
#vehicleSearchResults button,
#vehicleCompanySearchResults button {
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

#vehiclePrefectureSearchResults button:hover,
#vehicleSearchResults button:hover,
#vehicleCompanySearchResults button:hover {
    background: #f0f5fa;
}

#vehiclePrefectureSearchResults .vehicleIcons,
#vehicleSearchResults .vehicleIcons,
#vehicleCompanySearchResults .vehicleIcons {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    flex-shrink: 0;
}

#vehiclePrefectureSearchResults .vehicleIcon,
#vehicleSearchResults .vehicleIcon,
#vehicleCompanySearchResults .vehicleIcon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

#companyList {
    padding: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 8px;
    background: transparent;
    border-radius: 12px;
    border: 2px solid var(--border);
}

#companyList[hidden] {
    display: none !important;
}

.companyGroupHeader {
    padding: 11.5px;
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: bold;
    background: rgb(227, 225, 225);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-family: var(--ui-font);
    font-size: 18px;
    transition: 0.05s;
}

.companyGroupHeader:hover {
    background: #e9e8e8;
}

.companyGroupHeader:active {
    transform: scale(0.98);
}

.companyGroupButtons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.companyGroupButtons button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.companyGroupButtons .vehicleIcons {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 4px;
    flex-shrink: 0;
}

.companyGroupButtons .vehicleIcon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.companyGroupButtons[hidden] {
    display: none;
}

body {
    background: var(--page-bg);
}

button:hover {
    background: #f2f2ef;
    border-color: #c9cecf;
}

#vehicleSelectMethodLabel {
    display: none;
    margin: 0 0 8px;
    color: var(--text);
}

#vehicleSelectMethod,
select,
input,
textarea {
    font: inherit;
}

#vehicleSelectMethod {
    display: none;
    width: min(100%, 380px);
    margin: 0 0 18px;
    color: var(--text);
    min-height: 42px;
    background: #fff;
    border: 2px solid var(--border-strong);
    cursor: pointer;
}

#messageBoardBtn {
    display: block;
    margin-left: auto;
    width: 200px;
    margin-bottom: 8px;
    margin-right: 10px;
    height: 50px;
}

#vehicleSelect {
    background: transparent;
    border: 2px solid var(--border);
}

.vehicleText {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
}

.vehicleDescription {
    font-size: 0.7em;
    color: #666;
    margin-top: 3px;
}

.displayLabel {
    color: var(--text);
}

.buttonGroup button.selected {
    border-color: var(--accent);
}

.selectGroup button.selected {
    border-color: var(--accent);
}

.numberInput {
    color: var(--text);
}

.numberInput input {
    color: var(--text);
}

.numberInput button {
    min-height: 30px;
    color: var(--text);
}

#messageBoardScroll label,
#scroll label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 650;
    font-size: 14px;
}

#scroll input[type="checkbox"] {
    accent-color: var(--accent);
}

#messageBoardScrollText,
#scrollText {
    font-weight: 400 !important;
    font-size: 14px;
}

#startMessageBoardScrollBtn,
#startScrollBtn {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-family: var(--ui-font);
    font-weight: 500 !important;
    font-size: 18px;
}

#startMessageBoardScrollBtn,
#startScrollBtn:hover {
    background: var(--accent-hover);
}

#referenceSite {
    display: grid;
    font-size: 14px;
}

#referenceSite label {
    font-family: var(--ui-font);
    font-size: 12px;
}

#explanation {
    color: var(--text);
    font-size: 14px;
}

#referenceSite {
    color: var(--text);
}

#messageBoardVehicleSelectButton,
#vehicleSelectButton {
    margin-top: 16px;
    color: var(--accent-hover);
    background: #fff;
    border: 1px solid #a9c9ed;
    font-family: var(--ui-font);
    font-weight: 500 !important;
}

#messageBoardVehicleSelectButton,
#vehicleSelectButton:hover {
    background: var(--accent-soft);
}

#scrollCanvas {
    display: none;
}

#esp32Ip {
    background-color: var(--surface);
    color: var(--text);
}

#ledSettings {
    background-color: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

#verticalSlide {
    display: grid;
}

#verticalSlideLabel1 {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#verticalSlideLabel2 {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#choppyScrollLabel {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#verticalSlide[hidden] {
    display: none !important;
}

#cacheNotice {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #222;
    color: #fff;
    font-size: 14px;
    text-align: center;
    box-shadow: 0 4px 12px #0003;
}

#cacheNotice[hidden] {
    display: none !important;
}

#verticalSlideLabel1[hidden] {
    display: none !important;
}

#verticalSlideLabel2[hidden] {
    display: none !important;
}

#verticalSlideCheckbox {
    margin-top: 20px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    background-color: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
}

#verticalSlideCheckbox[hidden] {
    display: none !important;
}

#ledAgingLabel {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#ledAgingLebelLabel {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#setLedAgingLebel[hidden] {
    display: none !important;
}

#debugConsole {
    display: block !important;
    position: relative;
    z-index: 99999;
    background: #111;
    color: #00ff00;
    padding: 10px;
    margin: 10px;
    font: 12px monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 200px;
    overflow-y: auto;
}

#debugConsole[hidden] {
    display: none !important;
}

#debugConsole button {
    color: #000;
    background: #fff;
    padding: 6px;
}

#debugLog {
    color: #00ff00;
    white-space: pre-wrap;
}

.vehicle-route-label {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #666;
    border-radius: 3px;
    box-shadow: none;
    color: #111;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    padding: 2px 4px;
    white-space: nowrap;
    pointer-events: none;
}

.vehicle-route-label::before {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0;
}

.setting-label {
    margin-top: 10px;
    margin-bottom: 8px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
    font-size: 14px;
}

.toggle-switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-text {
    font-size: 14px;
    font-weight: 650;
    color: var(--text);
    font-family: var(--ui-font);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2b9389;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    #tittle {
        font-size: 13px;
    }

    .ledFrame {
        border-radius: 10px;
    }

    #prefectureList {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 8px;
    }

    .prefectureGroupButtons {
        grid-template-columns: repeat(1, 1fr);
    }

    #companyList {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 8px;
    }

    .companyGroupButtons {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* ===== style2.css の元のスタイル（ゴシック体に変更） ===== */
#tittle {
    cursor: pointer;
    font-weight: 700;
}

#tittle:hover {
    background: #ededed!important;
}

#map {
    width: 100%;
    height: 600px;
    margin-top: 20px;
}

#linePanel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;

    width: 280px;
    padding: 15px;

    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#closeLinePanel {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: auto;
    position: absolute;
    width: 30px;
    height: 30px;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    background: #b83b3b;
    color:white;
}

body {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: var(--ui-font);
}

.container {
    display: flex;
    flex-direction: column;
}

aside {
    order: 2;
    width: 100%;
    min-width: 180px;
    max-width: none;
    flex-shrink: 0;
    background: #f4f4f4;
    padding: 12px;
    box-sizing: border-box;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

#buttonGroup {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

#resizer {
    width: 6px;
    cursor: col-resize;
    background: #666;
}

#resizer:hover {
    background: #999;
}

main {
    order: 1;
    width: 100%;
    flex: 1;
    background: rgb(60, 59, 59);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.ledFrame {
    background:#111;
    margin: 100px;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius:20px;
}

#messageBoard .ledFrame {
    box-sizing: border-box;
}

#led {
    display: block;
}

button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    margin-top: 10px;
    background: whitesmoke;
    color: black;
    border: none;
    border-radius: 8px;
    box-shadow: -3px 3px 8px rgba(0,0,0,0.25);
    cursor: pointer;
    font-family: var(--ui-font);
    letter-spacing: -0.03em;
    font-size: 16px;
    font-weight: 400!important;
    touch-action: manipulation;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    box-shadow: -4px 4px 10px rgba(0,0,0,0.3);
}

button:active {
    transform: translate(-2px, 2px);
    box-shadow: -1px 1px 2px rgba(0,0,0,0.15);
}

button.tap {
    transform: translate(-2px, 2px);
    box-shadow: -1px 1px 2px rgba(0,0,0,0.15);
}

@keyframes selectFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1.03); }
}

#vehicleSelectMethodLabel {
    font-family: var(--ui-font);
    font-size: 20px;
}

#vehicleSelectMethod {
    font-family: var(--ui-font);
    font-size: 16px;
    margin-bottom: 10px;
    padding: 6px;
    border-radius: 10px;
}

#vehicleSelectMethod option[hidden] {
    display: none!important;
}

#vehicleSelect {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

#vehicleSelect button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

#vehicleSelect[hidden] {
    display: none !important;
}

.vehicleIcons {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 4px;
    flex-shrink: 0;
}

.vehicleIcon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.vehicleName {
    margin-left: 8px;
    white-space: nowrap;
}

.displayLabel {
    font-size: 24px;
    font-weight: 450;
    font-family: var(--ui-font);
}

.buttonGroup {
    border: 2px solid #9a9a9a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: rgb(255, 255, 255);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    min-height: 200px;
    overflow-y: auto;
}

.buttonGroup button.selected {
    background: #39758c;
    color: white;
}

.groupHeader {
    padding: 11.5px;
    margin-top: 8px;
    margin-bottom: 4px;
    font-weight: bold;
    background: rgb(227, 225, 225);
    color: black;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    font-family: var(--ui-font);
    font-size: 18px;
    transition: 0.05s;
}

.groupHeader:hover {
    background: #e9e8e8;
}

.groupHeader:active {
    transform: scale(0.96);
}

.groupedButtons {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 8px;
}

.groupButtons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.groupButtons[hidden] {
    display: none;
}

.normalButtons {
    display:grid;
    grid-template-columns: repeat(3,1fr);
    gap:8px;
}

.selectGroup {
    border: 2px solid #9a9a9a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: rgb(255, 255, 255);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: none;
    overflow-y: auto;
}

.selectGroup button.selected {
    background: #39758c;
    color: white;
    font-weight: 700;
}

.timeSetting {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.timeSetting[hidden] {
    display: none;
}

.timeSetting span {
    font-size: 24px;
}

.numberInput {
    display: flex;
    align-items: center;
    border: 1px solid #aaa;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    font-family: var(--ui-font);
}

.numberInput input {
    width: 55px;
    padding: 6px;
    border: none;
    outline: none;
    text-align: center;
    font-size: 16px;
    font-family: var(--ui-font);
}

.numberInput button {
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 6px;
    border-radius: 0;
    box-shadow: none;
    background: #eee;
    transform: none;
    transition: none;
    box-shadow: none;
}

.numberInput button:hover {
    background: #ddd;
    box-shadow: none;
}

.numberInput button:active {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#referenceSite {
    display: grid;
}

#referenceSiteLink{
    display: grid;
    font-size: 12px;
}

#referenceSite a::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    background: black;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

#referenceSite[hidden] {
    display: none !important;
}

#loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    font-size: 32px;
    z-index: 9999;
}

#loading[hidden] {
    display: none;
}

.loadingDots::after {
    content: "";
    animation: loadingDots 1.2s steps(4, end) infinite;
}

#scroll {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 2px solid #9a9a9a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: rgb(255, 255, 255);
    flex-wrap: wrap;
    overflow-y: auto;
}

#messageBoardScroll {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 2px solid #9a9a9a;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 20px;
    background: rgb(255, 255, 255);
    flex-wrap: wrap;
    overflow-y: auto;
}

#messageBoardScrollText,
#scrollText {
    margin-top: 5px;
    width: 100%;
    height: 150px;
    box-sizing: border-box;
    resize: vertical;
    font-family:var(--ui-font);
    font-size: 16px;
    border: 1px solid #000000;
    border-radius: 4px;
}

#scroll[hidden] {
    display: none;
}

#startScrollBtn[hidden] {
    display: none;
}

#referenceSite {
    margin-top: 20px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    background-color: #fcfcfc;
    border: 1px solid #000000;
    border-radius: 8px;
}

#esp32Setting {
    margin-top: 20px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    background-color: #fcfcfc;
    border: 1px solid #000000;
    border-radius: 8px;
}

#esp32Ip {
    width: 200px;
    padding: 6px;
    border: 1px solid #000000;
    border-radius: 8px;
    outline: none;
    text-align: center;
    font-size: 16px;
    font-family: var(--ui-font);
}

#explanation {
    margin-top: 20px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 10px;
    background-color: #fcfcfc;
    border: 1px solid #000000;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

#explanationLabel {
    font-size: 12px;
    font-family: var(--ui-font);
}

@keyframes loadingDots {
    0%   { content: ""; }
    25%  { content: "."; }
    50%  { content: ".."; }
    75%  { content: "..."; }
    100% { content: ""; }
}

@media (max-width: 768px) {

    html,
    body {
        height: 100%;
        margin: 0;
    }

    /* 通常の車両選択画面ではスクロール可能 */
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    #tittle {
        width: 100vw !important;
        box-sizing: border-box;
        flex-shrink: 0;
    }

    #vehicleSelector {
        flex-shrink: 0;
    }

    #simulator {
        flex: 1;
        min-height: 0;
    }

    .container {
        height: 100%;
        min-height: 0;

        display: flex;
        flex-direction: column;
    }

    /* =========================
       シミュレーター画面のみ固定
       ========================= */

    body.simulatorMode {
        overflow: hidden;
    }

    body.simulatorMode #simulator {
        flex: 1;
        min-height: 0;
    }

    /* mainを上 */
    body.simulatorMode main {
        order: 1;

        flex: 0 0 auto;

        box-sizing: border-box;
        overflow-x: auto;
        overflow-y: hidden;

        justify-content: flex-start;
    }

    /* resizerはスマホでは不要 */
    body.simulatorMode #resizer {
        display: none;
    }

    /* asideを下 */
    body.simulatorMode aside {
        order: 2;

        flex: 1 1 auto;
        min-height: 0;

        box-sizing: border-box;

        overflow-y: auto;
        overflow-x: hidden;
    }

    /* =========================
       その他のスマホ用設定
       ========================= */

    .ledFrame {
        margin: 10px;
        padding: 10px;
    }

    body {
        font-size: 40px;
    }

    #buttonGroup {
        grid-template-columns: repeat(1, 1fr);
    }

    button {
        font-size: 18px;
    }

    .buttonGroup {
        max-height: 240px;
        min-height: 10px !important;
    }

    #vehicleSelect {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 8px;
    }

    .vehicleIcons {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
        flex-shrink: 0;
    }

    .selectGroup {
        max-height: none !important;
    }

    .displayLabel {
        font-size: medium !important;
    }
}

/* === 今回追加したUI用のスタイル === */
#ledSettings input[type="range"] {
    display: block;
    margin-top: 5px;
}

#ledSettings input[type="number"] {
    border: 1px solid #000000;
    border-radius: 4px;
    font-size: 16px;
    font-family: var(--ui-font);
}

/* 色の切り替わりを滑らかにする。配置・サイズ・LED描画には影響しない */
button {
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        outline-color 0.2s ease;
}

.numberInput button {
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

#tittle {
    transition: color 0.4s ease, background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, outline-color 0.4s ease;
}

#resizer,
#closeLinePanel,
#vehicleSelectMethod,
select,
input,
textarea,
a,
#vehicleSelectButton,
.slider {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, outline-color 0.2s ease;
}

.groupHeader,
.prefectureGroupHeader,
.companyGroupHeader {
    transition: transform 0.15s ease, color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ===== 画面切り替えアニメーション ===== */

#vehicleSelector,
#simulator,
#messageBoard {
    opacity: 1;
    transform: translateY(0);
}

/* 表示先の画面 */
/* 表示先のフェードイン */
#vehicleSelector.screen-transition-in,
#simulator.screen-transition-in,
#messageBoard.screen-transition-in {
    animation: screenFadeIn 0.4s ease both;
}

/* 表示元のフェードアウト */
#vehicleSelector.screen-transition-out,
#simulator.screen-transition-out,
#messageBoard.screen-transition-out {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition:
        opacity 0.4s ease,
        transform 0.4s ease;
}

@keyframes screenFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ローディングのフェード ===== */

#loading {
    opacity: 0;
    transition: opacity 0.25s ease;
}

#loading.loading-visible {
    opacity: 1;
}

#loading[hidden] {
    display: none !important;
}

#loading .spinner {
    animation: loadingSpin 0.8s linear infinite;
}

@keyframes loadingSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== タイトルのスクロール連動アニメーション ===== */

/* タイトルのスクロール連動アニメーション */
#tittle.scroll-fade-title {
    opacity: var(--title-opacity, 1);
    transform: translateY(var(--title-offset, 0px));
    will-change: opacity, transform;

    transition:
        opacity 0.3s linear,
        transform 0.3s linear,
        color 0.4s ease,
        background-color 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}

/* スマホのシミュレーター画面ではタイトルを薄くしない */
@media (max-width: 768px) {
    body.simulatorMode #tittle.scroll-fade-title {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }
}

/* アニメーションを減らす設定への対応 */
@media (prefers-reduced-motion: reduce) {
    #vehicleSelector,
    #simulator,
    #messageBoard,
    #loading {
        animation: none !important;
        transition: none !important;
    }

    #vehicleSelector,
    #simulator,
    #messageBoard {
        opacity: 1;
        transform: none;
    }
}

#messageBoardScrollText[hidden] {
    display: none!important;
}

#startMessageBoardScrollBtn[hidden] {
    display: none!important;
}

/* ===== メッセージボードのレイアウト ===== */

#messageBoard[hidden] {
    display: none !important;
}

/* メッセージボード全体 */
#messageBoard:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

/* LEDプレビューを上に配置 */
#messageBoard > main {
    display:flex;
    justify-content: center;
    order: 1;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 300px;
    box-sizing: border-box;
}

/* 設定欄を下に配置 */
#messageBoard > aside {
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    overflow-y: visible;
}

/* スマホではプレビューの横スクロールを許可 */
@media (max-width: 768px) {
    #messageBoard > main {
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
    }

    #messageBoard > aside {
        overflow-x: hidden;
        overflow-y: visible;
    }
}

/* メッセージボードのLEDプレビュー */
#messageBoard:not([hidden]) > main {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#messageBoardLedPreview {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    flex-shrink: 0;
}

#messageBoard body {
    padding: 10px;
}

#timeCheckLabel {
    font-size: 14px;
}

#displayLog[hidden] {
    display:none;
}