.tm-front {
    --tmf-bg: #f5f7fb;
    --tmf-surface: #ffffff;
    --tmf-surface-alt: rgba(255, 255, 255, 0.92);
    --tmf-border: rgba(203, 213, 225, 0.8);
    --tmf-border-strong: rgba(148, 163, 184, 0.7);
    --tmf-text: #0f172a;
    --tmf-muted: #5f6c85;
    --tmf-muted-strong: #1f2937;
    --tmf-primary: #2563eb;
    --tmf-primary-soft: rgba(37, 99, 235, 0.18);
    --tmf-radius: 22px;
    --tmf-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    --tmf-card-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    --tmf-items-per-row: 4;
    --tmf-item-gap: 16px;
    --tmf-font: inherit;
    --tmf-card-radius: 8px;
    max-width: 1240px;
    margin: 24px auto 64px;
    padding: 0 16px 48px;
    font-family: var(--tmf-font, "Inter var", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: var(--tmf-text);
    background: var(--tmf-bg);
}

/* 다크 테마 */
.tm-front-dark {
    --tmf-surface: rgba(255, 255, 255, 0.08);
    --tmf-surface-alt: rgba(255, 255, 255, 0.05);
    --tmf-border: rgba(255, 255, 255, 0.15);
    --tmf-border-strong: rgba(255, 255, 255, 0.25);
    --tmf-text: #f1f5f9;
    --tmf-muted: #94a3b8;
    --tmf-muted-strong: #cbd5e1;
    --tmf-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    --tmf-card-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}
.tm-front-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}
.tm-front-title {
    margin: 0;
    font-size: clamp(28px, 5vw, 38px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--tmf-text);
}
.tm-front-subtitle {
    margin: 0;
    font-size: 16px;
    color: var(--tmf-muted);
    max-width: 720px;
    line-height: 1.6;
}
.tm-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0 8px;
}
.tm-front .tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--tmf-primary);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tm-front .tm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 36px rgba(37, 99, 235, 0.32);
}
.tm-front .tm-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--tmf-primary-soft);
}
.tm-front .tm-btn.secondary {
    background: rgba(37, 99, 235, 0.08);
    color: var(--tmf-primary);
    border-color: rgba(37, 99, 235, 0.32);
    box-shadow: none;
}
.tm-front .tm-board {
    background: var(--tmf-surface);
    border-radius: var(--tmf-radius);
    border: 1px solid var(--tmf-border);
    box-shadow: var(--tmf-shadow);
    padding: 24px 26px;
}
.tm-front .tm-board[data-edit="1"] .tm-front-card {
    cursor: grab;
}
.tm-front-tier {
    padding: 26px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
}
.tm-front-tier:first-of-type {
    padding-top: 12px;
}
.tm-front-tier:last-of-type {
    padding-bottom: 0;
    border-bottom: none;
}
.tm-front-tier-head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.tm-front-tier-badge {
    min-width: 52px;
    min-height: 52px;
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--tmf-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: clamp(14px, 3vw, 22px);
    text-transform: uppercase;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.3);
    text-align: center;
    line-height: 1.2;
    word-break: keep-all;
    white-space: normal;
    max-width: 120px;
}
.tm-front-tier-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tm-front-tier-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--tmf-text);
    letter-spacing: -0.01em;
}
.tm-front-tier-desc {
    margin: 0;
    font-size: 13px;
    color: var(--tmf-muted);
}
.tm-front-tier-row {
    margin-top: 18px;
    display: grid;
    gap: var(--tmf-item-gap);
    counter-reset: tmRank;
    --tmf-item-cols: max(var(--tmf-items-per-row), 1);
    grid-template-columns: repeat(var(--tmf-item-cols), minmax(0, 1fr));
}
.tm-front-row-empty {
    grid-column: 1 / -1;
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed var(--tmf-border);
    text-align: center;
    font-size: 13px;
    color: var(--tmf-muted);
    background: rgba(148, 163, 184, 0.08);
}
.tm-front-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    background: var(--tmf-surface-alt);
    border-radius: var(--tmf-card-radius, 20px);
    border: 1px solid var(--tmf-border);
    box-shadow: var(--tmf-card-shadow);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    cursor: pointer;
    outline: none;
}
.tm-front-card::before {
    content: counter(tmRank);
    counter-increment: tmRank;
    position: absolute;
    top: 12px;
    left: 12px;
    width: 30px;
    height: 30px;
    border-radius: 11px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.28);
    z-index: 2;
}
.tm-front-card-media {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: rgba(15, 23, 42, 0.06);
    position: relative;
    overflow: hidden;
}
.tm-front-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tm-front-card-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(14, 165, 233, 0.26));
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.tm-front-card-body {
    padding: 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tm-front-card-brand {
    align-self: flex-start;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--tmf-primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.tm-front-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--tmf-text);
    line-height: 1.28;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tm-front-card-summary {
    margin: 0;
    font-size: 12px;
    color: var(--tmf-muted-strong);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tm-front-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 26px 52px rgba(15, 23, 42, 0.22);
    border-color: rgba(37, 99, 235, 0.32);
}
.tm-front-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 0 0 3px var(--tmf-primary-soft), 0 26px 52px rgba(15, 23, 42, 0.22);
    border-color: rgba(37, 99, 235, 0.5);
}
.tm-front-card[data-link=""] {
    cursor: default;
}
.tm-front-empty {
    text-align: center;
    padding: 40px;
    color: var(--tmf-muted);
    font-size: 14px;
}
.tm-toast {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-width: min(360px, calc(100vw - 32px));
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(6px);
}
.tm-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.tm-toast-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.tm-toast-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.01em;
}
.tm-toast-brand {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.25);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.tm-toast-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tm-toast-body p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}
.tm-toast-reason span {
    display: inline-block;
    margin-right: 6px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
}
.tm-front .sortable-ghost {
    opacity: 0.4 !important;
    transform: scale(0.98);
}
.tm-front .sortable-chosen {
    cursor: grabbing !important;
}
@media (max-width: 980px) {
    .tm-front .tm-board {
        padding: 24px;
    }
    .tm-front-tier-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
@media (max-width: 768px) {
    .tm-front {
        padding-bottom: 32px;
    }
    .tm-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .tm-front-tier-row {
        --tmf-item-cols: 4;
        gap: 10px;
    }
    .tm-front-card {
        width: 100%;
        min-width: 0;
    }
    .tm-front-card-title {
        font-size: 13px;
    }
    .tm-front-card-brand {
        font-size: 9px;
    }
    .tm-front-card-summary {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    .tm-front-card-body {
        padding: 10px;
        gap: 4px;
    }
}
@media (max-width: 480px) {
    .tm-front-tier-row {
        --tmf-item-cols: 3;
        gap: 8px;
    }
    .tm-front-card-title {
        font-size: 12px;
    }
    .tm-front-card-brand {
        font-size: 8px;
        padding: 2px 6px;
    }
    .tm-front-card-summary {
        display: none;
    }
    .tm-front-card-body {
        padding: 8px;
    }
}

/* 아이템 상세 모달 */
.tm-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 16px;
}
.tm-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.tm-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 32px 64px rgba(15, 23, 42, 0.28);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tm-modal-overlay.is-open .tm-modal {
    transform: translateY(0) scale(1);
}
.tm-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.5);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    backdrop-filter: blur(4px);
}
.tm-modal-close:hover {
    background: rgba(15, 23, 42, 0.75);
}
.tm-modal-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(14, 165, 233, 0.15));
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}
.tm-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tm-modal-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: rgba(37, 99, 235, 0.3);
}
.tm-modal-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tm-modal-brand {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: var(--tmf-primary, #2563eb);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.tm-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--tmf-text, #0f172a);
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.tm-modal-desc,
.tm-modal-reason {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--tmf-muted-strong, #475569);
    word-break: keep-all;
}
.tm-modal-reason-label {
    display: inline-block;
    font-weight: 700;
    color: var(--tmf-text, #0f172a);
    margin-right: 6px;
}
.tm-modal-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 4px;
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--tmf-primary, #2563eb);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}
.tm-modal-link:hover {
    background: #1d4ed8;
}
.tm-modal-link svg {
    width: 14px;
    height: 14px;
}

/* 다크 테마 모달 */
.tm-front-dark .tm-modal {
    background: #1e293b;
}
.tm-front-dark .tm-modal-title {
    color: #f1f5f9;
}
.tm-front-dark .tm-modal-desc,
.tm-front-dark .tm-modal-reason {
    color: #94a3b8;
}
.tm-front-dark .tm-modal-reason-label {
    color: #e2e8f0;
}
.tm-front-dark .tm-modal-brand {
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
}

@media (max-width: 480px) {
    .tm-modal {
        max-width: 100%;
        border-radius: 16px;
    }
    .tm-modal-image {
        border-radius: 16px 16px 0 0;
    }
    .tm-modal-body {
        padding: 16px 18px 20px;
    }
    .tm-modal-title {
        font-size: 17px;
    }
}
