/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ADD8E6;
    --primary-dark: #87CEEB;
    --primary-light: #E0F4FF;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --text-primary: #263238;
    --text-secondary: #546E7A;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #E0F4FF 0%, #ADD8E6 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.title {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* カード */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: fadeInUp 0.6s ease-out;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

/* 貼り付けエリア */
.paste-area {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--primary-light);
    margin-bottom: 20px;
    color: #000000;
}

.paste-area:hover,
.paste-area:focus {
    border-color: var(--primary-dark);
    background: white;
    outline: none;
}

.paste-area.drag-over {
    background: var(--primary-color);
    border-color: var(--primary-dark);
    transform: scale(1.02);
}

.paste-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    color: #000000;
}

.paste-area p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 5px 0;
}

.hint {
    font-size: 0.9rem !important;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ボタン */
.btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: #000000;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #000000;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-secondary {
    background: #9E9E9E;
    color: white;
}

.btn-secondary:hover {
    background: #757575;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* プレビューセクション */
.image-preview {
    margin-bottom: 20px;
    text-align: center;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: #f5f5f5;
}

.image-preview img {
    max-width: 100%;
    max-height: 500px;
    display: block;
    margin: 0 auto;
    border-radius: var(--border-radius);
}

.image-info {
    background: #FFFFFF;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #000000;
    border: 1px solid var(--primary-light);
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

/* リサイズセクション */
.resize-section {
    border-top: 2px solid var(--primary-light);
    padding-top: 25px;
    margin-top: 25px;
}

.resize-section h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.resize-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.input-group input[type="number"] {
    padding: 10px;
    border: 2px solid var(--primary-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.resize-mode {
    margin-bottom: 20px;
}

.resize-mode>label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 10px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--primary-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: #000000;
}

.radio-label:hover {
    background: var(--primary-color);
    color: #000000;
}

.radio-label input[type="radio"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.radio-label span {
    font-size: 0.95rem;
    color: #000000;
}

/* 履歴セクション */
.history-controls {
    margin-bottom: 15px;
    text-align: right;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.history-item {
    position: relative;
    cursor: pointer;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    background: #f5f5f5;
}

.history-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.history-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.history-item .item-info {
    padding: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: white;
}

.history-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.history-item:hover .delete-btn {
    opacity: 1;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

/* フッター */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--text-primary);
    color: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(100px);
    transition: var(--transition);
    z-index: 1000;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* アニメーション */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .card {
        padding: 20px;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .resize-controls {
        grid-template-columns: 1fr;
    }

    .history-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #E0E0E0;
        --text-secondary: #B0B0B0;
    }

    body {
        background: linear-gradient(135deg, #1a2332 0%, #0d1b2a 100%);
    }

    .card {
        background: #1e2936;
    }

    .paste-area {
        background: #2a3847;
    }

    .image-preview,
    .history-item {
        background: #2a3847;
    }

    .image-info {
        background: #FFFFFF;
        color: #000000;
    }

    .history-item .item-info {
        background: #1e2936;
    }
}