/* ========================================
   リセット & 基本スタイル
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: #f5f5f5;
    padding: 20px;
}

/* ========================================
   コンテナ
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

/* ========================================
   レイアウト
   ======================================== */
.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ========================================
   入力セクション
   ======================================== */
.input-section {
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
}

.input-section h2 {
    font-size: 18px;
    color: #555;
    margin-bottom: 15px;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    line-height: 1.8;
}

textarea:focus {
    outline: none;
    border-color: #c9a961;
}

/* フォントサイズコントロール */
.font-size-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.font-size-controls label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    font-weight: bold;
}

.size-buttons {
    display: flex;
    gap: 8px;
}

.btn-size {
    flex: 1;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-size:hover {
    border-color: #c9a961;
    background: #fafafa;
}

.btn-size.active {
    border-color: #c9a961;
    background: #c9a961;
    color: white;
}

.btn-size:active {
    transform: scale(0.95);
}

/* 文字色コントロール */
.color-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.color-controls label {
    display: block;
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
    font-weight: bold;
}

.color-picker-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#colorPicker {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    padding: 2px;
}

#colorPicker:hover {
    border-color: #c9a961;
}

.btn-reset-color {
    flex: 1;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: bold;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-reset-color:hover {
    border-color: #c9a961;
    background: #fafafa;
}

.btn-reset-color:active {
    transform: scale(0.95);
}

/* ========================================
   プレビューセクション
   ======================================== */
.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-section h2 {
    font-size: 18px;
    color: #555;
    margin-bottom: 15px;
}

/* メッセージカードのプレビュー */
#messageCard {
    width: 592px; /* 148mm * 4 = 592px (150dpi相当) */
    height: 400px; /* 100mm * 4 = 400px */
    position: relative;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

#cardBackground {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

#cardMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    text-align: center;
    font-size: 32px;
    font-family: "tsukushi-a-round-gothic", "貂明朝テキスト", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "HG明朝E", "MS P明朝", "MS PMincho", serif;
    color: #3C2618;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-weight: 500;
    z-index: 10;
    padding: 40px 20px 80px 20px; /* 下部のロゴエリアを避ける */
    transition: font-size 0.3s ease, color 0.3s ease;
}

/* フォントサイズバリエーション */
#cardMessage.size-small {
    font-size: 24px;
}

#cardMessage.size-medium {
    font-size: 32px;
}

#cardMessage.size-large {
    font-size: 40px;
}

#cardMessage.size-xlarge {
    font-size: 48px;
}

/* ========================================
   ボタン
   ======================================== */
.button-group {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

button {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #c9a961;
    color: white;
}

.btn-primary:hover {
    background: #b89551;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0);
}

/* ========================================
   使い方セクション
   ======================================== */
.instructions {
    margin-top: 30px;
    padding: 20px;
    background: #f0f7ff;
    border-left: 4px solid #2196F3;
    border-radius: 5px;
}

.instructions h3 {
    color: #1976D2;
    font-size: 16px;
    margin-bottom: 10px;
}

.instructions ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

.decoration-note {
    background: #fff9e6;
    border: 2px solid #f4c430;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
}

.decoration-note p {
    margin: 8px 0;
    color: #555;
    line-height: 1.6;
}

.decoration-note strong {
    color: #d97706;
}

.print-settings {
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 5px;
    padding: 15px;
    margin: 15px 0;
}

.print-settings h4 {
    color: #2e7d32;
    font-size: 15px;
    margin-bottom: 10px;
}

.print-settings ul {
    margin-left: 20px;
    color: #555;
    line-height: 1.8;
}

.print-settings strong {
    color: #1b5e20;
}

.print-settings .note {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* ========================================
   ローディング表示
   ======================================== */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    z-index: 1000;
    font-size: 18px;
}

.loading.active {
    display: block;
}

/* ========================================
   レスポンシブ対応
   ======================================== */
@media (max-width: 1200px) {
    .content {
        grid-template-columns: 1fr;
    }

    #messageCard {
        width: 100%;
        max-width: 592px;
        height: auto;
        aspect-ratio: 148 / 100;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
    }

    .button-group {
        flex-direction: column;
        width: 100%;
    }

    button {
        width: 100%;
    }

    #cardMessage {
        font-size: 24px;
    }
}
