:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #334155;
    --secondary-hover: #475569;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.6);
    --accent: #10b981;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    line-height: 1.6;
}

/* バックグラウンドの装飾 */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}

.blob {
    position: absolute;
    border-radius: 50%;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #7c3aed;
    bottom: -50px;
    right: -50px;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #0ea5e9;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* アプリ容器 */
.app-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    z-index: 1;
}

.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.app-header p {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* カードとグラスモフィズム */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.input-group,
.output-group {
    margin-bottom: 1.5rem;
}

.format-toggle {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary);
    cursor: pointer;
}

/* Adjust textarea heights for split output */
#output-select {
    height: 120px;
}

#output-update {
    height: 180px;
}

/* New Form Grid for Update Tool */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid .input-group {
    margin-bottom: 0;
}

.form-grid input[type="text"] {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-grid input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.input-sub-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
}

.col-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    min-height: 0;
    /* 空の時の高さ確保用（必要に応じて） */
}

.col-option-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s;
}

.col-option-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.col-option-item input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Navigation Tabs */
.app-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    transform: translateY(-2px);
}

.nav-tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(129, 140, 248, 0.2));
    border-color: var(--primary);
    color: #f8fafc;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Options Wrapper for Checkboxes */
.options-wrapper {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.input-group .label-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.input-group .label-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.input-group label {
    margin-bottom: 0;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #94a3b8;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-wrapper label {
    cursor: pointer;
    font-weight: 400;
    font-size: 0.85rem;
    color: #e2e8f0;
    text-transform: none;
    letter-spacing: normal;
}

.input-group .label-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.input-group label {
    margin-bottom: 0;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #94a3b8;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-wrapper label {
    cursor: pointer;
    font-weight: 400;
    font-size: 0.85rem;
    color: #e2e8f0;
    text-transform: none;
    letter-spacing: normal;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

textarea {
    width: 100%;
    height: 180px;
    background-color: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-color);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* コントロール */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--secondary);
    color: #e2e8f0;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

/* アウトプットエリア */
.textarea-wrapper {
    position: relative;
}

#output-text {
    background-color: rgba(0, 0, 0, 0.3);
}

.btn-copy {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    height: auto;
    width: auto;
    color: #e2e8f0;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.copy-icon {
    width: 16px;
    height: 16px;
}

.label-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-msg {
    font-size: 0.8rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 600;
}

.status-msg.show {
    opacity: 1;
}

.app-footer {
    text-align: center;
    margin-top: 2rem;
    color: #64748b;
    font-size: 0.85rem;
}

/* 広告プレースホルダー */
.ad-placeholder {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    min-height: 100px;
    position: relative;
    overflow: hidden;
}

.ad-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* 解説セクション */
.info-section {
    margin-top: 3rem;
}

.info-card {
    border-radius: 20px;
    padding: 2rem;
    text-align: left;
}

.info-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #818cf8;
}

.info-card h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #c084fc;
}

.info-card p {
    color: #94a3b8;
    margin-bottom: 1rem;
}

.info-card ul {
    margin-left: 1.5rem;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.info-card li {
    margin-bottom: 0.5rem;
}

.info-card code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    color: #e2e8f0;
}

/* フッターナビ */
.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-nav a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.footer-nav a:hover {
    color: var(--primary);
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2.5rem;
    position: relative;
    border-radius: 24px;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #94a3b8;
}

.policy-body h3 {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: #f8fafc;
}

.policy-body p {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* 言語切替 */
.lang-switcher {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

#lang-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

#lang-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

#lang-select option {
    background-color: var(--bg-color);
    color: white;
}

@media (max-width: 640px) {
    .app-container {
        padding: 1rem;
    }

    .glass {
        padding: 1.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .app-header h1 {
        font-size: 1.8rem;
    }
}

/* SEO Article Styles */
.seo-article h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--accent);
    padding-left: 0.8rem;
}

.seo-article p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* SQL方言セレクトボックス */
.dialect-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.8rem;
}

.dialect-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.dialect-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.dialect-select option {
    background-color: #1e293b;
    color: #f8fafc;
    padding: 0.5rem;
}

/* タイムスタンプ変換ページ */
.result-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.2rem;
}

.result-grid {
    display: grid;
    gap: 1rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.result-label {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 140px;
}

.result-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-copy-inline {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    color: inherit;
}

.btn-copy-inline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

/* datetime-local入力のカラースキーム */
input[type="datetime-local"] {
    color-scheme: dark;
}

input#input-unix:focus,
input[type="datetime-local"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

/* タイムスタンプ結果テーブル */
.result-table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ts-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.ts-result-table thead th {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ts-result-table tbody tr {
    transition: background 0.15s;
}

.ts-result-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.ts-result-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

.ts-cell,
.ts-cell-mono,
.ts-cell-rel,
.ts-cell-error {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.ts-cell-mono {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #c4b5fd;
}

.ts-cell-rel {
    color: #94a3b8;
    font-size: 0.82rem;
    white-space: nowrap;
}

.ts-cell-error {
    color: #f87171;
    font-style: italic;
}

.ts-cell-copyable {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    white-space: nowrap;
    position: relative;
}

.ts-cell-copyable .ts-val {
    font-family: 'Consolas', 'Monaco', monospace;
    margin-right: 0.4rem;
}

.ts-cell-copyable .btn-copy-inline {
    opacity: 0.3;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.ts-cell-copyable:hover .btn-copy-inline {
    opacity: 1;
}