@charset "utf-8";

#sheetWrap {
    position: relative; 
    width: 100%; max-width: 1280px; margin: 0 auto;
    color: var(--text-primary); font-size: 14px; line-height: 1.5;
    box-sizing: border-box;
}
#sheetWrap a { text-decoration: none; transition: 0.2s; }
#sheetWrap * { box-sizing: border-box; }

.trpg-nav-toolbar-slot {
    display: flex; align-items: center;
}
@media (max-width: 768px) {
    .trpg-nav-toolbar-slot .searchbar { max-width: none; flex: 1; }
}

#sheetWrap > #desktop-toolbar-row {
    position: absolute;
    top: -42px; right: 14px;
    display: flex; align-items: center; gap: 10px;
    z-index: 500;
}
#desktop-toolbar-row .searchbar { max-width: 220px; }

.mobile-toolbar-frame {
    display: none;
}
@media (max-width: 768px) {
    .mobile-toolbar-frame {
        display: flex; align-items: center; gap: 10px;
        padding: 10px 15px;
        background-color: var(--surface-soft);
        background-image:
            linear-gradient(color-mix(in srgb, var(--border) 18%, transparent) 1px, transparent 1px),
            linear-gradient(90deg, color-mix(in srgb, var(--border) 18%, transparent) 1px, transparent 1px);
        background-size: 24px 24px;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }
      .mobile-toolbar-frame .trpg-nav-toolbar-slot { flex: 1; min-width: 0; }
    .mobile-toolbar-frame .searchbar { flex: 1; max-width: none; }
    .mobile-toolbar-frame .year-toggle-btn { flex: 0 0 auto; }
}

.searchbar { flex: 1; max-width: 300px; position: relative; }

.table-wrapper {
    width: 100%; height: 650px; overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: inset 1px 1px 0 var(--window-highlight), 3px 4px 0 color-mix(in srgb, var(--border) 24%, transparent);
}
.table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--border) 55%, transparent); border-radius: 4px; }
.table-wrapper::-webkit-scrollbar-thumb:hover { background: var(--brand); }

.sc-table { table-layout: fixed; width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1000px; font-size: 12px; }

