:root {
    --bg-primary: #0B1120;
    --bg-card: #111827;
    --color-primary: #229ED9;
    --color-accent: #38BDF8;
    --color-text: #F8FAFC;
    --color-text-muted: #94A3B8;
    --color-border: #1F2937;
    --color-success: #10B981;
    --color-error: #EF4444;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: calc(75px + var(--safe-bottom));
    padding-top: 60px;
}

.hidden {
    display: none !important;
}

.fullscreen-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--color-border);
    object-fit: cover;
}

.user-meta h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.user-meta span {
    font-size: 11px;
    color: var(--color-text-muted);
}

.header-action i {
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
}

#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(60px + var(--safe-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: var(--safe-bottom);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 10px;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    height: 100%;
}

.nav-item i {
    font-size: 20px;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--color-primary);
}

main {
    padding: 16px;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 16px 12px 42px;
    color: var(--color-text);
    font-size: 14px;
    outline: none;
}

.search-container input:focus {
    border-color: var(--color-primary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 18px;
}

.promo-banner {
    background: linear-gradient(135deg, #1E3A8A, #0F172A);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.promo-text h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.promo-text p {
    font-size: 12px;
    color: var(--color-text-muted);
}

.promo-icon {
    font-size: 32px;
    color: var(--color-accent);
}

.section-title {
    margin-bottom: 12px;
}

.section-title h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
}

.category-card i {
    font-size: 24px;
    color: var(--color-primary);
}

.category-card span {
    font-size: 13px;
    font-weight: 600;
}

.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.tool-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tool-info i {
    font-size: 22px;
    color: var(--color-accent);
    background: rgba(56, 189, 248, 0.1);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-meta h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.tool-meta p {
    font-size: 11px;
    color: var(--color-text-muted);
}

.tool-badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-free {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.badge-locked {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-accent);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 17, 32, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.modal-header i {
    font-size: 22px;
    cursor: pointer;
    color: var(--color-text-muted);
}

.modal-body {
    padding: 20px;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lock-icon {
    font-size: 36px;
    color: var(--color-accent);
    display: block;
    text-align: center;
    margin: 10px auto;
}

.accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
}

.accordion-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.accordion-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.accordion-header i {
    font-size: 18px;
    color: var(--color-text-muted);
    transition: transform 0.3s;
}

.accordion-item.open .accordion-header i {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 16px 16px;
    display: none;
}

.accordion-item.open .accordion-content {
    display: block;
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 24px;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-lbl {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.settings-list {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    overflow: hidden;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item i {
    font-size: 20px;
    color: var(--color-accent);
    margin-right: 14px;
}

.settings-item span {
    flex-grow: 1;
    font-size: 13px;
    font-weight: 500;
}

.settings-item .arrow {
    color: var(--color-text-muted);
    margin-right: 0;
}

.tool-layout {
    width: 95%;
    max-height: 90vh;
}

.tool-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-title-wrap i {
    font-size: 20px;
    color: var(--color-primary);
}

.tool-body {
    padding: 20px;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--color-text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--color-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(17, 24, 39, 0.5);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(34, 158, 217, 0.05);
}

.upload-zone i {
    font-size: 36px;
    color: var(--color-accent);
}

.upload-zone p {
    font-size: 12px;
    color: var(--color-text-muted);
}

.result-box {
    margin-top: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 16px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-header h5 {
    font-size: 12px;
    color: var(--color-success);
    font-weight: 600;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.unlocked-container, .history-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.empty-state i {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hist-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hist-main i {
    font-size: 18px;
    color: var(--color-accent);
}

.hist-details h5 {
    font-size: 13px;
    font-weight: 600;
}

.hist-details span {
    font-size: 10px;
    color: var(--color-text-muted);
}

.hist-status {
    font-size: 11px;
    font-weight: 500;
}

.status-success { color: var(--color-success); }
.status-failed { color: var(--color-error); }