::view-transition-old(root) {
    animation: fadeOut 0.3s ease-out;
  }
  
  ::view-transition-new(root) {
    animation: fadeIn 0.3s ease-in;
  }
  
  @keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: scale(1.05); }
  }

:root {
    --color-primary: rgb(135, 116, 225);
    --color-primary-opacity: rgb(131,120,219,0.118);
    --color-primary-opacity-hover: rgb(131, 120, 219, 0.251);
    --color-primary-shade: rgb(123, 113, 198);
    --color-primary-shade-rgb: 123, 113, 198;
    --color-background: rgb(33, 33, 33);
    --color-background-secondary: rgb(15, 15, 15);
    --color-text: rgb(255, 255, 255);
    --color-text-secondary: rgb(170, 170, 170);
    --color-borders: rgb(48, 48, 48);
    --color-borders-input: rgb(91, 91, 90);
    --color-item-hover: rgb(44, 44, 44);
    --color-links: rgb(135, 116, 225);
    --border-radius-default: 0.75rem;
    --border-width: 1px;
    --color-scrollbar: rgba(90, 90, 90, 0.3);
    --color-scrollbar-code: rgba(200, 200, 200, 0.3);
    --z-scroll-down-button: 12;
    --scrollbar-width: 10px;
    --color-background-compact-menu: rgba(33, 33, 33, 0.867);
    --color-background-compact-menu-hover: rgba(0, 0, 0, 0.4);
    --color-chat-hover: rgb(44, 44, 44);
    --color-default-shadow: rgba(16, 16, 16, 0.612);
    --z-menu-bubble: 21;
    --font-weight-medium: 500;
    --color-white: #ffffff;
    --font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
    --font-family-monospace: "Cascadia Mono", "Roboto Mono", "Droid Sans Mono", "SF Mono", "Menlo", "Ubuntu Mono", "Consolas", monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

html {
    font-family: var(--font-family);
    scrollbar-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
    scrollbar-width: thin;
    transition: scrollbar-color .3s ease;
    scrollbar-gutter: stable;
}

html:hover,
html:focus,
html:focus-within {
    scrollbar-color: var(--color-scrollbar) rgba(0, 0, 0, 0);
}

html::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

html::-webkit-scrollbar-track {
    background: transparent;
}

html::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s ease;
}

html:hover::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar);
}

html::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 90, 90, 0.5);
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    /* min-height: 100vh; */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding-bottom: 2rem;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    opacity: 0;
    animation: pageFadeIn 0.5s ease-in-out forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(0px); /* Optional: slight slide-up effect */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form {
    width: 100%;
    max-width: 25.5rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 1.5rem;
    padding-bottom: 400px;
    text-align: center;
    position: relative;
}

@media (min-width: 600px) and (min-height: 450px) {
    .auth-form {
        padding: 6.8125rem 1.5rem 1.5rem;
        padding-bottom: 10rem;
    }
}

#logo {
    width: 160px;
    height: 160px;
    margin: 0 auto 2.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

h1 {
    font-size: 2rem;
    font-weight: 500;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
    color: var(--color-text);
}

.note {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin: 0 0 3rem 0;
    line-height: 1.35;
}

.form {
    width: 100%;
}

.input-group {
    position: relative;
    margin-bottom: 2px;
}

.input-group.with-label {
    margin-top: 1.125rem;
}

.form-control {
    --border-width: 1px;
    display: block;
    width: 100%;
    height: 3rem;
    padding: calc(0.75rem - var(--border-width)) calc(1.1875rem - var(--border-width)) 0.6875rem;
    border: var(--border-width) solid var(--color-borders-input);
    border-radius: var(--border-radius-default);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.25rem;
    color: var(--color-text);
    overflow-wrap: anywhere;
    -webkit-appearance: none;
    background-color: var(--color-background);
    outline: none;
    appearance: none;
    transition: border-color 0.15s ease;
    touch-action: manipulation;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.form-control[dir] {
    text-align: initial;
}

.input-group label {
    position: absolute;
    left: calc(1.1875rem - var(--border-width));
    top: calc(50% - 0.1rem);
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-size: 1rem;
    line-height: 1.25rem;
    pointer-events: none;
    transition: all 0.2s ease;
    background-color: var(--color-background);
    padding: 0 4px;
}

.form-control:focus ~ label,
.form-control:not(:placeholder-shown) ~ label,
.form-control.has-value ~ label {
    top: -1px;
    transform: translateY(-50%);
    font-size: 0.75rem;
    margin-left: -2px;
    color: var(--color-primary);
}

.form-control:not(:focus):not(:placeholder-shown) ~ label,
.form-control.has-value:not(:focus) ~ label {
    color: var(--color-text-secondary);
}

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

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: inset 0 0 0 1px var(--color-primary);
    caret-color: var(--color-primary);
}

