@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
body {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    background: #1b1b1b;
    color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.container {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: visible;
    margin: 0 auto;
}

/* ========== INITIAL SCREEN LOADER ========== */
.screen-loader-container {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.screen-loader-dots {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 13px;
    transform: rotate(-45deg);
}

.dot {
    width: 4px;
    height: 4px;
    background: #43ff8e;
    animation: jumpWave 1.2s ease-in-out infinite;
}

.dot:nth-child(4) { animation-delay: 0s; }
.dot:nth-child(3) { animation-delay: 0.15s; }
.dot:nth-child(2) { animation-delay: 0.3s; }
.dot:nth-child(1) { animation-delay: 0.45s; }

@keyframes jumpWave {
    0% { transform: translateY(0); height: 4px; }
    50% { transform: translateY(-6px); height: 10px; }
    100% { transform: translateY(0); height: 4px; }
}

.fullscreen-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(27, 27, 27, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.fullscreen-loader.active { display: flex; }

/* ========== SCREENS ========== */
.screen {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    display: none;
    flex-direction: column;
    height: 100%;
}
.screen.active { display: flex; }

.screen-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 15px;
    margin-bottom: 15px;
    margin-right: -20px;
    padding-right: 20px;
}

.screen-content::-webkit-scrollbar { width: 4px; }
.screen-content::-webkit-scrollbar-track { background: transparent; }
.screen-content::-webkit-scrollbar-thumb { background: #767676; border-radius: 3px; }

/* ========== TRUST TITLE ========== */
.trust-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 18px;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    text-align: left;
    width: calc(100% + 40px);
    padding-bottom: 15px;
    flex-shrink: 0;
}

.full-divider {
    position: fixed;
    top: 53px;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
}

/* ========== SCREEN 0: TRUST WALLET CARD ========== */
.screen0-card-container {
    width: 100%;
    max-width: 250px;
    margin: 15px auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen0-card-image {
    width: 170px;
    height: auto;
    object-fit: contain;
    margin-left: 35px;
}

.screen0-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 15px;
    padding: 0 5px;
    letter-spacing: -0.3px;
    text-align: center;
}

.screen0-description {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: #999;
    line-height: 1.5;
    margin-bottom: 20px;
    padding: 0 5px;
    text-align: center;
}

.screen0-features {
    width: 100%;
    text-align: left;
    margin-bottom: 15px;
}

.screen0-features-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 10px;
    color: #fff;
}

.screen0-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.screen0-features-list li {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: #999;
    line-height: 1.5;
    margin-bottom: 6px;
    padding-left: 18px;
    position: relative;
}

.screen0-features-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #43ff8e;
    font-size: 16px;
    line-height: 1.3;
}

.screen0-footer-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    margin-top: 5px;
    margin-bottom: 15px;
    text-align: center;
}

/* light theme */
@media (prefers-color-scheme: light) {
    .screen0-features-list li { color: #555; }
    .screen0-features-list li::before { color: #555; }
    .screen0-features-list li strong { color: #000; }
}
/* ========== BUTTONS ========== */
.screen0-btn,
.screen3-btn,
.screen4-btn {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    width: 100%;
    background: #43ff8e;
    border: none;
    padding: 1rem;
    border-radius: 3rem;
    color: #000;
    font-size: 1rem;
    cursor: pointer;
    transition: none;
    text-align: center;
    flex-shrink: 0;
}

.screen0-btn {
    position: relative;
}

.screen0-btn::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -9999px;
    right: -9999px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.screen3-disabled {
    background: #1c3525 !important;
    color: #181818 !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
}

.screen4-btn.disabled {
    background: #1c3525 !important;
    color: #181818 !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    pointer-events: none;
    transition: none !important;
}

/* ========== BUTTON LOADING STATE ========== */
.screen0-btn.loading,
.screen3-btn.loading,
.screen4-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.screen0-btn.loading::after,
.screen3-btn.loading::after,
.screen4-btn.loading::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: #000;
    animation: btnSpinner 0.8s linear infinite;
}

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

/* ========== BOTTOM SHEET OVERLAY ========== */
.bottom-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 998;
}
.bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========== BOTTOM SHEET ========== */
.bottom-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1b1b1b;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.bottom-sheet.active { transform: translateY(0); }

@media (min-width: 768px) {
    .bottom-sheet {
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        max-width: 430px;
        width: 100%;
    }
    .bottom-sheet.active { transform: translateX(-50%) translateY(0); }
}

.bottom-sheet:has(#sheet5[style*="display: block"]) {
    max-height: 96vh;
}
.bottom-sheet:has(#sheet5[style*="display: block"]) .bottom-sheet-content {
    overflow-y: hidden;
}
.bottom-sheet:has(#sheetIntro[style*="display: block"]) {
    height: 92vh;
    max-height: 92vh;
}

/* ========== SHEET HEADER ========== */
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.sheet-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 18px;
    flex: 1;
    text-align: center;
}

