html, body {
    min-height: 100vh;
}
/* PC時: キャンバスとサイドパネルを横並び */
.main-flex {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    width: 100%;
    height: 85vh;
    max-width: 1000px;
    margin: 0 auto;
    box-sizing: border-box;
}
.side-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 260px;
    max-width: 420px;
    width: 100%;
    margin: 18px;
}

@media (max-width: 900px) {
    .main-flex {
        flex-direction: column;
        align-items: center;
        gap: 0;
        max-width: 100vw;
        height: fit-content;
    }
    .side-panel {
        width: 100%;
        max-width: 100vw;
        align-items: center;
        min-width: 0;
    }
    .controls,
    textarea,
    .custom-file-label,
    #fileNameDisplay {
        max-width: 98vw;
        min-width: 0;
        width: 100%;
        font-size: 1rem;
    }
    #previewCanvas {
        max-width: 98vw;
        min-width: 0;
        height: 38vw;
        min-height: 120px;
    }
    .button-container {
        flex-direction: column;
        gap: 10px;
    }
    button {
        width: 100%;
        font-size: 1rem;
        padding: 10px 0;
    }
    .site-footer {
        font-size: 0.9rem;
        padding: 10px 0 8px 0;
    }
    .site-header h1 {
        font-size: 1.2rem;
        padding: 0 8px;
    }
    main {
        padding: 0 4px;
    }
}
main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
/* ヘッダー・フッター */
.site-header {
    width: 100%;
    background: var(--accent-color);
    color: var(--white);
    text-align: center;
    padding: 24px 0 12px 0;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px var(--shadow-header);
}
.site-header h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.04em;
    font-weight: bold;
}

.site-footer {
    width: 100%;
    background: var(--gray-light);
    color: var(--gray-dark);
    text-align: center;
    padding: 16px 0 10px 0;
    font-size: 0.98rem;
    margin-top: 32px;
    border-top: 1px solid var(--gray-border);
}
@media (prefers-color-scheme: dark) {
    .site-footer {
        background: var(--gray-light);
        color: var(--gray-dark);
        border-top: 1px solid var(--gray-border);
    }
}
/* テーマ共通の変数 */
:root {
    --bg-color: #ffffff;
    --text-color: #222222;
    --accent-color: #0077ff;
    --white: #fff;
    --black: #000;
    --gray-light: #f5f5f5;
    --gray-dark: #888;
    --gray-border: #e0e0e0;
    --shadow-light: rgba(0,0,0,0.08);
    --shadow-medium: rgba(0,0,0,0.10);
    --shadow-header: rgba(0,0,0,0.06);
    --file-label-border: #fff2;
}

/* ダークテーマ用 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #181a1b;
        --text-color: #f1f1f1;
        --accent-color: #4fc3f7;
        --white: #181a1b;
        --black: #f1f1f1;
        --gray-light: #23272b;
        --gray-dark: #aaa;
        --gray-border: #333;
        --shadow-light: rgba(0,0,0,0.08);
        --shadow-medium: rgba(0,0,0,0.10);
        --shadow-header: rgba(0,0,0,0.06);
        --file-label-border: #fff2;
    }
    .custom-file-label {
        color: #fff;
    }
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
}

a {
    color: var(--accent-color);

}

body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 400px;
    margin: 18px;
    align-items: center;
}

#previewCanvas {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px var(--shadow-light);
    margin: 20px;
    width: 100%;
    max-width: 480px;
    height: 270px;
    display: block;
}

.button-container {
    display: flex;
    gap: 16px;
    justify-content: center;
}

button {
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 1px 4px var(--shadow-light);
    transition: background 0.2s, transform 0.1s;
}
button:hover {
    background: #005bb5;
    transform: translateY(-2px) scale(1.04);
}

textarea {
    width: 100%;
    max-width: 400px;
    height: 200px;
    border-radius: 6px;
    border: 1px solid #ccc;
    padding: 10px 12px;
    font-size: 1rem;
    resize: none;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
}


/* ファイル選択のカスタムデザイン */
.controls label[for="imageInput"] {
    margin-bottom: 4px;
    font-weight: bold;
    color: var(--text-color);
    cursor: pointer;
    display: block;
}

.controls input[type="file"] {
    display: none;
}

.custom-file-label {
    display: block;
    width: 100%;
    max-width: 400px;
    background: var(--accent-color);
    color: var(--white);
    text-shadow: 0 1px 4px rgba(0,0,0,0.18);
    padding: 10px 0;
    border-radius: 8px;
    font-size: 1.08rem;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s, color 0.2s;
    font-weight: bold;
    border: 2px solid var(--file-label-border);
    box-shadow: 0 2px 8px var(--shadow-medium);
    letter-spacing: 0.03em;
    text-align: center;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}
.custom-file-label:hover {
    background: #005bb5;
    color: var(--white);
}

/* 選択したファイル名表示用 */
#fileNameDisplay {
    margin-left: 8px;
    color: var(--text-color);
    font-size: 0.95rem;
    display: block;
    text-align: center;
    max-width: 400px;
    margin: 0 auto 8px auto;
    word-break: break-all;
}
