* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Noto Sans Thai', sans-serif;
    background: #fafafa;
    color: #222;
}

.section {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section.active {
    display: flex;
    opacity: 1;
}

h1, h2 {
    margin-bottom: 12px;
}

input, textarea, button, .btn-back {
    width: 100%;
    max-width: 360px;
    margin: 8px 0;
    padding: 14px;
    font-size: 16px;
    font-family: inherit;
    border-radius: 10px;
    border: 1px solid #ccc;
}

textarea {
    resize: none;
    height: 90px;
}

button {
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-back {
    background: transparent;
    color: #666;
    border: 1px solid #ccc;
    cursor: pointer;
}

#template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 480px;
}

.template-card {
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    background: #fff;
}

.template-card.selected {
    border-color: #333;
}

.template-card img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #eee;
    border-radius: 8px;
}

#qr-code {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
}

#result-image {
    max-width: 90vw;
    max-height: 60vh;
    border-radius: 12px;
}

#btn-download {
    display: inline-block;
    max-width: 360px;
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
}
