@font-face {
    font-family: 'jr-cen_rollsignregular';
    src: url('../fonts/JR-Central_Rollsign.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body {
    background-color: #222;
    color: white;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2em;
}

.title {
    font-size: 2em;
    font-family: 'DotGothic16';
}

.simulator-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.display-frame {
    padding: 1em;
    background-color: #333;
    border-radius: 1em;
    box-shadow: 0 0 15px #000;
    width: fit-content;
}

.led-display {
    display: flex;
    align-items: stretch;
    background-color: black;
    border: 4px solid #000;
    border-radius: 0.5em;
    overflow: hidden;
    flex-wrap: nowrap;
    min-width: 600px;
    min-height: 100px;
    position: relative;
}

#dot-canvas {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.type-area,
.destination-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 5px;
    white-space: nowrap;
}

.type-area {
    width: 30%;
    border-right: 2px solid #000;
    position: relative;
}

#type-text-ja {
    position: absolute;
    top: 20px;
}

#type-text-en {
    position: absolute;
    bottom: 12px;
}

.destination-area {
    width: 70%;
    color: #fff;
}

#destination-text-ja {
    position: absolute;
    top: 20px;
}

#destination-text-en {
    position: absolute;
    bottom: 12px;
}

.main-text {
    font-size: 3em;
    font-weight: bold;
    line-height: 1.1;
}

.sub-text {
    font-size: 1em;
    font-weight: normal;
    line-height: 1.1;
    margin-top: 2px;
}

/* ▼ 従来通りの特殊フォント（斜体など）用クラス ▼ */
#type-text-ja.italic-text {
    font-style: italic;
    font-family: 'jr-cen_rollsignregular', sans-serif;
    font-weight: normal;
    top: 20px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin: 1.5em auto;
    max-width: 900px;
    justify-content: center;
    color: white;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section {
    width: 80%;
}

.controls label {
    display: block;
    width: 100%;
    flex-direction: column;
    font-size: 0.9em;
}

.controls label.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    /* スイッチとテキストの間の隙間 */
    width: auto;
    /* 既存の 120px 固定を解除 */
    cursor: pointer;
}

.controls input[type="text"],
.controls select {
    margin-top: 0.1em;
    padding: 0.4em 0.6em;
    border-radius: 8px;
    border: 1px solid #555;
    background-color: #1e1e1e;
    color: #fff;
    outline: none;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#open-settings-btn {
    width: 100%;
}

.controls input:focus,
.controls select:focus {
    border-color: #00aaff;
    box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.4);
}

.controls select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23aaa" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.6em center;
    background-size: 1em;
    padding-right: 2em;
}

/* トグルスイッチの枠 */
.toggle-switch {
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    width: 50px;
    height: 25px;
    border-radius: 25px;
    /* heightの半分にするときれいなカプセル型になります */
    background-color: #dddddd;
    transition: background-color 0.4s;
}

/* チェックされた時の背景色 */
.toggle-switch:has(:checked) {
    background-color: #4bd865;
}

/* スイッチの丸い部分 */
.toggle-switch::after {
    content: "";
    position: absolute;
    top: 2.5px;
    /* (枠25px - 丸20px) ÷ 2 で上下中央に */
    left: 2.5px;
    /* 左側に少し余白を持たせる */
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: 0 0 5px rgb(0 0 0 / 20%);
    background-color: #fff;
    transition: left 0.4s;
}

/* チェックされた時の丸の位置 */
.toggle-switch:has(:checked)::after {
    /* 枠幅50px - 丸幅20px - 右余白2.5px = 27.5px */
    left: 27.5px;
}

/* デフォルトのチェックボックス（四角い枠）を隠す */
.toggle-switch input {
    display: none;
}

button {
    cursor: pointer;
    padding: 0.6em 1.2em;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    background: #00aaff;
    color: white;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: #0088cc;
}

button:active {
    transform: scale(0.97);
}

#close-settings-btn {
    background: #b8b8b8;
    color: black;
    margin-right: 10px;
}

#close-settings-btn:hover {
    background-color: #908f8f;
}

#save-settings-btn {
    width: 100%;
    font-weight: bold;
    background: #00aadd;
    color: white;
    padding: 10px 25px;
    margin-top: 10px;
}

#save-settings-btn:hover {
    background-color: #003fbd;
}

#save-image-button {
    padding: 0.6em 1.2em;
    font-size: 1em;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#save-image-button:hover {
    background-color: #218838;
}

#save-image-button:active {
    transform: scale(0.97);
}

#settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal {
    background: #fff;
    color: #000;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

#settings-modal label,
.color-group label {
    color: #111;
    font-weight: 500;
}

.preset {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    white-space: nowrap;
}

#preset-select {
    width: 100%;
}

.type-edit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.type-edit-row input[type="text"] {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.edit-ja {
    flex: 1;
    min-width: 80px;
}

.edit-en {
    flex: 1;
    min-width: 100px;
}

.color-group {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.9em;
}

.color-group input[type="color"] {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 4px;
}

footer {
    text-align: center;
    padding: 6px 10px;
    font-size: 11px;
    font-family: 'DotGothic16';
    color: #777;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

footer p {
    margin: 0;
}

footer #site-version {
    color: #aaa;
}

@media (max-width: 600px) {
    .title {
        font-size: 1.5em;
    }

    .display-frame {
        transform: scale(0.55);
    }

    .controls {
        transform: scale(1);
        margin-top: 0;
    }

    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .control-group.switch-group {
        flex-direction: row;
    }

    .type-edit-row {
        padding: 12px;
        gap: 8px;
    }

    .edit-ja,
    .edit-en {
        flex: 1 1 45%;
        width: 100% !important;
        box-sizing: border-box;
    }

    .color-group {
        flex: 1 1 100%;
        justify-content: space-between;
        margin-top: 4px;
    }

    .color-group label {
        display: flex;
        align-items: center;
    }

    .preset {
        white-space: normal;
    }

    #preset-select {
        width: auto;
    }

    #type-text-ja.italic-text {
        top: 15px;
    }
}