/* การดึงฟอนต์มาใช้ */
@font-face {
    font-family: 'Sheikah';
    src: url('sheikah.otf');
}

body {
    background-color: #d1c4a9;
    background-image: radial-gradient(#bcad8f 1px, transparent 1px);
    background-size: 30px 30px; 
    color: #3a352f;
    font-family: 'Palatino', 'Georgia', serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.slate-container {
    width: 95%;
    max-width: 600px;
    background: #f4eee1;
    border: 3px solid #4a3f35;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 10px 10px 0px #8e7f67;
    position: relative;
    margin: 20px 0;
    box-sizing: border-box;
}

.slate-container::before {
    content: "◈";
    position: absolute;
    top: 5px;
    left: 8px;
    color: #4a3f35;
    font-size: 14px;
}

header h1 {
    text-align: center;
    letter-spacing: 3px;
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #1e5a63;
    border-bottom: 2px solid #1e5a63;
    display: block;
    padding-bottom: 10px;
}

#swapBtn, #refBtn {
    display: block;
    margin: 0 auto 15px auto;
    background: #1e5a63;
    color: #f4eee1;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Palatino', serif;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.2s;
}

#refBtn {
    background: #8e7f67;
    margin-top: 20px;
}

#swapBtn:hover, #refBtn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 8px;
    color: #4a3f35;
    text-transform: uppercase;
}

textarea {
    width: 100%;
    height: 100px;
    background: #e9e4d6;
    border: 2px solid #b5a489;
    border-radius: 4px;
    color: #2c2925;
    padding: 12px;
    box-sizing: border-box;
    font-size: 1rem;
    resize: none;
    outline: none;
}

.input-sheikah {
    font-family: 'Sheikah', sans-serif !important;
    font-size: 1.4rem !important;
    word-break: break-all;
}

#mainOutput {
    width: 100%;
    min-height: 120px;
    background: #ffffff;
    border: 2px inset #d4c3a3;
    padding: 20px;
    box-sizing: border-box;
    margin-top: 5px;
    border-radius: 4px;
    text-align: center;
    word-wrap: break-word;
    word-break: break-all; 
    overflow-wrap: anywhere;
    white-space: normal;
    display: block; 
}

.sheikah-font {
    font-family: 'Sheikah', sans-serif;
    font-size: 2.2rem;
    color: #26a5b5;
    line-height: 1.4;
    width: 100%;
    display: inline-block;
}

.normal-font {
    font-family: 'Palatino', serif !important;
    font-size: 1.4rem !important;
    color: #3a352f !important;
}

/* Modal Styles */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #f4eee1;
    margin: 10vh auto;
    padding: 25px;
    border: 3px solid #4a3f35;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #4a3f35;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.chart-item {
    background: #e9e4d6;
    padding: 8px;
    text-align: center;
    border: 1px solid #d4c3a3;
    border-radius: 4px;
}

.chart-item span {
    display: block;
    font-size: 0.7rem;
    margin-bottom: 5px;
    color: #8e7f67;
}

footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.7rem;
    color: #b5a489;
}

@media (max-width: 600px) {
    .sheikah-font { font-size: 1.6rem; }
    .modal-content { width: 95%; margin: 5vh auto; }
}