/* メインスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

.auth-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-info .user-name {
    font-weight: 500;
}

.auth-info .time {
    font-size: 0.9rem;
    opacity: 0.9;
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-login {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.btn-login:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.btn-logout:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.btn-primary {
    background: #667eea;
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: #5568ca;
}

.btn-danger {
    background: #d9534f;
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background: #c9302c;
}

/* タブナビゲーション */
.tabs {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0;
}

.tab-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    gap: 4px;
    padding-top: 8px;
}

.tab {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    color: #6c757d;
    background: #e9ecef;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tab:hover {
    background: #f8f9fa;
    color: #495057;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab.active {
    background: #fff;
    color: #667eea;
    border-color: #667eea;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    z-index: 1;
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(102, 126, 234, 0.15);
}

.tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 8px 8px 0 0;
}

.tab.admin-tab {
    color: #8a1c1c;
    background: #fdeaea;
    border-color: #f3c2c2;
}

.tab.admin-tab:hover {
    background: #fde0e0;
    color: #731515;
    box-shadow: 0 2px 8px rgba(184, 54, 54, 0.15);
}

.tab.admin-tab.active {
    background: #fff;
    color: #b42323;
    border-color: #d94d4d;
    box-shadow: 0 -2px 8px rgba(184, 54, 54, 0.2);
}

.tab.admin-tab.active::before {
    background: linear-gradient(90deg, #d94d4d, #b42323);
}

/* メインコンテンツ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 2rem 2rem;
    background: #fff;
    min-height: calc(100vh - 200px);
}

.page-content {
    background: transparent;
    padding: 2rem 0;
}

.board-edit-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.65rem;
}

.page-content h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f1f3f4;
}

.page-content p {
    color: #666;
    margin-bottom: 2rem;
}

/* カード */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.card h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.card p {
    color: #666;
    margin-bottom: 0;
}

/* プレースホルダーコンテンツ */
.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.loading-message {
    font-size: 1.1rem;
    font-style: italic;
}

.settings-login-required {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #f6f8ff;
    border: 1px solid #dde3ff;
    color: #4a5480;
}

.settings-firebase-error {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #fff5f5;
    border: 1px solid #f7c9c9;
    color: #8d1b1b;
}

.settings-card {
    margin-top: 1rem;
    background: #ffffff;
    border: 1px solid #e7ebf2;
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f8;
}

.settings-row:last-of-type {
    border-bottom: none;
}

.settings-row label {
    font-weight: 600;
    color: #3d4666;
}

.settings-row input {
    width: 100%;
    max-width: 420px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #c8d0e1;
    padding: 0 0.75rem;
    font-size: 14px;
}

.settings-row input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.settings-row.readonly span {
    color: #2f3650;
    word-break: break-word;
}

.settings-discord-value {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.settings-link-dialog {
    width: min(560px, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid #cfd6e3;
    border-radius: 8px;
    color: #26334d;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(20, 28, 44, 0.24);
}

.settings-link-dialog::backdrop {
    background: rgba(20, 28, 44, 0.58);
}

.settings-link-dialog-content {
    padding: 1.25rem;
}

.settings-link-dialog-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.settings-link-dialog-content p {
    margin: 0 0 1rem;
    color: #4f5d75;
}

.settings-link-copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 0.5rem;
}

.settings-link-copy-row input,
.settings-link-field input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #aeb8ca;
    border-radius: 6px;
    font: inherit;
}

.settings-link-copy-row input {
    background: #f4f6fa;
}

.settings-icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid #aeb8ca;
    border-radius: 6px;
    background: #ffffff;
    color: #26334d;
    font-size: 1.25rem;
    cursor: pointer;
}

.settings-link-field {
    display: grid;
    gap: 0.4rem;
    margin-top: 1rem;
    color: #3d4666;
    font-weight: 600;
}

.settings-link-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.settings-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-status {
    min-height: 24px;
    font-size: 0.9rem;
    color: #5f6a8a;
}

.settings-status.success {
    color: #0b7a35;
}

.settings-status.error {
    color: #b42318;
}

.clan-summary-card h3 {
    margin: 0 0 0.75rem 0;
    color: #3d4666;
    font-size: 1.05rem;
}

.clan-show-all-active-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.35rem 0 0.85rem;
    color: #26334d;
    font-weight: 600;
}

.clan-attack-active-panel {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid #f1b84b;
    border-left: 5px solid #d58a00;
    border-radius: 6px;
    background: #fff7e6;
    color: #493616;
}

.clan-attack-active-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.clan-attack-active-header h2,
.clan-attack-active-header p {
    margin: 0;
}

.clan-active-boss-hp-block {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.clan-active-boss-hp-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.clan-active-boss-hp-input {
    width: 12ch;
    min-height: 38px;
    padding: 0 0.55rem;
    border: 1px solid #c8a85d;
    border-radius: 6px;
    background: #ffffff;
    color: #26334d;
    font: inherit;
    text-align: right;
}

.clan-attack-active-header h2 {
    color: #704600;
    font-size: 1.2rem;
}

.clan-attack-member-list {
    margin-top: 1rem;
    border-top: 1px solid #efd49b;
}

.clan-attack-member-row {
    display: grid;
    grid-template-columns: minmax(100px, 0.8fr) minmax(180px, 2fr);
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #efd49b;
    align-items: center;
}

.clan-attack-member-row span {
    overflow-wrap: anywhere;
}

.clan-attack-message-label {
    display: block;
    margin-top: 1rem;
    color: #493616;
    font-weight: 600;
}

.clan-attack-message-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.clan-attack-message-input {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 0.75rem;
    border: 1px solid #c8a85d;
    border-radius: 6px;
    background: #ffffff;
    color: #26334d;
    font: inherit;
}

.clan-attack-message-input:focus {
    outline: 2px solid #d58a00;
    outline-offset: 1px;
}

.clan-attack-active-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

#clan-attack-complete-button {
    background: #2f9e44;
}

