:root {
    --bg-gradient: linear-gradient(135deg, #fdf8f0 0%, #fef9f2 50%, #fdf4e7 100%);
    --panel-bg: rgba(255, 252, 245, 0.85);
    --panel-border: rgba(180, 150, 100, 0.18);
    --primary-accent: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    --success-accent: linear-gradient(135deg, #10b981 0%, #047857 100%);
    --danger-accent: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --text-main: #3b2a14;
    --text-muted: #8a6f4e;
    --input-bg: rgba(255, 249, 238, 0.9);
    --input-border: rgba(180, 150, 100, 0.3);
    --input-focus: #b45309;
    --font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    --shadow-md: 0 10px 25px -5px rgba(120, 80, 20, 0.12), 0 8px 10px -6px rgba(120, 80, 20, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #b45309, #92400e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Glassmorphism Panel */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5c3d1e;
    border-left: 4px solid #b45309;
    padding-left: 12px;
}

/* Buttons */
button {
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(180, 83, 9, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Table Design */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.equal-columns {
    table-layout: fixed;
}

.equal-columns th {
    width: auto !important;
}

.cell-scroll {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

.cell-scroll .no-break {
    white-space: nowrap;
}

th {
    background: rgba(180, 150, 100, 0.1);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px 20px;
    border-bottom: 2px solid var(--panel-border);
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--panel-border);
    vertical-align: middle;
    color: #4a3220;
}

tr:hover td {
    background: rgba(180, 150, 100, 0.06);
}

/* Links to Detail */
.detail-link {
    color: #b45309;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.detail-link:hover {
    color: #92400e;
    text-decoration: underline;
}

/* パフォーマンス追加エリア */
.add-performance-area {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: stretch;
}

.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.nav-button {
    justify-self: start;
    margin-bottom: 12px;
}

.result-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
}

.search-card,
.result-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search-card button.btn-secondary {
    justify-self: start;
    width: fit-content;
}

@media (max-width: 900px) {
    .search-grid {
        grid-template-columns: 1fr;
    }
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(253, 248, 240, 0.97);
    border: 1px solid #b45309;
    border-radius: 8px;
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
    color: var(--text-main);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-success {
    border-color: #10b981;
}

.toast-error {
    border-color: #ef4444;
}

/* Loading spinner */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 改行制御 */
.no-break {
    white-space: nowrap;
    display: inline-block;
}

.breakable {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* display_performance 1_0_6 form styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 24px;
    align-items: start;
    margin-bottom: 20px;
}

.detail-left {
    display: block;
}

.detail-right {
    display: grid;
    gap: 20px;
}

.detail-form-grid {
    grid-template-columns: 1fr;
}

.video-panel {
    min-height: 360px;
}

@media (max-width: 920px) {
    .detail-split {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15);
    background: rgba(255, 250, 240, 1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    margin-top: 10px;
}

.checkbox-container input {
    display: none;
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--input-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox-container input:checked + .custom-checkbox {
    background: var(--primary-accent);
    border-color: transparent;
}

.checkbox-container input:checked + .custom-checkbox::after {
    content: '✓';
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.url-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.url-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.url-item {
    display: flex;
    align-items: stretch;
    gap: 10px;
    border: 1px solid rgba(180, 150, 100, 0.3);
    background: rgba(255, 249, 238, 0.95);
    border-radius: 12px;
    padding: 12px;
}

.url-item input {
    flex: 1;
    border: 1px solid rgba(180, 150, 100, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    background: transparent;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
}

.remove-url-btn {
    width: 40px;
    min-width: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(244, 63, 94, 0.1);
    color: #b91c1c;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.remove-url-btn:hover {
    background: rgba(244, 63, 94, 0.18);
}

.url-add {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.url-helptext {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 100%;
}

.url-empty {
    padding: 18px 16px;
    border: 1px dashed rgba(180, 150, 100, 0.5);
    border-radius: 12px;
    color: var(--text-muted);
    background: rgba(255, 252, 245, 0.7);
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-main);
    transform: translateX(-4px);
}

.btn-success {
    background: var(--success-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.4);
}

.btn-secondary {
    background: rgba(180, 150, 100, 0.12);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(180, 150, 100, 0.18);
}

/* Global Header */
.global-header {
    width: 100%;
    max-width: 1200px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px 30px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    margin-bottom: 30px;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #b45309, #92400e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    text-align: center;
}

.header-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.header-nav a {
    font-weight: 600;
    color: #b45309;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    transition: var(--transition);
}

.header-nav a:hover {
    background: rgba(180, 150, 100, 0.12);
    color: #92400e;
}

.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 戻るボタンを左に */
    padding: 10px 0;
}

/* 戻るボタンは左寄せ */
.page-header .back-link {
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    z-index: 2; /* タイトルより前に出す */
}

/* タイトルを中央に固定 */
.page-header h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    body {
        padding: 12px 4px;
    }

    .container {
        gap: 16px;
    }

    .panel {
        padding: 12px 8px;
        border-radius: 10px;
    }

    h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
        gap: 6px;
        padding-left: 8px;
    }

    button {
        font-size: 0.88rem;
        padding: 9px 12px;
        gap: 5px;
    }

    .form-grid {
        gap: 12px;
        margin-bottom: 14px;
    }

    .form-group {
        gap: 5px;
    }

    input[type="text"],
    input[type="number"],
    textarea {
        padding: 9px 10px;
        font-size: 0.88rem;
        border-radius: 6px;
    }

    textarea {
        min-height: 96px;
    }

    .form-actions {
        margin-top: 6px;
    }

    .search-bar {
        gap: 6px;
        flex-wrap: nowrap;
    }

    .search-bar input {
        min-width: 0;
        flex: 1 1 auto;
    }

    .search-bar button {
        flex: 0 0 auto;
    }

    .search-card,
    .result-card,
    .table-responsive {
        min-width: 0;
        max-width: 100%;
    }

    .table-responsive {
        overflow-x: auto;
    }

    table {
        table-layout: fixed;
    }

    th,
    td {
        padding: 10px 6px;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .no-break {
        white-space: normal;
    }

    .toast {
        right: 10px;
        bottom: 10px;
        left: 10px;
        padding: 10px 12px;
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .global-header {
        padding: 12px 8px;
        margin-bottom: 16px;
    }

    .header-nav {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .header-nav a {
        padding: 6px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}
