@import 'https://fonts.googleapis.com/css2?family=Andika:ital,wght@0,400;0,700;1,400;1,700&display=swap';
@font-face {
    font-family: kana;
    src: url(kana.woff) format('woff');
}
@font-face {
    font-family: figure;
    src: url(figure.woff) format('woff');
}
@font-face {
    font-family: kanji;
    src: url(kanji.woff2) format('woff2');
}
@font-face {
    font-family: kai;
    src: url(kai.woff2) format('woff2');
}

:root {
    --zh-hans-font-family: 'Source Han Sans', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Heiti SC', SimHei;
    --zh-hant-font-family: 'Source Han Sans', 'Noto Sans HK', 'Noto Sans TC', 'PingFang HK', 'PingFang TC', 'Hiragino Sans CNS', 'Microsoft JhengHei', 'Heiti TC';
    --ja-font-family: 'Source Han Sans', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Kaku Gothic Pro', 'Meiryo', 'Yu Gothic', 'MS PGothic';
    --ko-font-family: 'Source Han Sans', 'Noto Sans KR', 'Apple SD Gothic Neo', NanumBarunGothic, 'Malgun Gothic', Dotum;
}

body {
    background-color: #87c5c1;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    -webkit-user-select: none;
    user-select: none;
}

h1 {
    color: #849;
    font-size: 42px;
    margin: 0 auto;
    font-family: figure, kana, kanji;
    font-weight: normal;
    white-space: nowrap;
}

body:lang(zh-hans),
input:lang(zh-hans),
select:lang(zh-hans),
button:lang(zh-hans) {
    font-family: Andika, var(--zh-hans-font-family), sans-serif;
}
body:lang(zh-hant),
input:lang(zh-hant),
select:lang(zh-hant),
button:lang(zh-hant) {
    font-family: Andika, var(--zh-hant-font-family), sans-serif;
}
body:lang(ja),
input:lang(ja),
select:lang(ja),
button:lang(ja) {
    font-family: Andika, var(--ja-font-family), sans-serif;
}
body:lang(ko),
input:lang(ko),
select:lang(ko),
button:lang(ko) {
    font-family: Andika, var(--ko-font-family), sans-serif;
}

.switch {
    position: relative;
    display: inline-block;
    width: 25px;
    height: 12px;
    vertical-align: middle;
}
.switch input {
    display: none;
}
.switch-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}
.switch-toggle::before {
    content: '';
    position: absolute;
    height: 10px;
    width: 10px;
    left: 1px;
    bottom: 1px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}
.switch input:checked + .switch-toggle {
    background-color: #849;
}
.switch input:checked + .switch-toggle::before {
    transform: translateX(13px);
}

#input-container {
    max-width: calc(100% - 20px);
    margin: 20px 10px;
    background-color: #fff;
    border-radius: 8px;
    padding: 20px 30px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

input,
select {
    padding: 8px;
    margin: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    position: relative;
    vertical-align: middle;
}
#text1:focus {
    outline-color: #88c;
}
#text2:focus {
    outline-color: #b68;
}
#ten:focus {
    outline-color: #dac;
}
#text3:focus {
    outline-color: #ca8;
}

input[type='range'] {
    width: 280px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 18px;
    border-radius: 18px;
    background: #e0dcdd;
    margin: 4px;
    vertical-align: middle;
}
input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3cb;
    cursor: pointer;
}
input[type='range'][disabled]::-webkit-slider-thumb {
    background-color: #bcc;
    cursor: not-allowed;
}
input[type='range']::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3cb;
    cursor: pointer;
}

#language {
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    font-size: 12px;
}

#transparent-switch {
    width: 50px;
    height: 24px;
}
#transparent-toggle {
    border-radius: 12px;
}
#transparent-toggle::before {
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
}
#transparent-switch input:checked + #transparent-toggle::before {
    transform: translateX(26px);
}

#transparent-text {
    display: inline-block;
    width: 70px;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
}

input[type='color'] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background-color: transparent;
    padding: 0;
    cursor: pointer;
}

.font-selector {
    display: inline-block;
    vertical-align: middle;
}

input[type='radio'] {
    display: none;
}

.font-selector label {
    display: inline-block;
    text-align: center;
    cursor: pointer;
    margin: -2.5px;
    padding: 1.3px 0;
    width: 68px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
}
.font-selector label:last-child {
    border-radius: 0 4px 4px 0;
}

input[type='radio']:checked + label {
    background-color: #849;
    color: #fff;
}

button {
    display: inline-block;
    padding: 5px 18px;
    margin: 4px;
    background-color: #849;
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font-size: 16px;
    width: 68px;
    transition: background-color 0.3s;
    vertical-align: middle;
}
button:hover {
    background-color: #6a3377;
}
button[disabled] {
    background-color: #ccc;
    color: #666;
    pointer-events: none;
    cursor: not-allowed;
}

#canvas-container {
    max-width: 100%;
    overflow-x: auto;
}
#canvas-container canvas {
    max-width: calc(100% - 20px);
    margin: 0 10px;
    background-color: #fff;
    background-image: linear-gradient(45deg, #ccc 25%, transparent 0, transparent 75%, #ccc 0), linear-gradient(45deg, #ccc 25%, transparent 0, transparent 75%, #ccc 0);
    background-position: 0 0, 8px 8px;
    background-size: 16px 16px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

a:not(#download-btn) {
    box-shadow: 0 -2px rgba(209, 159, 254, 0.5) inset;
    transition: all 0.5s ease;
    text-decoration: none;
    color: #363169;
}
a:not(#download-btn):hover {
    cursor: pointer;
    box-shadow: 0px -1.85rem 0px rgba(209, 159, 254, 0.7) inset;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}
#popup {
    background-color: #cdebe9;
    position: relative;
    max-width: 80%;
    max-height: 80%;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
#popup img {
    width: calc(100% - 40px);
    height: auto;
    display: block;
    margin: 0 auto;
}
#close-btn {
    font-size: 18px;
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #ff6059;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

@media (max-width: 576px) {
    h1 {
        font-size: 28px;
    }

    #language {
        font-size: 10px;
    }

    #popup img {
        width: 100%;
    }
    #close-btn {
        display: none;
    }

    #input-container {
        padding: 20px 6px;
        text-align: center;
    }

    input[type='range'] {
        width: 120px;
        height: 6px;
        margin: 2px;
    }
    input[type='range'][disabled] {
        display: none;
    }
    input[type='range']::-webkit-slider-thumb {
        width: 10px;
        height: 10px;
    }
    input[type='range']::-moz-range-thumb {
        width: 10px;
        height: 10px;
    }
}
