:root {
    --bg-color: #141414;
    --card-bg: #1a1a1a;
    --text-color: #ffffff;
    --text-secondary: #949e9e;
    --accent-color: #3396ff;
    --border-radius: 32px;
    --input-bg: #272a2a;

    /* Unified Theme Variables */
    --app-max-h: 88vh;
    --bg-dark: var(--bg-color);
    --card-bg: var(--card-bg);
    --primary: var(--accent-color);
    --primary-hover: #2b7ac4;
    --text-main: var(--text-color);
    --text-muted: var(--text-secondary);
    --border: #333;
    --card-border: rgba(255, 255, 255, 0.05);
    --radius-lg: var(--border-radius);
    --radius-md: 12px;
    --success: #10b981;
    --error: #ef4444;
}

[data-theme="light"] {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-secondary: #65676b;
    --input-bg: #e4e6eb;
    --border: #ddd;
    --card-border: rgba(0, 0, 0, 0.1);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 86vh;
}

.app-container {
    width: 100%;
    max-width: 360px;
    min-height: 600px;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}

.wallet-modal {
    background-color: var(--bg-color);
    width: 100%;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-header h6 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent-color);
    color: var(--text-main);
    border-color: var(--accent-color);
}

.theme-btn svg {
    position: absolute;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
    visibility: hidden;
}

.moon-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
    visibility: visible;
}

/* Light Mode State */
[data-theme="light"] .sun-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
    color: #f59e0b;
    /* Amber for sun */
    visibility: visible;
}

[data-theme="light"] .moon-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    visibility: hidden;
}

[data-theme="light"] .theme-btn:hover {
    box-shadow: 0 0 15px #f59e0b;
    border-color: #f59e0b;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-style: normal;
    font-size: 16px;
    line-height: 1;
}

#wallet-search {
    width: 100%;
    padding: 12px;
    background-color: var(--input-bg);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

#wallet-search:focus {
    border-color: var(--accent-color);
}

.wallet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px;
    margin: 0 -4px;
    flex-grow: 1;
    /* Allow grid to take remaining space */
}

/* Scrollbar styling */
.wallet-grid::-webkit-scrollbar {
    width: 4px;
}

.wallet-grid::-webkit-scrollbar-track {
    background: transparent;
}

.wallet-grid::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.wallet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
    max-width: 80px;
}

.wallet-item:hover {
    opacity: 0.8;
}

.wallet-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    margin-bottom: 8px;
    object-fit: cover;
    background-color: #272a2a;
}

.wallet-name {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 80px;
}

/* --- Imported Styles from index2.html --- */

.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    transition: transform .3s cubic-bezier(.16, 1, .3, 1), opacity .3s ease;
    overflow-y: auto;
    box-sizing: border-box;
    /* Fix layout issue */
}

/* ----------  DARK SCROLLBAR  ---------- */
.card::-webkit-scrollbar {
    width: 6px;
}

.card::-webkit-scrollbar-track {
    background: transparent;
}

.card::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.card::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

#import-wallet-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    margin: 0 auto 16px auto;
    display: block;
    object-fit: cover;
    background: var(--input-bg);
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    text-align: center;
}

.sub {
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 24px 0;
    font-size: 15px;
    line-height: 1.5;
}

.segmented-control {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 50px;
    flex-shrink: 0;
    margin-bottom: 24px;
}

.segment-option {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 40px;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.segment-option.active {
    background: var(--primary);
    color: white;
}

.segment-option:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .1s, opacity .2s;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.btn:active {
    transform: scale(.98);
}

.btn-primary {
    background: var(--primary-hover);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, .05);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, .1);
}

.input-group {
    margin-bottom: 16px;
    position: relative;
}

input[type=text],
input[type=password],
input[type=email],
textarea {
    width: 100%;
    background: #334155;
    border: 1px solid transparent;
    padding: 14px 16px;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
    box-sizing: border-box;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
}

textarea {
    resize: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    margin: 20px 0;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.seed-container {
    background: rgba(0, 0, 0, .2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--card-border);
    max-height: 320px;
    overflow-y: auto;
    flex-grow: 1;
    /* Allow it to take space */
}

.words-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.word-item {
    position: relative;
}

.word-item input {
    padding-left: 40px;
    font-size: 14px;
    height: 42px;
    padding-top: 0;
    padding-bottom: 0;
    background: var(--input-bg);
    border: 1px solid transparent;
}

.word-item input:focus {
    border-color: var(--primary);
    background: #2c3030;
}

.word-item span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
}

.blur-overlay {
    filter: blur(4px);
    transition: filter .3s;
    user-select: none;
}

.blur-overlay.revealed {
    filter: none;
    user-select: auto;
}

.copy-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}

.copy-btn:hover {
    background: rgba(139, 92, 246, .1);
}

.chain-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.chain-chip {
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--card-border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.chain-chip:hover {
    background: rgba(255, 255, 255, .1);
}

.chain-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn .3s cubic-bezier(.16, 1, .3, 1);
    border: 1px solid rgba(255, 255, 255, .1);
    pointer-events: auto;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.text-error {
    color: var(--error);
    font-size: 13px;
    margin-top: 6px;
    min-height: 20px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake .3s ease-in-out;
}

.hidden {
    display: none !important;

}






