:root {
    --bg-color: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.85);
    --input-bg: #ffffff;
    --accent: #ffae00;
    /* Orange-Yellow for pop */
    --accent-glow: rgba(255, 174, 0, 0.2);
    --text-main: #333333;
    --text-muted: #666666;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 174, 0, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 162, 255, 0.05) 0%, transparent 40%);
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    margin-bottom: 20px;
    text-align: center;
}

h1 {
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 5px;
    color: #2d3748;
}

h1 .subtitle {
    font-weight: 400;
    color: var(--accent);
}

header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    overflow: hidden;
    /* For inner scrolling */
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        overflow: visible;
        height: auto;
    }

    .app-container {
        height: auto;
    }
}

/* Panels */
.input-panel,
.output-panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(20px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.panel-section {
    margin-bottom: 24px;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

h3 {
    font-size: 1rem;
    margin-bottom: 10px;
}

/* Style Grid */
.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
}

.style-card {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.style-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.style-card.active {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 15px var(--accent-glow);
}

.style-card .icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.style-card .label {
    font-size: 0.9rem;
    font-weight: bold;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: bold;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent);
    background: rgba(255, 215, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.full-text-area {
    min-height: 300px;
    line-height: 1.6;
}

/* Step Items */
.step-item {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.step-item input {
    margin-bottom: 8px;
    font-weight: bold;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: #ffea5c;
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    width: 100%;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}


/* Image Upload */
.image-upload-area {
    margin-top: 10px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f1f3f5;
    position: relative;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.image-upload-area:hover,
.image-upload-area.dragover {
    border-color: var(--accent);
    background: rgba(255, 174, 0, 0.05);
}

.upload-placeholder .icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 5px;
}

.image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
}

/* API Section */
.api-section {
    background: #fff;
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.api-section h4 {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-main);
}

.api-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.btn-sm {
    padding: 8px 15px;
    background: var(--text-main);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.api-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.api-status.active {
    color: #2ecc71;
    font-weight: bold;
}

/* Output Area */
.sticky-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

.preview-box {
    flex: 1;
    background: #000;
    border-radius: 8px;
    padding: 15px;
    overflow: auto;
    font-family: 'Consolas', monospace;
    color: #0f0;
    border: 1px solid #333;
}

pre {
    white-space: pre-wrap;
    word-break: break-all;
}

.status-msg {
    height: 20px;
    margin-top: 10px;
    color: var(--accent);
    font-size: 0.9rem;
    text-align: right;
}

.note {
    background: rgba(0, 150, 255, 0.1);
    border: 1px solid rgba(0, 150, 255, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding-top: 10px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
}