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

/* SVGアイコンスタイル */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: currentColor;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    flex-direction: column;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    color: #555;
}

header h1 {
    font-size: 2.5rem;
    margin: 20px 0 10px 0;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.3); }
    to { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 255, 255, 0.6); }
}

/* メインコンテンツ */
main {
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 30px;
    align-items: start;
}

/* キャンバスセクション（左側） */
.canvas-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* 設定エリアタブ */
.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
}

.settings-tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #9ca3af;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: -2px;
}

.settings-tab-btn:hover:not(.active) {
    color: #8b5cf6;
}

.settings-tab-btn.active {
    color: #8b5cf6;
    border-bottom-color: #8b5cf6;
    font-weight: 700;
}

.settings-tab-btn .icon {
    font-size: 1.2em;
}

/* 操作モードセクション（独立エリア） */
.operation-mode-section {
    margin: 20px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px solid #8b5cf6;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
}

.operation-mode-section > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #5b21b6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.operation-mode-section .mode-toggle-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.operation-mode-section .mode-btn {
    padding: 14px 20px;
    background: white;
    border: 2px solid #c4b5fd;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #6b21a8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.operation-mode-section .mode-btn .icon {
    width: 18px;
    height: 18px;
}

.operation-mode-section .mode-btn:hover {
    background: #faf5ff;
    border-color: #a78bfa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.2);
}

.operation-mode-section .mode-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-color: #7c3aed;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.operation-mode-section .mode-hint-text {
    margin: 0;
    font-size: 0.875rem;
    color: #6b21a8;
    font-style: italic;
    text-align: center;
    min-height: 20px;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.canvas-container {
    position: relative;
    margin-bottom: 10px;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* グリッド線オーバーレイ（SVG） */
.grid-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.grid-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

/* 削除ボタン（SVG上） */
.delete-button {
    cursor: pointer;
    pointer-events: auto;
}

.delete-button circle {
    transition: fill 0.2s ease;
}

.delete-button:hover circle {
    fill: #dc2626;
}

.delete-button line {
    transition: stroke 0.2s ease;
}

.delete-button:hover line {
    stroke: #ffffff;
}

/* 履歴コントロール（Undo/Redo/すべてクリア） */
.history-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.history-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    color: #64748b;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.history-btn:hover {
    background: #f8fafc;
    color: #8b5cf6;
    border-color: #8b5cf6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.history-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.clear-all-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.clear-all-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.clear-all-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.clear-all-btn .icon {
    width: 16px;
    height: 16px;
}

/* 設定セクション（右側） */
.settings-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.settings-panel {
    background: white;
}

/* 設定パネル */
.settings-panel h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

/* 絵文字ピッカー関連 */
.emoji-textarea-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.emoji-picker-btn {
    position: absolute;
    bottom: 10px;
    left: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #f1f1f1;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.emoji-picker-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

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

.emoji-picker-popup {
    position: absolute;
    top: calc(100% + 5px);
    left: 8px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    background: white;
}

.emoji-picker-popup emoji-picker {
    --emoji-size: 1.8rem;
    --background: #ffffff;
    --border-color: #e2e8f0;
    width: 420px;
    height: 400px;
}

/* 背景画像アップロード */
.background-upload-group {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
}

.background-upload-group > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #555;
}

/* ラジオボタンオプション */
.bg-type-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: #8b5cf6;
    background: #faf5ff;
}

.radio-option input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked {
    accent-color: #8b5cf6;
}

.radio-option input[type="radio"]:checked + span {
    font-weight: 700;
    color: #8b5cf6;
}

.radio-option span {
    font-size: 0.95rem;
    color: #64748b;
}