#clan-attack-complete-button:hover:not(:disabled) {
    background: #2b8a3e;
}

.clan-defeat-buttons {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.clan-overtime-anchor {
    position: relative;
    display: flex;
}

.clan-overtime-dialog {
    position: absolute;
    inset: auto;
    top: calc(100% + 0.5rem);
    left: 50%;
    z-index: 10;
    width: min(280px, calc(100vw - 2rem));
    margin: 0;
    padding: 0;
    transform: translateX(-50%);
    border: 1px solid #d7dce6;
    border-radius: 8px;
    background: #ffffff;
    color: #26334d;
    box-shadow: 0 18px 50px rgba(28, 35, 55, 0.22);
}

.clan-overtime-dialog::backdrop {
    background: rgba(24, 30, 44, 0.52);
}

.clan-overtime-dialog-content {
    padding: 1rem;
}

.clan-overtime-dialog-content h3 {
    margin: 0 0 0.75rem;
    color: #26334d;
    font-size: 1.05rem;
}

.clan-overtime-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.clan-overtime-input {
    width: 5.5ch;
    min-height: 40px;
    padding: 0 0.35rem;
    border: 1px solid #aeb8ca;
    border-radius: 6px;
    font: inherit;
    font-size: 1.1rem;
    text-align: right;
}

.clan-overtime-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .clan-active-boss-hp-block {
        width: 100%;
        justify-content: flex-start;
    }

    .clan-active-boss-hp-actions {
        width: 100%;
    }

    .clan-active-boss-hp-input {
        flex: 1 1 140px;
    }

    .clan-attack-member-row {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .clan-attack-message-row {
        flex-wrap: wrap;
    }

    .clan-attack-message-row > .btn {
        flex: 1 1 100%;
    }

    .clan-attack-active-actions > .btn {
        flex: 1 1 100px;
    }

    .clan-defeat-buttons {
        flex: 1 1 100%;
    }

    .clan-defeat-buttons > .btn {
        flex: 1 1 calc(25% - 0.4rem);
        min-width: 88px;
    }

    .clan-overtime-anchor {
        flex: 1 1 100px;
    }

    .clan-overtime-anchor > .btn {
        width: 100%;
    }
}

.clan-bosscount-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.clan-bosscount-header h3 {
    margin: 0;
}

.clan-bosscount-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clan-empty {
    margin: 0;
    color: #5f6a8a;
}

.clan-attack-history-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e7ebf2;
}

.clan-attack-history-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.clan-attack-history-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    table-layout: fixed;
}

.clan-attack-history-table th,
.clan-attack-history-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e7ebf2;
    text-align: left;
}

.clan-attack-history-table th {
    background: #f6f8fb;
    color: #3d4666;
    font-weight: 600;
}

.clan-attack-history-table tbody tr:last-child td {
    border-bottom: none;
}

.clan-attack-history-carryover-source td {
    background: #fff3bf;
}

.clan-history-input {
    display: none;
}

.clan-attack-history-table input,
.clan-attack-history-table select {
    width: 100%;
    min-height: 38px;
    padding: 0 0.55rem;
    border: 1px solid #aeb8ca;
    border-radius: 6px;
    background: #ffffff;
    color: #26334d;
    font: inherit;
}

.clan-history-state-editor {
    grid-template-columns: minmax(90px, 1fr) minmax(70px, 0.7fr) auto;
    gap: 0.4rem;
    align-items: center;
}

.clan-history-overtime-unit {
    white-space: nowrap;
}

.clan-history-delete-button {
    width: auto;
    white-space: nowrap;
}

.bosscount-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.bosscount-item {
    background-color: #d7ebff;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    border-left: 4px solid #0b5ed7;
    box-shadow: 0 2px 8px rgba(11, 94, 215, 0.2);
}

.bosscount-item.bosscount-near-min {
    background-color: #ffe6e6;
    border-left-color: #d9534f;
}

.bosscount-item.bosscount-far-min {
    background-color: #ececec;
    border-left-color: #8a8a8a;
}

.bosscount-item p {
    margin: 0;
    font-size: 14px;
}

.clan-attacking-members {
    display: flex;
    min-height: 1.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 0.25rem 0.5rem;
}

.clan-attacking-member-name {
    color: #26334d;
    font-size: 0.85rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.clan-attack-button {
    width: 100%;
    min-height: 38px;
    margin-top: 0.5rem;
}

.clan-bosslap-input {
    width: 72px;
    margin: 0.35rem auto 0;
    border: 1px solid #c8d0e1;
    border-radius: 6px;
    padding: 0.2rem 0.35rem;
    font-size: 14px;
    text-align: center;
}

.clan-bosslap-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.clan-lap-table-wrap {
    overflow-x: auto;
}

.clan-lap-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e3e8f4;
    border-radius: 10px;
    overflow: hidden;
}

.clan-lap-table th,
.clan-lap-table td {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid #edf1f8;
    text-align: left;
    white-space: nowrap;
}

.clan-lap-table th {
    background: #f7f9ff;
    color: #3a4568;
    font-size: 0.9rem;
}

.clan-lap-table tbody tr:last-child td {
    border-bottom: none;
}

.board-page-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid #f1f3f4;
    margin-bottom: 1rem;
}

.board-page-title-row h2 {
    margin-bottom: 0;
    border-bottom: none;
}

.board-help-toggle-btn {
    background: #eef3ff;
    color: #2f4ca3;
    border: 1px solid #c9d7ff;
    font-weight: 600;
    padding: 8px 14px;
}

.board-help-toggle-btn:hover {
    background: #e3ebff;
    color: #253d84;
}

.board-help-panel {
    margin: 0 0 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: #f8faff;
    border: 1px solid #dbe5ff;
    color: #2e3d6b;
}

.board-help-panel h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.board-help-panel ul {
    margin: 0;
    padding-left: 1.25rem;
}