.sheet-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    margin-left: auto;
}

.sheet-back-btn {
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.sheet-close-btn:hover,
.sheet-back-btn:hover { opacity: 0.7; }

.sheet-spacer { width: 32px; }

.bottom-sheet-content {
    animation: fadeIn 0.3s ease;
    text-align: center;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 15px;
    margin-right: -20px;
    padding-right: 20px;
}

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

.bottom-sheet-content::-webkit-scrollbar { width: 4px; }
.bottom-sheet-content::-webkit-scrollbar-track { background: transparent; }
.bottom-sheet-content::-webkit-scrollbar-thumb { background: #767676; border-radius: 3px; }

/* ========== SHEET INTRO ========== */
.intro-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 25px;
}

.intro-img {
    margin-top: 20px;
    width: 140px;
    height: auto;
    object-fit: contain;
}

.intro-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 24px;
    color: #fff;
    text-align: center;
    margin-bottom: 12px;
}

.intro-desc {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 18px;
    color: #888;
    text-align: center;
    line-height: 1.5;
    padding: 0 15px;
    margin-bottom: 20px;
}

.intro-btn {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    width: 100%;
    background: #43ff8e;
    border: none;
    padding: 1rem;
    border-radius: 3rem;
    color: #000;
    font-size: 1.1rem;
    cursor: pointer;
    text-align: center;
    flex-shrink: 0;
}
@media (max-width: 424px) {
    .intro-title { font-size: 22px; }
    .intro-desc { font-size: 17px; }
    .intro-img { width: 135px; }
    .intro-btn { font-size: 1.05rem; }
}

@media (max-width: 409px) {
    .intro-title { font-size: 20px; }
    .intro-desc { font-size: 15px; }
    .intro-img { width: 125px; }
    .intro-btn { font-size: 1rem; }
}

/* ========== SCREEN 3: CHECKBOXES ========== */
.screen3-icon-container {
    width: 170px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen3-cross-icon {
    width: 100%;
    max-width: 320px;
    height: auto;
    margin-bottom: 30px;
}

.screen3-warning-label {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #b5b5b5;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.screen3-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.screen3-warning-icon {
    width: 19px;
    height: 17px;
    flex-shrink: 0;
}

.screen3-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: #ffffff;
    text-align: center;
    margin-bottom: 20px;
    word-spacing: 0.1rem;
}

.screen3-checkboxes-container {
    margin-top: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 90px;
}

.screen3-checkbox-item {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    padding: 12px;
    border-radius: 12px;
    background: #1f1f1f;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: none;
}

.screen3-checkbox-item input[type="checkbox"] { display: none; }

.screen3-checkbox-custom {
    min-width: 24px;
    width: 24px;
    height: 24px;
    border: 2px solid #444;
    border-radius: 3px;
    position: relative;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.screen3-checkbox-item input[type="checkbox"]:checked + .screen3-checkbox-custom {
    background: #43ff8e;
    border-color: #43ff8e;
}

.screen3-checkbox-item input[type="checkbox"]:checked + .screen3-checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: 16px;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 700;
}

.screen3-checkbox-text {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    flex: 1;
    font-size: 12px;
    color: #b5b5b5;
    line-height: 1.5;
    text-align: left;
}

/* ========== SCREEN 5: PHRASE INPUT ========== */
.screen4-icon-container {
    width: 150px;
    margin: -20px auto 10px;
}

.screen4-cross-icon {
    margin-top: 20px;
    width: 90%;
    max-width: 200px;
    height: auto;
}