/* サブコントロール */
.bg-sub-controls {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.bg-sub-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

.bg-sub-controls input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.upload-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(45deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.image-preview {
    margin-top: 15px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.pixelate-checkbox {
    display: flex;
    align-items: center;
    margin-top: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #4b5563;
    user-select: none;
}

.pixelate-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 背景設定エリア（ボーダーなし） */
.background-settings {
    margin-bottom: 25px;
}

.background-settings > label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #4b5563;
    font-size: 1rem;
}

.bg-type-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.radio-option:hover {
    background-color: #f9fafb;
}

.radio-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-option span {
    font-size: 0.95rem;
    color: #4b5563;
}

.bg-sub-controls {
    margin-top: 15px;
}

.bg-sub-controls label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #6b7280;
    font-size: 0.9rem;
}

/* テキストスタンプ入力 */
.text-stamp-input {
    margin-bottom: 25px;
    padding: 20px;
    background: #fefce8;
    border-radius: 12px;
    border: 2px solid #fde047;
}

.text-stamp-input label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #713f12;
}

.text-stamp-large {
    width: 100%;
    padding: 15px;
    border: 2px solid #fde047;
    border-radius: 10px;
    font-size: 1.5rem;
    text-align: center;
    background: white;
    transition: border-color 0.3s ease;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    line-height: 1.4;
}

.text-stamp-large:focus {
    outline: none;
    border-color: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

.hint-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #92400e;
    font-style: italic;
}

/* 枠選択 */
.frame-selector {
    margin-top: 15px;
}

.frame-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #713f12;
}

.frame-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.frame-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: white;
    border: 2px solid #fde047;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #713f12;
}

.frame-btn:hover {
    background: #fef9c3;
    border-color: #eab308;
    transform: translateY(-2px);
}

.frame-btn.active {
    background: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
    border-color: #d97706;
    color: white;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

.frame-preview {
    font-size: 1.5rem;
    font-weight: bold;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.frame-circle {
    border: 3px solid currentColor;
    border-radius: 50%;
}

.frame-round-rect {
    border: 3px solid currentColor;
    border-radius: 8px;
}

.frame-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.frame-btn.active .frame-label {
    color: white;
}


/* 操作モード */
.mode-control {
    margin-top: 15px;
}

.mode-control label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #713f12;
}

/* mode-controlは通常のcontrol-groupのflexレイアウトを上書き */
.control-group.mode-control {
    display: block;
}

.mode-toggle-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.mode-btn {
    padding: 12px 16px;
    background: white;
    border: 2px solid #fde047;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #713f12;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mode-btn .icon {
    width: 16px;
    height: 16px;
}

.mode-btn:hover {
    background: #fef9c3;
    border-color: #eab308;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #eab308 0%, #f59e0b 100%);
    border-color: #d97706;
    color: white;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

.mode-hint-text {
    margin: 0;
    font-size: 0.85rem;
    color: #854d0e;
    font-style: italic;
    min-height: 20px;
}

/* スタンプ入力の無効状態 */
.text-stamp-input.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.text-stamp-input.disabled .text-stamp-large {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

/* サブ見出し */
.sub-heading {
    margin: 25px 0 12px 0;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    color: #334155;
    font-size: 1.05rem;
}

/* スタンプサイズ（ボタン＋カスタム） */
.control-group.stamp-size-group {
    display: block;
}

.control-group.stamp-size-group > label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
}

/* スタンプサイズ入力グループ */
.stamp-size-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stamp-size-input-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
}

.stamp-size-input-group input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* クイックサイズボタン */
.stamp-size-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.stamp-size-quick .size-btn {
    padding: 8px 4px;
    font-size: 0.85rem;
    background: #f1f5f9;
    color: #475569;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.stamp-size-quick .size-btn:hover {
    background: #e0e7ff;
    border-color: #818cf8;
    color: #4f46e5;
    transform: translateY(-1px);
}

.stamp-size-quick .size-btn:active {
    transform: translateY(0);
}

.stamp-size-custom {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stamp-size-custom label {
    font-weight: 600;
    color: #555;
}

.stamp-size-custom input[type="number"] {
    width: 110px;
}

.stamp-size-custom .unit {
    color: #64748b;
    font-weight: 700;
}

/* カラーコントロール */
.color-controls {
    margin-bottom: 20px;
}

.color-picker-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.color-picker-group label {
    font-weight: 500;
    color: #555;
}

.color-picker-group input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.gradient-checkbox {
    display: inline-flex;
    align-items: center;
    margin-left: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #6b7280;
    user-select: none;
}

.gradient-checkbox input[type="checkbox"] {
    display: none;
}

.gradient-checkbox .checkmark {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    transition: all 0.2s ease;
}

.gradient-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #f7fafc;
    color: #333;
    border-color: #8b5cf6;
    font-weight: 600;
}

/* グラデーション設定パネル */
.gradient-controls {
    margin: 15px 0 25px 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.gradient-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 20px;
}

.gradient-tabs {
    display: flex;
    background-color: #f0f0f0;
    border-radius: 8px;
    padding: 2px;
}

.tab-button {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
}

.tab-button.active {
    background: white;
    color: #8b5cf6;
    font-weight: 600;
}

.gradient-angle-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gradient-angle-control select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

.gradient-tab-content {
    display: none;
}

.gradient-tab-content.active {
    display: block;
}

.gradient-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, minmax(45px, 1fr));
    gap: 10px;
    padding: 15px;
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
    aspect-ratio: 5/4;
}