.board-help-panel li + li {
    margin-top: 0.35rem;
}

.board-header {
    margin-bottom: 0.75rem;
}

.board-list-table-wrap {
    overflow-x: auto;
}

.board-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    background: #ffffff;
    border: 1px solid #e3e8f4;
    border-radius: 12px;
    overflow: hidden;
}

.board-list-table th,
.board-list-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #edf1f8;
    vertical-align: middle;
    text-align: left;
}

.board-list-table th {
    background: #f7f9ff;
    color: #3a4568;
    font-size: 0.92rem;
    font-weight: 700;
}

.board-filter-header {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.board-filter-icon-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #c9d7ff;
    border-radius: 50%;
    background: #eef3ff;
    color: #2f4ca3;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.board-filter-icon-btn:hover {
    background: #e3ebff;
}

.board-filter-icon-btn.is-active {
    background: #2f4ca3;
    border-color: #2f4ca3;
    color: #ffffff;
}

.board-filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    padding: 0.25rem;
    border: 1px solid #c9d7ff;
    border-radius: 8px;
    background: #ffffff;
    color: #2f3c62;
    z-index: 10;
    box-shadow: 0 8px 18px rgba(21, 37, 84, 0.15);
}

.board-filter-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    color: #2f3c62;
    text-align: left;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.board-filter-menu-item:hover {
    background: #eef3ff;
}

.board-filter-menu-item.is-active {
    background: #2f4ca3;
    color: #ffffff;
}

.board-list-table tbody tr:last-child td {
    border-bottom: none;
}

.board-list-title-cell a {
    color: #2a3a6c;
    font-weight: 700;
    text-decoration: none;
}

.board-list-title-cell a:hover {
    text-decoration: underline;
}

.board-list-party-icons {
    display: grid;
    grid-template-columns: repeat(5, 40px);
    gap: 0.35rem;
    align-items: center;
}

.board-list-party-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #f2f5ff;
    border: 1px solid #d9e0f0;
}

.board-list-party-icon-missing,
.board-list-party-icon-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    color: #7c86a5;
    text-align: center;
    line-height: 1.05;
    padding: 0.12rem;
}

.board-list-party-icon-empty {
    border-style: dashed;
    background: #fafbff;
}

.board-list-filter-toolbar {
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.board-list-filter-status {
    color: #4b587d;
    font-size: 0.9rem;
    font-weight: 600;
}

.board-diff-section {
    margin-top: 1rem;
    padding: 0.9rem;
    border: 1px solid #dfe5f4;
    border-radius: 12px;
    background: #f8faff;
}

.board-diff-section h3 {
    margin: 0 0 0.75rem 0;
    color: #33406c;
    font-size: 1.02rem;
}

.board-diff-timelog-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.board-diff-textarea {
    width: 100%;
    border: 1px solid #c8d0e1;
    border-radius: 9px;
    background: #ffffff;
    color: #2f3650;
    font-size: 0.9rem;
    padding: 0.5rem 0.65rem;
    resize: vertical;
}

.board-diff-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.14);
}

.board-diff-actions {
    display: flex;
    justify-content: flex-end;
}

.board-diff-error {
    margin-top: 0.55rem;
    margin-bottom: 0;
    color: #b42323;
    font-weight: 600;
}

.board-diff-candidate-wrap,
.board-diff-table-wrap {
    overflow-x: auto;
}

.board-diff-candidate-table,
.board-diff-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #e3e8f4;
    border-radius: 12px;
    overflow: hidden;
}

.board-diff-candidate-table th,
.board-diff-candidate-table td,
.board-diff-table th,
.board-diff-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #edf1f8;
    text-align: left;
    vertical-align: middle;
}

.board-diff-candidate-table th,
.board-diff-table th {
    background: #f7f9ff;
    color: #3a4568;
    font-size: 0.92rem;
    font-weight: 700;
}

.board-diff-candidate-table tbody tr:last-child td,
.board-diff-table tbody tr:last-child td {
    border-bottom: none;
}

.board-diff-table tbody tr.board-diff-row-unmatched td {
    background: #fff6de;
}

.board-diff-cell-content {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.board-diff-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #d9e0f0;
    background: #f2f5ff;
}

.board-diff-icon-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c86a5;
    font-size: 0.62rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.05;
    padding: 0.2rem;
    border-style: dashed;
}

.board-diff-empty {
    color: #7d86a4;
}

.board-diff-target-party {
    margin: 0.7rem 0 0.95rem 0;
}

.board-diff-target-party h4 {
    margin: 0 0 0.55rem 0;
    color: #3a4568;
    font-size: 0.95rem;
}

.board-diff-result-messages {
    margin-bottom: 0.65rem;
}

.board-diff-result-message {
    margin: 0;
    color: #2f4ca3;
    font-size: 0.92rem;
    font-weight: 700;
}

.board-diff-result-message + .board-diff-result-message {
    margin-top: 0.3rem;
}

.board-diff-result-message-warn {
    color: #a45a00;
}

@media (max-width: 768px) {
    .bosscount-display {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .bosscount-item {
        padding: 8px;
    }

    .bosscount-item p {
        font-size: 13px;
        line-height: 1.3;
    }

    .board-page-title-row {
        align-items: center;
    }

    .board-list-table th,
    .board-list-table td {
        padding: 0.55rem;
        font-size: 0.86rem;
    }

    .board-list-party-icons {
        grid-template-columns: repeat(5, 34px);
        gap: 0.25rem;
    }

    .board-list-party-icon {
        width: 34px;
        height: 34px;
    }

    .board-diff-icon {
        width: 34px;
        height: 34px;
    }
}

.board-party-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.board-party-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.board-party-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #e5e9f3;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(19, 28, 58, 0.08);
    text-align: center;
}

.board-party-card.is-unowned {
    opacity: 0.55;
}

