*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #e8edf4;
    color: #111827;
}

a {
    color: inherit;
    text-decoration: none;
}

.tn-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.tn-header {
    margin-bottom: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 4px 0 12px;
    box-shadow: none;
    text-align: center;
}

.tn-header-divider {
    height: 1px;
    background: #dde3ec;
    margin: 0 0 14px;
}

.tn-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.tn-cat-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 2px;
}

.tn-cat-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #dde3ec;
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.35;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tn-hot-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.tn-section-title .tn-hot-icon {
    width: 22px;
    height: 22px;
}

.tn-cat-nav-btn--hot:hover {
    border-color: #fda4af;
    color: #e11d48;
    background: #fff1f2;
}

.tn-cat-nav-btn:hover {
    border-color: #93c5fd;
    color: #2563eb;
    background: #f8fbff;
}

.tn-section {
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 12px;
    padding: 14px 14px 16px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
    scroll-margin-top: 12px;
}

.tn-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tn-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f6;
}

.tn-section-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    flex-wrap: nowrap;
    width: 100%;
}

.tn-section-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.tn-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tn-section-title-wrap > .tn-btn-primary {
    margin-left: auto;
    flex-shrink: 0;
}

.tn-btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: #22a066;
    padding: 0;
    margin-left: 4px;
    font-size: 15px;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
}

.tn-btn-copy:hover {
    color: #178a52;
}

.tn-btn-copy-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.tn-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
}

.tn-btn:hover {
    border-color: #93c5fd;
    color: #2563eb;
}

.tn-btn-primary {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tn-btn-more-arrow {
    font-size: 11px;
    line-height: 1;
    opacity: 0.92;
}

.tn-btn-primary:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.tn-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    background: #f4f6fa;
    border-radius: 10px;
    padding: 10px;
}

.tn-card {
    display: block;
    width: 100%;
    padding: 0;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tn-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.tn-card-cover {
    aspect-ratio: 1 / 1;
    background: #eef2f7;
    overflow: hidden;
}

.tn-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tn-card-name {
    padding: 4px 4px;
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f8fafc;
    color: #334155;
    border-top: 1px solid #eef2f6;
}

.tn-card.is-hidden {
    display: none;
}

.tn-empty {
    text-align: center;
    color: #6b7280;
    padding: 48px 16px;
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 12px;
}


.tn-toast {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 10050;
    transform: translate(-50%, -50%) scale(0.96);
    min-width: min(300px, 72vw);
    max-width: 88vw;
    padding: 18px 22px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    text-align: center;
    font-size: 15px;
    line-height: 1.65;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.tn-toast.is-show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.tn-toast-line + .tn-toast-line {
    margin-top: 2px;
}

.tn-back-top {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 900;
    width: 46px;
    height: 46px;
    border: 1px solid #dde3ec;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
    color: #2563eb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, box-shadow 0.15s ease;
}

.tn-back-top.is-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tn-back-top:hover {
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
    border-color: #bfdbfe;
}

.tn-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 16px calc(56px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.72);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    overscroll-behavior: none;
    touch-action: manipulation;
}

.tn-preview-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.tn-preview-panel {
    width: min(320px, calc(100vw - 32px));
    max-height: calc(100vh - 56px - env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transform: translateY(12px) scale(0.98);
    transition: transform 0.22s ease;
}

.tn-preview-modal.is-open .tn-preview-panel {
    transform: translateY(0) scale(1);
}

.tn-preview-phone {
    border: 5px solid #111;
    border-radius: 28px;
    background: #111;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
}

.tn-preview-status {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 52px 6px;
    background: #ececef;
    color: #111827;
    font-size: 12px;
    line-height: 1.2;
    flex-shrink: 0;
    margin: 0;
    border-radius: 23px 23px 0 0;
    z-index: 2;
}

.tn-preview-status-time {
    position: absolute;
    left: 16px;
    top: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #111827;
}

.tn-preview-status-title {
    position: relative;
    z-index: 1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    font-weight: 500;
    color: #111827;
}

.tn-preview-screen {
    position: relative;
    width: 100%;
    height: min(
        calc(min(320px, 100vw - 32px) * 19.5 / 9),
        calc(100vh - 178px - env(safe-area-inset-bottom, 0px))
    );
    margin: -1px 0 0;
    padding: 0;
    line-height: 0;
    font-size: 0;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
    z-index: 1;
}

.tn-preview-iframe {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: #000;
    vertical-align: top;
    touch-action: auto;
}

.tn-preview-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.tn-preview-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 40px;
    border: none;
    border-radius: 8px;
    padding: 8px 6px;
    font-size: 13px;
    line-height: 1.2;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}

.tn-preview-action svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.tn-preview-action--share {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.tn-preview-action--share:hover {
    background: rgba(255, 255, 255, 0.24);
}

.tn-preview-action--close {
    background: #d48472;
}

.tn-preview-action--close:hover {
    background: #c97461;
}

.tn-preview-action--make {
    background: #6b95e8;
}

.tn-preview-action--make:hover {
    background: #5a86df;
}

html.tn-preview-open,
body.tn-preview-open {
    overflow: hidden;
    overscroll-behavior: none;
}

body.tn-preview-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}
