* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #f5f7fb;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 10px;
}

.tool-container {
    max-width: 1000px;
    margin: 0 auto;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 24px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

.tool-id-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    color: #64748b;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
}

.card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 12px;
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-content {
    padding: 16px 18px;
}

.desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 8px;
}

.image-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 12px;
    overflow: hidden;
    text-align: center;
}

.image-card img {
    max-width: 100%;
    height: auto;
    display: inline-block;
    border-radius: 16px;
}

.stats-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: #64748b;
}

.stats-bar span,
.stats-bar a,
.stats-bar button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.stats-bar a:hover,
.stats-bar button:hover {
    background: #e2e8f0;
}

.btn-bookmark {
    background: linear-gradient(135deg, #fef3c7, #fffbeb) !important;
    border-color: #fde68a !important;
    color: #92400e !important;
}

.btn-bookmark:hover {
    background: #fde68a !important;
}

.usage-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1e40af;
    line-height: 1.6;
}

.tab-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: all 0.2s;
    display: inline-block;
}

.tab-btn:hover {
    background: #f1f5f9;
}

.tab-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: #f8fafc;
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 13px;
}

td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

tr:hover td {
    background: #f8fafc;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.form-group input,
.form-group select {
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-row {
    grid-column: 1 / -1;
}

.btn-submit {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-submit:hover {
    background: #5a6fd8;
}

.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.r-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 72px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.r-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

.r-card .r-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.r-card .r-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    word-break: break-all;
}

.r-card.key-highlight {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.r-card.key-highlight .r-label {
    color: #1d4ed8;
}

.r-card.key-highlight .r-value {
    color: #1e40af;
}

.static-image {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 0 auto 12px auto;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.process-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.vip-card {
    background: #fffbeb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #fde68a;
    margin-top: 12px;
}

.canvas-wrap {
    margin: 12px 0;
}

.canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    cursor: zoom-in;
}

.btn-download {
    margin-top: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
}

.btn-download:hover {
    background: #e2e8f0;
}

.btn-vip-activate {
    display: inline-block;
    background: #b45309;
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.btn-vip-activate:hover {
    background: #92400e;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    width: 96vw;
    height: 96vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.modal-toolbar .btns {
    display: flex;
    gap: 8px;
}

.modal-btn {
    background: #f1f5f9;
    border: 1px solid #ddd;
    border-radius: 30px;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-image-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.modal-image-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

@media (max-width: 640px) {
    body {
        padding: 4px;
    }

    .card-content {
        padding: 12px 14px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px 4px;
        font-size: 11px;
    }

    .tab-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .r-card .r-value {
        font-size: 18px;
    }

    .modal-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        padding: 8px;
    }

    .modal-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
}
.btn-related {
    display: inline-block;
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    color: #475569;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-related:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #1e293b;
}