.board-party-image {
    width: 100%;
    max-width: 84px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    background: #f6f8ff;
}

.board-party-image-missing,
.ub-party-image-missing,
.ub-event-image-missing-body {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7c86a5;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px dashed #cfd6e6;
}

.ub-event-image-missing {
    width: 84px;
    height: 84px;
    border-radius: 8px;
    background: #cfe0ff;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.2;
    word-break: break-all;
}

.board-party-name {
    margin-top: 0.35rem;
    font-weight: 700;
    color: #2f3650;
    line-height: 1.15;
    font-size: 0.9rem;
    min-height: 0;
    margin-bottom: 0;
}

.board-party-stats {
    margin-top: 0.12rem;
    color: #5f6a8a;
    line-height: 1.2;
    font-size: 0.82rem;
    white-space: nowrap;
}

.board-party-modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
}

.board-party-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 19, 42, 0.52);
}

.board-party-modal-window {
    position: relative;
    max-width: 760px;
    width: calc(100% - 32px);
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    border-radius: 16px;
    border: 1px solid #d4ddf2;
    background: #ffffff;
    box-shadow: 0 14px 46px rgba(15, 26, 60, 0.25);
    padding: 0.9rem;
    overflow: auto;
}

.board-party-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.board-party-modal-header h4 {
    margin: 0;
    color: #31406f;
    font-size: 1.03rem;
}

.board-party-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.board-party-customize-status {
    min-height: 1.3rem;
    margin-bottom: 0.7rem;
    font-size: 0.9rem;
    color: #4b5677;
}

.board-party-customize-status.is-success {
    color: #1f6f34;
}

.board-party-customize-status.is-error {
    color: #a11c2b;
}

.board-party-customize-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.board-party-customize-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid #e1e7f6;
    border-radius: 10px;
    background: #f9fbff;
}

.board-party-customize-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-party-customize-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    background: #eff3ff;
    border: 1px solid #d8e0f4;
}

.board-party-customize-image-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6876a1;
    font-weight: 700;
    font-size: 0.66rem;
}

.board-party-customize-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
}

.board-party-customize-name {
    width: 100%;
    max-width: 320px;
    border: 1px solid #c7d1ea;
    border-radius: 8px;
    background: #ffffff;
    color: #2a3659;
    font-size: 0.92rem;
    padding: 0.42rem 0.58rem;
}

.board-party-customize-name:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.14);
}

.board-party-customize-owned {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    color: #3f4f79;
    font-size: 0.9rem;
    font-weight: 700;
}

.ub-icon-box.is-unowned {
    opacity: 0.5;
}

@media (max-width: 768px) {
    .board-party-modal-window {
        width: calc(100% - 20px);
        margin: 10px auto;
        max-height: calc(100vh - 20px);
    }

    .board-party-modal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .board-party-customize-row {
        grid-template-columns: 60px 1fr;
        gap: 0.55rem;
    }

    .board-party-customize-image {
        width: 54px;
        height: 54px;
    }

    .board-party-customize-name {
        max-width: none;
    }
}

.post-info-editor {
    margin: 0.75rem 0 1.1rem 0;
    padding: 0.9rem;
    border: 1px solid #dfe5f4;
    border-radius: 12px;
    background: #f8faff;
}

.post-info-editor h3 {
    margin: 0 0 0.85rem 0;
    font-size: 1.02rem;
    color: #33406c;
}

.post-info-row {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 0.7rem;
    align-items: start;
    margin-bottom: 0.7rem;
}

.post-info-row:last-child {
    margin-bottom: 0;
}

.post-info-row-static {
    grid-template-columns: 1fr;
    gap: 0;
}

.post-info-row-inline {
    margin-bottom: 0.7rem;
}

.post-info-inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
}

.post-info-pill {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #b9c6e0;
    border-radius: 9px;
    overflow: hidden;
    background: #ffffff;
    color: #223056;
}

.post-info-pill-key {
    display: inline-flex;
    align-items: center;
    background: #dce6ff;
    color: #223056;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    padding: 0.38rem 0.72rem;
    user-select: none;
}

.post-info-pill-value {
    display: inline-flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    padding: 0.38rem 0.72rem;
    background: #ffffff;
    color: #223056;
    max-width: 100%;
    word-break: break-word;
}

.post-info-row label {
    font-weight: 700;
    font-size: 0.88rem;
    color: #3e4b76;
    padding-top: 0.45rem;
}

.post-info-row-difficulty {
    align-items: center;
}

.post-info-row-difficulty label {
    padding-top: 0;
    line-height: 1.2;
}

.post-info-input,
.post-info-textarea {
    width: 100%;
    border: 1px solid #c8d0e1;
    border-radius: 9px;
    background: #ffffff;
    color: #2f3650;
    font-size: 0.9rem;
    padding: 0.45rem 0.65rem;
}

.post-info-input {
    height: 36px;
}

.post-info-textarea {
    min-height: 76px;
    resize: vertical;
}

.post-info-input:focus,
.post-info-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.14);
}

.post-info-static-value {
    width: 100%;
    min-height: 36px;
    border: 1px solid #c8d0e1;
    border-radius: 9px;
    background: #ffffff;
    color: #2f3650;
    font-size: 0.9rem;
    padding: 0.45rem 0.65rem;
    line-height: 1.5;
    cursor: default;
    user-select: text;
}

.post-info-static-value-compact {
    width: fit-content;
    display: inline-block;
    max-width: 100%;
    justify-self: start;
    flex: 0 0 auto;
}

.post-info-static-value-titlelike {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    padding: 0.38rem 0.72rem;
    border-color: #b9c6e0;
    color: #223056;
    background: #ffffff;
}

.post-info-static-value-multiline {
    min-height: 76px;
    white-space: pre-wrap;
}