/* 1. The Spinner Element */
.spinner {
    display: none; /* Hidden by default */
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff; /* White spinning segment */
    animation: spin 0.8s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 2. The Button Loading State */
.Button.loading {
    position: relative;
    color: transparent !important; /* Hide the text (NEXT) but keep button size */
    pointer-events: none; /* Prevent double clicks */
}

.Button.loading .spinner {
    display: block; /* Show the spinner when button has .loading class */
}

.css-icon-down {
    position: absolute;
    right: calc(1rem - 5px);
    top: calc(50%);
    transform: translateY(-50%) scaleY(1);
    pointer-events: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: transform 0.15s cubic-bezier(0.2, 0, 0.2, 1), color 0.15s ease;
}

.CountryCodeInput.dropdown-open .css-icon-down {
    transform: translateY(-50%) scaleY(-1);
    color: var(--color-primary);
}

.Button {
    --premium-gradient: linear-gradient(88.39deg, #6C93FF -2.56%, #976FFF 51.27%, #DF69D1 107.39%);
    cursor: var(--custom-cursor, pointer);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 3rem;
    padding: 0.625rem;
    border: 0;
    border-radius: var(--border-radius-default);
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
    line-height: 1.2;
    color: #fff;
    text-decoration: none !important;
    text-transform: uppercase;
    background-color: rgba(0, 0, 0, 0);
    background-size: cover;
    outline: none !important;
    transition: background-color 0.15s, color 0.15s, opacity 0.15s;
}

.Button.auth-button, .auth-button {
    margin-top: 2.5rem;
}

.Button.auth-button.with-next {
    margin-top: 0.5rem;
}

.Button.primary {
    --ripple-color: rgba(0, 0, 0, 0.08);
    color: var(--color-white);
    background-color: var(--color-primary);
}

.Button.text {
    background-color: rgba(0, 0, 0, 0);
}

.Button.text.primary {
    color: var(--color-primary);
    background-color: rgba(0, 0, 0, 0);
}

@media (hover: hover) {
    .Button.primary:not(.disabled):not(:disabled):hover {
        background-color: var(--color-primary-shade);
    }

    .Button.text.primary:not(.disabled):not(:disabled):hover {
        background-color: rgba(var(--color-primary-shade-rgb), 0.08);
    }
}

.ripple-container {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
}

.Checkbox {
    cursor: var(--custom-cursor, pointer);
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3rem;
    margin-top: 1.125rem;
    margin-bottom: 0;
    padding: 0.5rem 1rem;
    padding-inline-start: 4rem;
    text-align: left;
    user-select: none;
    border-radius: var(--border-radius-default);
    transition: background-color 0.15s ease;
}

.Checkbox:hover,
.Checkbox:focus-visible {
    background-color: var(--color-chat-hover);
    border-radius: var(--border-radius-default);
}

.Checkbox:focus-visible {
    outline: none;
}

.Checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.Checkbox-main {
    display: flex;
    align-items: center;
    width: 100%;
}

.checkbox-icon {
    position: absolute;
    left: calc(1rem + 2px);
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--color-borders-input);
    border-radius: 0.25rem;
    background-color: transparent;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-check {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
    color: var(--color-white);
}

.Checkbox input[type="checkbox"]:checked ~ .Checkbox-main .checkbox-icon {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.Checkbox input[type="checkbox"]:checked ~ .Checkbox-main .checkbox-check {
    opacity: 1;
    transform: scale(1);
}

.Checkbox:hover .checkbox-icon {
    border-color: var(--color-primary);
}

.Checkbox .label {
    font-size: 1rem;
    color: var(--color-text);
    line-height: 1.5rem;
}

.Menu.compact {
    position: relative;
}

.bubble.menu-container {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--color-background-compact-menu);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    border-radius: var(--border-radius-default);
    z-index: var(--z-menu-bubble);
    opacity: 0;
    transform-origin: top center !important;
    transform: scaleY(0.95);
    transition: opacity 150ms cubic-bezier(0.2, 0, 0.2, 1), transform 150ms cubic-bezier(0.2, 0, 0.2, 1) !important;
    box-shadow: 0 0.25rem 0.5rem 0.125rem var(--color-default-shadow);
    pointer-events: none;
}

.custom-scroll::-webkit-scrollbar,
.custom-scroll-x::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

.custom-scroll::-webkit-scrollbar-track,
.custom-scroll-x::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.custom-scroll::-webkit-scrollbar-thumb,
.custom-scroll-x::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.custom-scroll:hover::-webkit-scrollbar-thumb,
.custom-scroll:focus::-webkit-scrollbar-thumb,
.custom-scroll:focus-within::-webkit-scrollbar-thumb,
.custom-scroll-x:hover::-webkit-scrollbar-thumb,
.custom-scroll-x:focus::-webkit-scrollbar-thumb,
.custom-scroll-x:focus-within::-webkit-scrollbar-thumb {
    background: var(--color-scrollbar);
}

.custom-scroll::-webkit-scrollbar-thumb:hover,
.custom-scroll-x::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 90, 90, 0.5);
}

