:root {
    --bg-color: var(--tg-theme-bg-color, #000);
    --text-color: var(--tg-theme-text-color, #fff);
    --hint-color: var(--tg-theme-hint-color, #8e8e93);
    --link-color: var(--tg-theme-link-color, #007aff);
    --button-color: var(--tg-theme-button-color, #007aff);
    --button-text-color: var(--tg-theme-button-text-color, #fff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #1c1c1e);
    --card-bg: rgba(28, 28, 30, 0.8);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, views scroll */
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    overflow-y: auto;
    display: none;
    padding-bottom: 20px;
}

.view.active {
    display: block;
    animation: fadeIn 0.2s;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 8px;
    margin-top: 10px;
}

.title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.add-btn {
    font-size: 28px;
    color: var(--link-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 10px;
}

.otp-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.otp-card {
    background-color: var(--secondary-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.1s;
    cursor: pointer;
}

.otp-card:active {
    transform: scale(0.98);
    background-color: rgba(255, 255, 255, 0.05);
}

.otp-info {
    display: flex;
    flex-direction: column;
    z-index: 2;
    width: 100%;
}

.otp-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.otp-code {
    font-size: 28px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    letter-spacing: 2px;
    color: var(--link-color);
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--link-color);
    opacity: 0.3;
    transition: width 1s linear;
}

/* Tab Bar */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--hint-color);
    font-size: 10px;
    width: 50%;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-item.active {
    color: var(--link-color);
    transform: scale(1.05);
}

.tab-item.active svg {
    filter: drop-shadow(0 0 6px #007aff);
}

.tab-item svg {
    margin-bottom: 3px;
    transition: filter 0.2s;
}

.lang-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.lang-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    cursor: pointer;
}

.lang-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.lang-item span:nth-child(2) {
    flex: 1;
    font-size: 17px;
}

.lang-check {
    color: var(--link-color);
    font-size: 20px;
    opacity: 0;
}

.lang-check.active {
    opacity: 1;
}

/* Icons */
.icon-svg {
    width: 22px !important;
    height: 22px !important;
    display: block;
}

.setting-icon .icon-svg {
    width: 22px !important;
    height: 22px !important;
    color: var(--link-color);
}

.setting-icon .icon-svg.remove {
    color: #ff3b30;
}

.tab-item i,
.tab-item svg {
    margin-bottom: 2px;
}

/* Profile */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--secondary-bg);
    margin-bottom: 15px;
    object-fit: cover;
}

.profile-name {
    font-size: 24px;
    font-weight: 600;
}

.settings-list {
    background: var(--secondary-bg);
    border-radius: 12px;
    overflow: hidden;
}

.setting-item {
    padding: 16px;
    display: flex;
    align-items: center;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.setting-icon {
    font-size: 20px;
    margin-right: 15px;
    width: 24px;
    text-align: center;
}

.setting-text {
    flex: 1;
    font-size: 17px;
}

.setting-arrow {
    color: var(--hint-color);
}

/* PIN Overlay */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-color);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.pin-content {
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--text-color);
    transition: 0.2s;
}

.dot.filled {
    background: var(--text-color);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 0 20px;
}

.key {
    height: 70px;
    width: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto;
    cursor: pointer;
}

.key:active {
    background: rgba(255, 255, 255, 0.3);
}

.key.empty {
    background: transparent;
    cursor: default;
}

.key.back {
    font-size: 22px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.visible {
    display: flex;
    animation: fadeIn 0.15s ease-out;
}

.modal-content {
    background: var(--secondary-bg);
    width: 85%;
    max-width: 320px;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
}

.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 13px;
    color: var(--hint-color);
    margin-bottom: 6px;
}

.input-field {
    width: 100%;
    background: var(--bg-color);
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: var(--text-color);
    font-size: 17px;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.btn-save {
    background: var(--button-color);
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}