.post-info-toggle-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-info-toggle-wrap-difficulty {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.post-toggle-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.post-toggle-btn {
    border: 1px solid #cfd8ee;
    border-radius: 999px;
    background: #ffffff;
    color: #42507b;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.38rem 0.72rem;
    cursor: pointer;
}

.post-toggle-btn.is-active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.post-toggle-btn:disabled {
    background: #f1f4fb;
    border-color: #d5ddec;
    color: #9aa7c5;
    cursor: not-allowed;
}

.post-difficulty-help-text {
    margin: 0;
    color: #4a5783;
    font-size: 0.86rem;
    line-height: 1.2;
}

.post-info-row-difficulty .post-difficulty-help-text {
    margin-bottom: 0;
    color: #4a5783;
}

.ub-table-wrapper {
    --ub-icon-scale: 1;
    margin-top: 0.75rem;
    overflow-x: auto;
    text-align: center;
}

.ub-table-wrapper.ub-icon-size-large {
    --ub-icon-scale: 1;
}

.ub-table-wrapper.ub-icon-size-medium {
    --ub-icon-scale: 0.75;
}

.ub-table-wrapper.ub-icon-size-small {
    --ub-icon-scale: 0.44;
}

.ub-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.6rem;
}

.ub-toolbar-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.ub-control-panel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.45rem;
    border: 1px solid #d8e0f2;
    border-radius: 999px;
    background: #f7f9ff;
}

.ub-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-wrap: wrap;
}

.ub-toolbar-actions form {
    display: inline-flex;
    margin: 0;
}

.board-export-modal-open {
    overflow: hidden;
}

.board-export-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(18, 28, 52, 0.58);
    z-index: 1200;
}

.board-export-modal[hidden] {
    display: none;
}

.board-export-modal-dialog {
    width: min(680px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: #ffffff;
    border: 1px solid #d8e0f2;
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(20, 32, 66, 0.28);
    padding: 1rem;
}

.board-export-modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.board-export-modal-title {
    margin: 0;
    font-size: 1.05rem;
    color: #2f3b62;
}

.board-export-options {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.board-export-option-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #2f3b62;
    font-size: 0.9rem;
}

.board-export-option-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.board-export-textarea {
    width: 100%;
    resize: vertical;
    min-height: 16rem;
    border: 1px solid #cdd7ee;
    border-radius: 10px;
    padding: 0.65rem;
    font-size: 0.94rem;
    line-height: 1.45;
    overflow-y: auto;
}

.board-export-modal-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ub-size-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid #d8e0f2;
    border-radius: 999px;
    background: #f7f9ff;
}

.ub-size-toggle-label {
    color: #4a5783;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0 6px 0 8px;
}

.ub-size-toggle-btn {
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #4a5783;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 7px 12px;
    cursor: pointer;
}

.ub-size-toggle-btn.is-active {
    background: #667eea;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(29, 52, 137, 0.25);
}

.ub-display-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border: 1px solid #d8e0f2;
    border-radius: 999px;
    background: #f7f9ff;
}

.ub-display-toggle-btn {
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #4a5783;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 7px 12px;
    cursor: pointer;
}

.ub-display-toggle-btn.is-active {
    background: #667eea;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(29, 52, 137, 0.25);
}

.ub-time-adjust {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 8px;
    border: 1px solid #d8e0f2;
    border-radius: 999px;
    background: #ffffff;
}

.ub-time-adjust-label {
    color: #4a5783;
    font-size: 0.82rem;
    font-weight: 700;
}

.ub-time-adjust-input {
    width: 5.5rem;
    border: 1px solid #cdd7ee;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 0.9rem;
    color: #2f3a59;
    background: #ffffff;
    text-align: right;
}

.ub-time-adjust-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.14);
}

.ub-time-adjust-button {
    border: none;
    border-radius: 999px;
    padding: 7px 12px;
    background: #667eea;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ub-time-adjust-button:hover {
    background: #5568ca;
}

.ub-table {
    width: auto;
    margin: 0 auto;
    table-layout: auto;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e6ebf5;
    border-radius: 10px;
    overflow: hidden;
}