.gradient-option {
    cursor: pointer;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 3px;
    transition: all 0.3s ease;
    background: white;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gradient-option:hover {
    border-color: #8b5cf6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.gradient-option.active {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    transform: scale(1.02);
}

.gradient-preview {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    position: relative;
    min-height: 35px;
}

/* グラデーションプリセットスタイル - HSL基準 */
.gradient-red { background: linear-gradient(45deg, hsl(0, 35%, 95%), hsl(0, 95%, 50%)); }
.gradient-orange-red { background: linear-gradient(45deg, hsl(17, 35%, 95%), hsl(17, 95%, 50%)); }
.gradient-orange { background: linear-gradient(45deg, hsl(35, 35%, 95%), hsl(35, 95%, 50%)); }
.gradient-amber { background: linear-gradient(45deg, hsl(52, 35%, 95%), hsl(52, 95%, 50%)); }
.gradient-yellow { background: linear-gradient(45deg, hsl(70, 35%, 95%), hsl(70, 95%, 50%)); }
.gradient-lime { background: linear-gradient(45deg, hsl(87, 35%, 95%), hsl(87, 95%, 50%)); }
.gradient-green { background: linear-gradient(45deg, hsl(105, 35%, 95%), hsl(105, 95%, 50%)); }
.gradient-emerald { background: linear-gradient(45deg, hsl(122, 35%, 95%), hsl(122, 95%, 50%)); }
.gradient-teal { background: linear-gradient(45deg, hsl(140, 35%, 95%), hsl(140, 95%, 50%)); }
.gradient-cyan { background: linear-gradient(45deg, hsl(157, 35%, 95%), hsl(157, 95%, 50%)); }
.gradient-sky { background: linear-gradient(45deg, hsl(175, 35%, 95%), hsl(175, 95%, 50%)); }
.gradient-blue { background: linear-gradient(45deg, hsl(192, 35%, 95%), hsl(192, 95%, 50%)); }
.gradient-indigo { background: linear-gradient(45deg, hsl(210, 35%, 95%), hsl(210, 95%, 50%)); }
.gradient-violet { background: linear-gradient(45deg, hsl(227, 35%, 95%), hsl(227, 95%, 50%)); }
.gradient-purple { background: linear-gradient(45deg, hsl(245, 35%, 95%), hsl(245, 95%, 50%)); }
.gradient-fuchsia { background: linear-gradient(45deg, hsl(262, 35%, 95%), hsl(262, 95%, 50%)); }
.gradient-magenta { background: linear-gradient(45deg, hsl(280, 35%, 95%), hsl(280, 95%, 50%)); }
.gradient-pink { background: linear-gradient(45deg, hsl(297, 35%, 95%), hsl(297, 95%, 50%)); }
.gradient-rose { background: linear-gradient(45deg, hsl(315, 35%, 95%), hsl(315, 95%, 50%)); }
.gradient-crimson { background: linear-gradient(45deg, hsl(331, 35%, 95%), hsl(331, 95%, 50%)); }

/* カラフルなグラデーション */
.gradient-rainbow { background: linear-gradient(45deg, #ff0000, #ff8c00, #ffd700, #32cd32, #00bfff, #8a2be2); }
.gradient-galaxy { background: linear-gradient(45deg, #2c3e50, #8e44ad, #e74c3c); }
.gradient-cyber { background: linear-gradient(45deg, #00ffff, #ff00ff); }
.gradient-autumn { background: linear-gradient(45deg, #ff8c00, #ff4500, #dc143c); }
.gradient-cosmic { background: linear-gradient(45deg, rgba(80,12,139,0.87), rgba(161,10,144,0.72)); }
.gradient-dream { background: linear-gradient(45deg, rgba(112,246,255,0.33), rgba(221,108,241,0.26), rgba(229,106,253,0.71), rgba(123,183,253,1)); }
.gradient-soft { background: linear-gradient(45deg, rgba(254,253,205,1), rgba(163,230,255,1)); }
.gradient-deep { background: linear-gradient(45deg, rgba(2,37,78,1), rgba(4,56,126,1), rgba(85,245,221,1)); }
.gradient-aqua { background: linear-gradient(45deg, rgba(37,249,245,1), rgba(8,70,218,1)); }
.gradient-passion { background: linear-gradient(45deg, rgba(252,37,103,1), rgba(250,38,151,1), rgba(186,8,181,1)); }
.gradient-spring { background: linear-gradient(45deg, rgba(249,255,182,1), rgba(226,255,172,1)); }
.gradient-sky-peach { background: linear-gradient(45deg, rgba(135,206,235,1), rgba(255,154,139,1), rgba(255,195,160,1), rgba(255,215,0,1)); }
.gradient-prism { background: linear-gradient(45deg, rgba(255,0,128,1), rgba(255,140,0,1), rgba(64,224,208,1), rgba(147,112,219,1)); }
.gradient-sunset { background: linear-gradient(45deg, rgba(255,254,171,1), rgba(252, 163, 111,1), rgba(255,64,175,1)); }
.gradient-bubble { background: linear-gradient(45deg, rgba(242,250,124,1), rgba(252,128,132,0.96), rgba(243,121,180,1), rgba(240,193,248,1)); }
.gradient-ocean-deep { background: linear-gradient(45deg, rgba(83,113,245,1), rgba(107,228,184,1)); }
.gradient-sunset-dream { background: linear-gradient(45deg, rgba(254,122,152,0.81), rgba(255,206,134,1), rgba(172,253,163,0.64)); }
.gradient-fairy-tale { background: linear-gradient(45deg, rgba(255,253,218,1), rgba(246,210,255,1), rgba(152,222,254,1), rgba(251,255,210,1)); }
.gradient-neon-wave { background: linear-gradient(45deg, rgba(247,253,166,1), rgba(128,255,221,1), rgba(255,128,249,1)); }
.gradient-golden-peach { background: linear-gradient(45deg, rgba(255,220,163,1), rgba(129,255,239,1)); }

/* ツール選択 */
.edit-tools-panel {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.edit-tools-panel h4 {
    margin-bottom: 15px;
    color: #374151;
    font-size: 1.1rem;
}

.tool-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

.tool-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: translateY(-2px);
}

.tool-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

.tool-btn svg {
    width: 24px;
    height: 24px;
}

/* ブラシサイズ */
.brush-size-control {
    margin-top: 20px;
}

.brush-size-control label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
}

.brush-size-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.brush-size-btn {
    padding: 8px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s ease;
}

.brush-size-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.brush-size-btn.active {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

/* その他コントロール */
.size-controls {
    margin-bottom: 20px;
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.control-group label {
    font-weight: 500;
    color: #555;
}

.control-group select,
.control-group input[type="number"] {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.control-group select:focus,
.control-group input[type="number"]:focus {
    outline: none;
    border-color: #8b5cf6;
}

/* トグルボタン */
.toggle {
    position: relative;
    width: 80px;
    height: 36px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: white;
    transition: all 0.3s ease;
}

.toggle input[type=checkbox] {
    display: none;
}

.toggle:after {
    content: "非表示";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 36px;
    height: 28px;
    display: block;
    border-radius: 4px;
    background: #f7fafc;
    border: 1px solid #e1e5e9;
    transition: all 0.3s ease;
    text-align: center;
    padding: 6px 0 0;
    font-size: 10px;
    font-weight: 500;
    color: #4a5568;
}

.toggle.checked:after {
    content: "表示";
    left: 38px;
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: white;
}

/* キャンバス */
#pixel-canvas {
    width: 600px;
    height: 600px;
    image-rendering: pixelated;
    border-radius: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    cursor: crosshair;
}

#pixel-canvas.transparent {
    background: 
        linear-gradient(45deg, #ccc 25%, transparent 25%), 
        linear-gradient(-45deg, #ccc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #ccc 75%), 
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ダウンロードセクション */
.download-section {
    text-align: center;
}

#download-btn {
    padding: 15px 30px;
    background: linear-gradient(45deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 10px;
}

#download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.info-text {
    color: #718096;
    font-size: 0.9rem;
}

/* 概要セクション */
.content-footer {
    text-align: center;
    color: #555;
    max-width: 800px;
    margin: 80px auto 0;
    padding: 0 20px;
}

.description h3 {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

.description p {
    font-size: 1.1em;
    margin: 0 0 20px 0;
}

.features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.feature {
    background: rgba(139, 92, 246, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #7c3aed;
}

/* Footer */
.footer {
    background: #262626;
    margin-top: 100px;
    padding-top: 30px;
    text-align: center;
}

.social-section {
    padding-top: 0;
}

.social-header {
    text-align: center;
    margin-top: 30px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand-icon {
    width: 60px;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 30px;
    border-radius: 5px;
    text-decoration: none;
    background: #555;
    color: #fff;
    transition: all 0.3s ease;
}

.social-btn:hover {
    transform: translateY(-3px);
}

.social-btn .icon {
    width: 16px;
    height: 16px;
}

.social-btn .icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.profile-link {
    margin-top: 20px;
    text-align: center;
}

.x-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #1a1a1a;
    border-radius: 20px;
    text-decoration: none;
    color: #e7e9ea;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid #2f3336;
}

.x-profile-btn:hover {
    background: #272c30;
    transform: translateY(-2px);
}

.x-icon {
    font-size: 16px;
    font-weight: bold;
}

.x-handle {
    color: #e7e9ea;
}

/* 関連ツールセクション */
.related-tools {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.5);
}

.related-tools h3 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.related-tools h3 .icon {
    width: 1.2em;
    height: 1.2em;
}

.tool-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.95);
}

.tool-thumbnail {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.tool-info {
    text-align: left;
}

.tool-info h4 {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    color: #7c3aed;
    font-weight: 600;
}

.tool-info p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

.copyright-section {
    text-align: center;
    padding: 15px 20px;
    background-color: rgba(0, 0, 0, 0.2);
    color: #ccc;
    font-size: 0.9em;
    margin-top: 20px;
}

.copyright-link {
    color: #fff;
    text-decoration: none;
}

/* レスポンシブ */
@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    
    #pixel-canvas {
        max-width: 100%;
        height: auto;
    }
}