.screen4-subtitle {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: #a8a8aa;
    text-align: center;
    padding: 0;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.screen4-phrase-section {
    text-align: left;
    width: 100%;
}

.screen4-phrase-label {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: #a8a8aa;
    margin-bottom: 8px;
}

.screen4-phrase-input-wrapper {
    position: relative;
}

.screen4-phrase-input {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 0.9rem;
    color: #fff;
    font-size: 0.95rem;
    resize: none;
    height: 160px;
    line-height: 1.6;
    touch-action: manipulation;
    margin-bottom: -5px;
}

.screen4-phrase-input:focus {
    outline: none;
    border-color: #43ff8e;
}

.screen4-phrase-input::placeholder { color: #555; }

.screen4-paste-btn {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    background: none;
    border: none;
    color: #43ff8e;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
    touch-action: manipulation;
}

.screen4-input-hint {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    text-align: center;
    font-size: 0.82rem;
    color: #a8a8aa;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.screen4-phrase-error {
    color: #ff5a5b;
    font-size: 12px;
    text-align: left;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.6s ease;
    margin: 0;
}

.screen4-phrase-error.visible {
    opacity: 1;
    max-height: 30px;
    margin-top: 5px;
    margin-left: 5px;
    margin-bottom: 2px;
}

/* ========== KEYBOARD SUGGESTIONS ========== */
.keyboard-suggestions {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: transparent;
    padding: 10px 0 10px 15px;
    z-index: 10000;
    display: none;
    max-width: 430px;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.keyboard-suggestions.active {
    display: block;
    background: #1a1a1a;
}

.screen4-word-badges-keyboard {
    display: flex;
    gap: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.screen4-word-badges-keyboard::-webkit-scrollbar { display: none; }

.word-badge {
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    background: #43ff8e;
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 16px;
    color: #000;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.keyboard-open .bottom-sheet {
    overflow-x: hidden;
    max-width: 100vw;
    left: 0;
    right: 0;
}
.keyboard-open {
    position: fixed;
    width: 100%;
}
.keyboard-open .container {
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
    overflow: hidden;
}

@media (min-width: 768px) {
    .keyboard-suggestions {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* ========== BUTTON SPINNER ========== */
.btn-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: btnSpinner 0.7s linear infinite;
    vertical-align: middle;
}

/* ========== LIGHT THEME ========== */
@media (prefers-color-scheme: light) {
    body { background: #ffffff; color: #000; }
    .bottom-sheet { background: #ffffff; }
    .fullscreen-loader { background: rgba(255, 255, 255, 0.9); }
    .sheet-close-btn, .sheet-back-btn { color: #000; }
    .trust-title { border-bottom: 1px solid rgba(0, 0, 0, 0.1); }

    .screen0-btn, .screen3-btn, .screen4-btn { background: #0000ff; color: #fff; }
    .screen0-btn::before { background: rgba(0, 0, 0, 0.1); }
    .screen0-btn.loading::after, .screen3-btn.loading::after, .screen4-btn.loading::after {
        border-color: rgba(255, 255, 255, 0.3);
        border-top-color: #fff;
    }

    .screen3-disabled { background: #e0e0e0 !important; color: #999 !important; }
    .screen4-btn.disabled { background: #e0e0e0 !important; color: #999 !important; }

    .screen0-title { color: #000; }
    .screen0-description { color: #555; }
    .screen0-features-title { color: #000; }
    .screen0-features-body { color: #555; }
    .screen0-features-list li { color: #444; }
    .screen0-features-list li strong { color: #000; }
    .screen0-features-list li::before { color: #0000ff; }

    .screen-loader-container { background: rgba(0, 0, 0, 0.05); }
    .dot { background: #0000ff; }

    .intro-title { color: #000; }
    .intro-desc { color: #666; }
    .intro-btn { background: #0000ff; color: #fff; }

    .screen3-checkbox-item { background: #f5f5f5; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
    .screen3-checkbox-custom { border-color: #d0d0d0; }
    .screen3-checkbox-item input[type="checkbox"]:checked + .screen3-checkbox-custom { background: #0000ff; border-color: #0000ff; }
    .screen3-checkbox-item input[type="checkbox"]:checked + .screen3-checkbox-custom::after { color: #fff; }
    .screen3-checkbox-text { color: #333; }
    .screen3-title { color: #000; }

    .screen4-phrase-input { background: #f5f5f5; border-color: #d0d0d0; color: #000; }
    .screen4-phrase-input:focus { border-color: #0000ff; }
    .screen4-phrase-input::placeholder { color: #999; }
    .screen4-paste-btn { color: #0000ff; }
    .screen4-input-hint { color: #999; }
    .screen4-subtitle, .screen4-phrase-label { color: #a8a8aa; }

    .word-badge { background: #0000ff; color: #fff; }
    .keyboard-suggestions.active { background: #fff; }

    .screen-content::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); }
    .btn-spinner { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
}