.ub-table th,
.ub-table td {
    border-bottom: 1px solid #eef2f8;
    padding: 0.35rem 0.45rem;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.ub-table thead th:nth-child(2),
.ub-table tbody td.ub-event-cell {
    padding-right: 0.95rem;
    border-right: 2px solid #7f8fb2;
}

.ub-table thead th:nth-child(3),
.ub-table tbody td.ub-party-cell:first-of-type {
    padding-left: 0.95rem;
}

.ub-table thead th {
    background: #f7f9ff;
    color: #34406a;
    font-size: 0.82rem;
    font-weight: 700;
}

.ub-table-wrapper.ub-icon-size-large .ub-table thead th.ub-header-party-cell,
.ub-table-wrapper.ub-icon-size-large .ub-table thead th.ub-auto-cell,
.ub-table-wrapper.ub-icon-size-large .ub-table tbody td.ub-party-cell,
.ub-table-wrapper.ub-icon-size-large .ub-table tbody td.ub-auto-cell {
    padding-left: 0.24rem;
    padding-right: 0.24rem;
}

.ub-table-wrapper.ub-icon-size-large .ub-table thead th:nth-child(3),
.ub-table-wrapper.ub-icon-size-large .ub-table tbody td.ub-party-cell:first-of-type {
    padding-left: 0.24rem;
}

.ub-table-wrapper.ub-icon-size-medium .ub-table thead th.ub-header-party-cell,
.ub-table-wrapper.ub-icon-size-medium .ub-table thead th.ub-auto-cell,
.ub-table-wrapper.ub-icon-size-medium .ub-table tbody td.ub-party-cell,
.ub-table-wrapper.ub-icon-size-medium .ub-table tbody td.ub-auto-cell {
    padding-left: 0.16rem;
    padding-right: 0.16rem;
}

.ub-table-wrapper.ub-icon-size-medium .ub-table thead th:nth-child(3),
.ub-table-wrapper.ub-icon-size-medium .ub-table tbody td.ub-party-cell:first-of-type {
    padding-left: 0.16rem;
}

.ub-table-wrapper.ub-icon-size-small .ub-table thead th.ub-header-party-cell,
.ub-table-wrapper.ub-icon-size-small .ub-table thead th.ub-auto-cell,
.ub-table-wrapper.ub-icon-size-small .ub-table tbody td.ub-party-cell,
.ub-table-wrapper.ub-icon-size-small .ub-table tbody td.ub-auto-cell {
    padding-left: 0.06rem;
    padding-right: 0.06rem;
}

.ub-table-wrapper.ub-icon-size-small .ub-table thead th:nth-child(3),
.ub-table-wrapper.ub-icon-size-small .ub-table tbody td.ub-party-cell:first-of-type {
    padding-left: 0.06rem;
}

.ub-table tbody tr:last-child td {
    border-bottom: none;
}

.ub-table tbody tr.ub-row-has-active td {
    background: #fff9d9;
}

.ub-table tbody tr[data-is-battle-start="true"] td {
    background: #fff9d9;
}

.ub-table tbody tr[data-is-battle-end="true"] td {
    background: #fff9d9;
}

.ub-table tbody tr.has-comment-row td,
.ub-table tbody tr[data-is-added-row="true"] td,
.ub-table tbody tr.ub-comment-row td {
    background: #fff9d9;
}

.ub-table tbody tr[data-timing="true"] td {
    background: #ffd9d9 !important;
}

.ub-table tbody tr[data-timing="true"] + tr.ub-comment-row td {
    background: #ffd9d9 !important;
}

.ub-event-cell-inner {
    position: relative;
    display: inline-block;
}

.ub-timing-hoshi {
    display: none;
    position: absolute;
    top: calc(-6px * var(--ub-icon-scale, 1));
    left: calc(-6px * var(--ub-icon-scale, 1));
    width: calc(34px * var(--ub-icon-scale, 1));
    height: calc(34px * var(--ub-icon-scale, 1));
    pointer-events: none;
    z-index: 2;
}

.ub-state-badge {
    position: absolute;
    left: calc(-10px * var(--ub-icon-scale, 1));
    bottom: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: calc(46px * var(--ub-icon-scale, 1));
    height: calc(24px * var(--ub-icon-scale, 1));
    padding: 0 calc(7px * var(--ub-icon-scale, 1));
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #222222;
    color: #222222;
    font-size: calc(0.62rem * var(--ub-icon-scale, 1));
    font-weight: 800;
    letter-spacing: 0.03em;
    box-shadow: none;
    pointer-events: none;
    z-index: 3;
    line-height: 1;
}

.ub-state-badge.is-unknown {
    background: #e15252;
    color: #ffffff;
}

.ub-state-badge.is-set,
.ub-state-badge.is-auto,
.ub-state-badge.is-timing {
    background: #ffffff;
    color: #222222;
}

.ub-icon-box.ub-timing-target .ub-party-image.ub-party-image-mono {
    filter: none;
}

.ub-icon-box.ub-timing-target .ub-party-image-missing-gray {
    background: #cfe0ff;
    border-color: #9db8ef;
    color: #345a9f;
}

tr[data-timing="true"] .ub-timing-hoshi {
    display: block;
}

.ub-action-btn-timing.is-timing-active {
    background: #ffd9d9;
    border-color: #e03030;
}

.ub-action-btn-timing.is-timing-active .ub-action-btn-image {
    filter: none;
}

.ub-time-cell {
    font-weight: 700;
    color: #2f3650;
    white-space: normal;
    line-height: 1.2;
}

.ub-time-main {
    display: block;
}

.ub-time-diff {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #5f6a8a;
}

.ub-time-input {
    width: 82px;
    height: 32px;
    border: 1px solid #c8d0e1;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 0.9rem;
    text-align: center;
}

.ub-time-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.ub-event-image {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #d6dced;
    background: #f4f7ff;
}

.ub-party-image {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #d6dced;
    background: #f4f7ff;
}

.ub-icon-box {
    position: relative;
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    margin: 0 auto;
}

.ub-party-image-mono {
    filter: grayscale(100%);
}

.ub-party-image-toggleable {
    cursor: pointer;
}

.ub-event-text,
.ub-party-text {
    font-size: 0.82rem;
    color: #4f5c85;
    font-weight: 600;
    white-space: nowrap;
}

.ub-event-image-missing-blue {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #cfe0ff;
    border: 1px solid #9db8ef;
    color: #345a9f;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-party-image-missing-blue {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #cfe0ff;
    border: 1px solid #9db8ef;
    color: #345a9f;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-event-image-missing-gray {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #d7d7d7;
    border: 1px solid #c1c1c1;
    color: #6a6a6a;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-party-image-missing-gray {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #d7d7d7;
    border: 1px solid #c1c1c1;
    color: #6a6a6a;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-event-image-missing-body {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #cfe0ff;
    border: 1px solid #9db8ef;
    color: #345a9f;
    font-size: 0.75rem;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-party-toggleable-char {
    cursor: pointer;
}

.ub-set-badge {
    position: absolute;
    top: calc(-10px * var(--ub-icon-scale, 1));
    right: calc(-10px * var(--ub-icon-scale, 1));
    display: none;
    align-items: center;
    justify-content: center;
    min-width: calc(57px * var(--ub-icon-scale, 1));
    height: calc(30px * var(--ub-icon-scale, 1));
    padding: 0 calc(9px * var(--ub-icon-scale, 1));
    border-radius: 999px;
    background: #2daee6;
    border: calc(2px * var(--ub-icon-scale, 1)) solid #ffffff;
    color: #ffffff;
    font-size: calc(0.93rem * var(--ub-icon-scale, 1));
    font-weight: 800;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(21, 87, 128, 0.35);
    pointer-events: none;
    z-index: 2;
}

.ub-set-badge::before,
.ub-set-badge::after {
    content: "";
    position: absolute;
    right: calc(12px * var(--ub-icon-scale, 1));
    bottom: calc(-10px * var(--ub-icon-scale, 1));
    width: calc(10px * var(--ub-icon-scale, 1));
    height: calc(10px * var(--ub-icon-scale, 1));
    clip-path: polygon(0 0, 100% 0, 0 100%);
    z-index: -1;
}

.ub-set-badge::before {
    background: #2daee6;
}

.ub-set-badge::after {
    border-left: calc(2px * var(--ub-icon-scale, 1)) solid #ffffff;
    background: linear-gradient(
        135deg,
        transparent calc(50% - 1px),
        #ffffff calc(50% - 1px),
        #ffffff calc(50% + 1px),
        transparent calc(50% + 1px)
    );
}

.ub-icon-box.has-set .ub-set-badge {
    display: inline-flex;
}

.ub-icon-box.has-set:not(.set-inactive) .ub-set-badge {
    border-width: calc(2px * var(--ub-icon-scale, 1));
    border-color: #ffffff;
    box-shadow: 0 0 0 calc(5px * var(--ub-icon-scale, 1)) #e15252, 0 2px 6px rgba(21, 87, 128, 0.35);
}

.ub-icon-box.has-set.set-inactive .ub-set-badge {
    background: #2daee6;
    filter: none;
}

.ub-icon-box.has-set.set-inactive .ub-set-badge::before {
    background: #2daee6;
}

.ub-icon-box:not(.has-set) .ub-party-image:not(.ub-party-image-mono) ~ .ub-set-badge,
.ub-icon-box:not(.has-set) .ub-party-image-missing-blue ~ .ub-set-badge {
    display: inline-flex;
    background: transparent;
    border-width: 0;
    border-color: transparent;
    color: transparent;
    box-shadow: 0 0 0 calc(5px * var(--ub-icon-scale, 1)) #e15252;
}

.ub-icon-box:not(.has-set) .ub-party-image:not(.ub-party-image-mono) ~ .ub-set-badge::before,
.ub-icon-box:not(.has-set) .ub-party-image-missing-blue ~ .ub-set-badge::before {
    background: transparent;
}

.ub-icon-box:not(.has-set) .ub-party-image:not(.ub-party-image-mono) ~ .ub-set-badge::after,
.ub-icon-box:not(.has-set) .ub-party-image-missing-blue ~ .ub-set-badge::after {
    border-left: calc(2px * var(--ub-icon-scale, 1)) solid #e15252;
    background: linear-gradient(
        135deg,
        transparent calc(50% - 1px),
        #e15252 calc(50% - 1px),
        #e15252 calc(50% + 1px),
        transparent calc(50% + 1px)
    );
}

.ub-party-empty {
    font-size: 0.8rem;
    color: #9aa5c4;
}

.ub-header-party-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #34406a;
}

.ub-party-image-missing-gray {
    width: calc(84px * var(--ub-icon-scale, 1));
    height: calc(84px * var(--ub-icon-scale, 1));
    border-radius: 8px;
    background: #d7d7d7;
    border: 1px solid #c1c1c1;
    color: #6a6a6a;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem;
    line-height: 1.15;
    word-break: break-all;
}

.ub-header-party-cell,
.ub-party-cell,
.ub-auto-cell {
    background: #fff;
}

.ub-header-party-cell,
.ub-party-cell,
.ub-auto-cell {
    width: calc(84px * var(--ub-icon-scale, 1));
}

.ub-actions-cell {
    background: #fff;
    width: 156px;
}

.ub-actions-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.ub-action-btn {
    width: 42px;
    height: 42px;
    border: 1px solid #c9d4ea;
    border-radius: 10px;
    background: #f7f9ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.ub-action-btn.is-disabled,
.ub-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ub-action-btn-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.ub-auto-icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ub-auto-btn {
    width: calc(63px * var(--ub-icon-scale, 1));
    height: calc(63px * var(--ub-icon-scale, 1));
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ub-auto-btn-set {
    background: #7de3f9;
    border-color: #0a5a78;
    color: #0a5a78;
}

.ub-auto-btn-set.ub-auto-btn-active {
    border-color: #e15252;
    box-shadow: 0 0 0 4px #e15252;
}

.ub-auto-btn-unset {
    background: #f3f3f3;
}

.ub-auto-btn-unset.ub-auto-btn-inactive {
    border-color: #d7d7d7;
    color: #7a7a7a;
}

.ub-auto-btn-unset.ub-auto-btn-active {
    background: #f7f7f7;
    border-color: #e15252;
    box-shadow: 0 0 0 4px #e15252;
    color: #8f2f2f;
}

.ub-auto-label {
    font-weight: 800;
    font-size: calc(0.85rem * var(--ub-icon-scale, 1));
    pointer-events: none;
}

.ub-auto-label.ub-auto-label-on {
    font-size: calc(1.5rem * var(--ub-icon-scale, 1));
}

.ub-table tbody tr.has-comment-row td {
    border-bottom: none;
}

.ub-comment-row td {
    border-top: none;
}

.ub-comment-prefix-cell {
    background: #fff9d9;
}

.ub-comment-cell {
    background: #fff9d9;
    padding: 0.35rem 0.45rem 0.55rem 0.45rem;
}

.ub-table tbody tr[data-timing="true"] + tr.ub-comment-row .ub-comment-prefix-cell,
.ub-table tbody tr[data-timing="true"] + tr.ub-comment-row .ub-comment-cell {
    background: #ffd9d9;
}

.ub-comment-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ub-comment-display {
    width: 100%;
    white-space: pre-wrap;
    text-align: left;
    color: #2f3650;
    font-size: 0.9rem;
    line-height: 1.45;
    padding: 0.35rem 0.15rem;
}

.ub-comment-input {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    max-height: 280px;
    border: 1px solid #c8d0e1;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.9rem;
    line-height: 1.35;
    resize: none;
    overflow-y: hidden;
}

.ub-comment-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.ub-comment-delete-btn {
    height: 34px;
    border: 1px solid #e2b8b8;
    border-radius: 8px;
    background: #fff4f4;
    color: #8f2f2f;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0 12px;
    cursor: pointer;
}

/* ON + 活性 → 青 */
.ub-auto-btn-active .ub-auto-label-on {
    color: #0a5a78;
}

/* OFF + 非活性 → 背景色に近い薄い色 */
.ub-auto-btn-inactive .ub-auto-label:not(.ub-auto-label-on) {
    color: #b8b8b8;
}

@media (max-width: 960px) {
    .board-party-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .board-party-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ub-table-wrapper.ub-icon-size-small {
        overflow-x: hidden;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-table {
        width: 100%;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-table th,
    .ub-table-wrapper.ub-icon-size-small .ub-table td {
        padding: 0.2rem 0.12rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-table thead th:nth-child(2),
    .ub-table-wrapper.ub-icon-size-small .ub-table tbody td.ub-event-cell {
        padding-right: 0.2rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-table thead th:nth-child(3),
    .ub-table-wrapper.ub-icon-size-small .ub-table tbody td.ub-party-cell:first-of-type {
        padding-left: 0.2rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-time-cell {
        min-width: 46px;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-table thead th {
        font-size: 0.68rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-time-main {
        font-size: 0.82rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-time-diff {
        font-size: 0.62rem;
    }

    .ub-table-wrapper.ub-icon-size-small .ub-auto-label {
        font-size: calc(0.72rem * var(--ub-icon-scale, 1));
    }

    .ub-table-wrapper.ub-icon-size-small .ub-set-badge {
        font-size: calc(0.76rem * var(--ub-icon-scale, 1));
    }
}

.cb-grid-header {
    margin-top: 1rem;
    padding: 0.5rem 0;
    display: grid;
    grid-template-columns: 60px 1fr 220px;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a5480;
}

.cb-grid-row {
    display: grid;
    grid-template-columns: 60px 1fr 220px;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f8;
}

.cb-grid-row:last-of-type {
    border-bottom: none;
    margin-bottom: 0.5rem;
}

.cb-grid-row span {
    font-weight: 600;
    color: #3d4666;
}

.cb-grid-row input {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #c8d0e1;
    padding: 0 0.75rem;
    font-size: 14px;
}

.cb-grid-row input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.chara-upload-toolbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.chara-upload-note {
    font-size: 0.9rem;
    color: #5f6a8a;
}

.chara-upload-flash {
    margin: 0 0 0.85rem 0;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.92rem;
}

.chara-upload-flash.is-success {
    background: #eefbf2;
    border: 1px solid #b7e4c2;
    color: #1d6c36;
}

.chara-upload-flash.is-error {
    background: #fff4f4;
    border: 1px solid #f2c9c9;
    color: #9b1f1f;
}

.chara-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.chara-card {
    border: 1px solid #e5e9f3;
    border-radius: 12px;
    padding: 0.75rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(19, 28, 58, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chara-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(19, 28, 58, 0.14);
}

.chara-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    background: #f4f7ff;
}

.chara-name {
    margin-top: 0.5rem;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    color: #2f3650;
    text-align: center;
    word-break: break-word;
}

.chara-add-form {
    margin-top: 0.55rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.chara-add-input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 0.55rem;
    border: 1px solid #c8d0e1;
    border-radius: 8px;
    font-size: 0.88rem;
}

.chara-add-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.chara-add-button {
    padding: 7px 10px;
    white-space: nowrap;
}

.chara-edit-toggle {
    width: 100%;
    margin-top: 0.45rem;
}

.chara-edit-form {
    margin-top: 0.45rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.chara-edit-form[hidden] {
    display: none;
}

.clan-list-table-wrapper {
    margin-top: 1rem;
    overflow-x: auto;
}

.clan-list-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e6ebf5;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.clan-list-table th,
.clan-list-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #eef2f8;
    text-align: left;
    white-space: nowrap;
}

.clan-list-table th {
    background: #f7f9ff;
    color: #34406a;
    font-size: 0.86rem;
    font-weight: 700;
}

.clan-list-table tbody tr:last-child td {
    border-bottom: none;
}

.clan-list-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.clan-list-row:hover {
    background: #f8fbff;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .tab-content {
        padding: 0 1rem;
        padding-top: 8px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px;
    }

    .tab {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 80px;
        text-align: center;
    }

    .main-content {
        padding: 0 1rem 2rem 1rem;
    }

    .page-content {
        padding: 1.5rem 0;
    }

    .card {
        padding: 1rem;
    }

    .settings-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .settings-row input {
        max-width: none;
    }

    .settings-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .cb-grid-header,
    .cb-grid-row {
        grid-template-columns: 48px 1fr 1fr;
    }

    .chara-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .auth-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tab-content {
        flex-direction: column;
        gap: 2px;
        padding: 0 0.5rem;
        padding-top: 8px;
    }

    .tab {
        width: 100%;
        text-align: center;
        padding: 12px;
        border-radius: 6px;
        margin-bottom: 2px;
    }

    .tab.active {
        border-radius: 6px;
    }

    .board-page-title-row {
        align-items: stretch;
        flex-direction: column;
        gap: 0.6rem;
    }

    .board-help-toggle-btn {
        width: 100%;
    }

    .board-export-modal-dialog {
        padding: 0.8rem;
    }

    .board-export-modal-actions .btn {
        width: 100%;
    }

    .page-content h2 {
        font-size: 1.3rem;
    }

    .cb-grid-header,
    .cb-grid-row {
        grid-template-columns: 36px 1fr;
    }

    .cb-grid-header span:nth-child(3),
    .cb-grid-row input:nth-child(3) {
        grid-column: 2;
    }
}

/* ユーティリティクラス */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