.bubble.menu-container.open {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
}

.bubble.menu-container.not-open {
    opacity: 0;
    transform: scaleY(0.95);
    pointer-events: none;
}

.MenuItem {
    --ripple-color: rgba(0, 0, 0, 0.08);
    cursor: var(--custom-cursor, pointer);
    position: relative;
    unicode-bidi: plaintext;
    overflow: hidden;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none !important;
    line-height: 1.5rem;
    color: var(--color-text);
    white-space: nowrap;
    background: none;
    outline: none !important;
    box-shadow: none !important;
}

.MenuItem.compact {
    will-change: transform;
    transform: scale(1);
    width: auto;
    margin: 0.25rem;
    padding: 0rem 0.25rem;
    padding-inline-end: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    transition: 0.15s ease-in-out transform;
}

@media (hover: hover) {
    .MenuItem:hover,
    .MenuItem:focus {
        color: inherit;
        text-decoration: none;
        background-color: var(--color-chat-hover);
    }

    .MenuItem.compact:hover,
    .MenuItem.compact:focus,
    .MenuItem.compact:active {
        text-decoration: none;
        background: var(--color-background-compact-menu-hover);
    }

    .MenuItem.compact:active {
        transform: scale(0.98);
    }
}

.country-flag {
    width: 36px;
    height: 26px;
    margin-right: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.country-name {
    flex: 1;
    text-align: left;
    color: var(--color-text);
    font-size: 0.9375rem;
}

.country-code {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    padding-left: 1rem;
    font-weight: 500;
}

#sign-in-phone-code {
    padding-right: 3rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

.flag-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 0.75rem;
}

.custom-scroll, .custom-scroll-x {
    pointer-events: auto;
    scrollbar-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
    scrollbar-width: thin;
    transition: scrollbar-color .3s ease;
    -webkit-overflow-scrolling: touch;
}

.custom-scroll:hover,
.custom-scroll:focus,
.custom-scroll:focus-within,
.custom-scroll-x:hover,
.custom-scroll-x:focus,
.custom-scroll-x:focus-within {
    scrollbar-color: var(--color-scrollbar) rgba(0, 0, 0, 0);
}

@media (max-width: 600px) {
    .auth-form {
        padding: 4rem 1rem 1rem;
    }

    #logo {
        width: 120px;
        height: 120px;
        margin: 0 auto 1.75rem auto;
    }

    h1 {
        font-size: 1.25rem;
        line-height: 1;
    }

    .note {
        font-size: 0.875rem;
        line-height: 1.35;
        margin-bottom: 2.5rem;
    }
}
