:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 50%, #7c3aed 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(14, 165, 233, 0.3), transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(124, 58, 237, 0.3), transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.2), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0ea5e9 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.language-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.language-selector select:hover {
    border-color: var(--primary-color);
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

/* タブ */
.mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* モードパネル */
.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* エンコード/デコード切り替え */
.direction-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.direction-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.direction-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.direction-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* テキストパネル */
.text-panels {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-group {
    display: flex;
    flex-direction: column;
}

.label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.text-area {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: 'Courier New', Consolas, monospace;
    transition: all 0.2s;
    resize: vertical;
    line-height: 1.5;
}

.text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.text-area.error {
    color: var(--error-color);
}

.text-area[readonly] {
    background: var(--bg-secondary);
}

.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.3rem;
    padding: 0 0.25rem;
}

.byte-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-icon:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.arrow-divider {
    display: flex;
    justify-content: center;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}

.arrow-divider svg {
    width: 24px;
    height: 24px;
}

/* ドロップゾーン */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-color);
}

.file-input-hidden {
    display: none;
}

/* ファイル結果 */
.file-result {
    transition: all 0.3s;
}

.file-result.hidden {
    display: none;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-all;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: 1rem;
}

.file-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}

/* ボタン */
.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.4);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* 機能セクション */
.features {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
}

.features-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 通知 */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success { background: var(--success-color); }
.notification-error { background: var(--error-color); }
.notification-info { background: var(--info-color); }

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .title {
        font-size: 1.6rem;
    }

    .main-content {
        padding: 1.25rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .file-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .language-selector {
        position: static;
        margin-top: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}