.sc-table thead th {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-table-head); color: var(--brand); font-weight: 800; padding: 12px;
    font-size: 12.5px; letter-spacing: .02em;
    text-align: center;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.sc-table td {
    padding: 12px;
    vertical-align: middle; text-align: center; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sc-table tbody tr {
    background-image: linear-gradient(to bottom, transparent calc(100% - 1px), color-mix(in srgb, var(--border) 35%, transparent) calc(100% - 1px));
}

.sc-subject { text-align: left !important; padding-left: 15px !important; font-weight: 700; color: var(--text) !important; }

.ts-edit { cursor: pointer; transition: 0.2s; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.status-badge { display: inline-block; vertical-align: middle; padding: 2px 8px; border-radius: var(--radius); font-size: 11px; font-weight: 700; min-width: 44px; text-align: center; border: 1px solid transparent; }
.st-done { border-color: var(--success); color: var(--success); background: color-mix(in srgb, var(--success) 16%, var(--surface)); }
.st-prog { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.st-hold { border-color: var(--warning); color: var(--warning); background: color-mix(in srgb, var(--warning) 16%, var(--surface)); }
.st-plan { border-color: var(--text-subtle); color: var(--text-subtle); background: var(--surface-soft); }

.rule-pill {
    display: inline-block;
    vertical-align: middle;
    max-width: 100%;
    padding: 2px 8px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    box-sizing: border-box;
}
.sc-table td.col-rule {
    overflow: visible;
    white-space: normal;
}

.icon-link {
    display: inline-flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.icon-link i { font-size: 15px; color: var(--text-subtle); transition: 0.2s; }
.icon-link:hover i { color: var(--brand); }
.icon-link img { display: block; width: 15px; height: 15px; object-fit: contain; }

.grid { display: grid; gap: 15px; }

.pc-view-area { display: block; }
.mobile-view-area { display: none; }

@media (max-width: 768px) {
    .pc-view-area { display: none !important; }
    .mobile-view-area { display: block; }
    .table-frame.trpg-content-frame.pc-view-area {
        padding: 0;
    }

    .sc-header { flex-direction: column; align-items: stretch; height: auto; gap: 12px; }
    .searchbar { max-width: 100%; }
    .mo-play-card {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius); margin-bottom: 12px; padding: 16px;
        box-shadow: inset 1px 1px 0 var(--window-highlight);
        position: relative; overflow: hidden;
    }

    .mo-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
    .mo-date { font-size: 12px; color: var(--text-subtle); letter-spacing: 0.5px; }

    .mo-card-title {
        font-size: 16px; font-weight: 700; color: var(--text);
        margin-bottom: 12px; display: block; line-height: 1.4;
    }

    .mo-meta-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
    .mo-meta-item {
        background: var(--surface-soft); padding: 4px 8px; border-radius: var(--radius);
        font-size: 12px; color: var(--text-subtle); border: 1px solid var(--border);
    }

    .mo-card-actions {
        display: flex; gap: 12px; padding-top: 12px;
        border-top: 1px dashed var(--border); justify-content: flex-end;
    }
    .mo-action-btn {
        font-size: 12px; color: var(--text-subtle); display: flex; align-items: center; gap: 6px;
        padding: 4px 8px; border-radius: var(--radius); transition: 0.2s;
    }
    .mo-action-btn:hover { background: var(--surface-raised); color: var(--text); }
    .mo-action-btn i { font-size: 13px; }
    .mo-action-btn img { display: block; width: 13px; height: 13px; object-fit: contain; }
}

@keyframes modalPop {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ts-modal {
    display: none; position: fixed; inset: 0;
    background: var(--overlay);
    z-index: 9999;
    align-items: center; justify-content: center;
    padding: 12px;
}
.ts-modal.active { display: flex !important; }
.ts-modal .ts-modal-card { animation: modalPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

#ts-modal .sc-write-table,
#ts-csv-modal .sc-write-table,
#ts-rule-modal .sc-write-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}
#ts-modal .sc-write-table th,
#ts-csv-modal .sc-write-table th {
    width: 100px;
    padding: 8px 10px 8px 0;
    color: var(--text-subtle);
    font-size: 12px;
    font-weight: 750;
    text-align: left;
    vertical-align: top;
}
#ts-modal .sc-write-table th:not(:empty),
#ts-csv-modal .sc-write-table th:not(:empty) { padding-top: 9px; }
#ts-modal .sc-write-table td,
#ts-csv-modal .sc-write-table td { padding: 0 0 8px; border-bottom: 0; }
#ts-modal .btn_danger { margin-right: auto; }

.btn-small-del {
    background: transparent; border: 1px solid var(--danger); color: var(--danger);
    padding: 6px 10px; border-radius: var(--radius); cursor: pointer; font-weight: 700; font-size: 12px;
    flex: 0 0 auto; white-space: nowrap;
    transition: 0.2s;
}
.btn-small-del:hover { background: var(--danger); color: #fff; }

.rl-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.rl-row .rl-color { width: 40px; height: 38px; padding: 0; border: none; background: none; cursor: pointer; }

@media (max-width: 520px) {
    .ts-modal { padding: 8px; }
    .ts-modal .ts-modal-card { width: 100%; max-height: calc(100vh - 16px); }
    #ts-modal .sc-write-table th { width: 76px; }
}

tr.highlight-prog {
    background-color: color-mix(in srgb, var(--brand) 8%, transparent);
}
.highlight-prog td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}
.mo-play-card.highlight-prog {
    border-color: var(--brand);
    box-shadow: inset 1px 1px 0 var(--window-highlight), 0 0 15px color-mix(in srgb, var(--brand) 20%, transparent);
}

tr.highlight-plan {
    background-color: var(--surface-soft);
}
.highlight-plan td:first-child {
    box-shadow: inset 3px 0 0 var(--text-subtle);
}
.mo-play-card.highlight-plan {
    border-color: var(--text-subtle);
}

.highlight-prog .sc-subject .ts-edit,
.highlight-prog .mo-card-title {
    color: var(--brand);
}
.highlight-plan .sc-subject .ts-edit,
.highlight-plan .mo-card-title {
    color: var(--text); font-weight: 700;
}

.trpg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.trpg-modal-overlay.open { display: flex; }
