:root {
    color-scheme: dark;

    --bg: #100d20;
    --bg-secondary: #17112a;
    --glass: rgba(31, 24, 57, 0.76);
    --glass-strong: rgba(40, 31, 72, 0.92);
    --surface: rgba(255, 255, 255, 0.05);
    --surface-strong: rgba(8, 6, 20, 0.55);

    --line: rgba(255, 255, 255, 0.12);
    --text: #fff8ff;
    --muted: #c9bdd9;

    --pink: #ff8fc7;
    --pink-strong: #ff5ca8;
    --purple: #a78bfa;
    --blue: #7dd3fc;
    --green: #7ef0c4;
    --danger: #ff8a9d;

    --hero-start: rgba(72, 45, 104, 0.9);
    --hero-end: rgba(30, 25, 59, 0.88);

    --shadow: 0 25px 80px rgba(5, 2, 18, 0.48);
}

html[data-theme="light"] {
    color-scheme: light;

    --bg: #fff7fc;
    --bg-secondary: #f4efff;
    --glass: rgba(255, 255, 255, 0.78);
    --glass-strong: rgba(255, 255, 255, 0.94);
    --surface: rgba(92, 61, 130, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.76);

    --line: rgba(85, 60, 120, 0.14);
    --text: #332541;
    --muted: #786b87;

    --pink: #e7569f;
    --pink-strong: #e54596;
    --purple: #7c5ce4;
    --blue: #2b9ac8;
    --green: #168f6b;
    --danger: #d64d67;

    --hero-start: rgba(255, 226, 244, 0.96);
    --hero-end: rgba(229, 222, 255, 0.96);

    --shadow: 0 24px 70px rgba(78, 49, 109, 0.17);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;

    color: var(--text);
    font-family:
        Inter,
        ui-rounded,
        "SF Pro Rounded",
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at 10% 10%,
            rgba(255, 92, 168, 0.17),
            transparent 28rem
        ),
        radial-gradient(
            circle at 85% 8%,
            rgba(125, 211, 252, 0.15),
            transparent 30rem
        ),
        radial-gradient(
            circle at 50% 100%,
            rgba(167, 139, 250, 0.17),
            transparent 34rem
        ),
        linear-gradient(
            145deg,
            var(--bg),
            var(--bg-secondary) 50%,
            var(--bg)
        );

    transition:
        background 0.35s ease,
        color 0.35s ease;
}

body::before {
    content: "";

    position: fixed;
    inset: 0;

    pointer-events: none;

    background-image:
        linear-gradient(
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px
        );

    background-size: 42px 42px;

    mask-image:
        linear-gradient(
            to bottom,
            black,
            transparent 70%
        );
}

html[data-theme="light"] body::before {
    background-image:
        linear-gradient(
            rgba(87, 56, 125, 0.035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(87, 56, 125, 0.035) 1px,
            transparent 1px
        );
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-shell {
    position: relative;
    z-index: 2;

    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 70px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    margin-bottom: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

.brand-icon {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    border: 1px solid var(--line);
    border-radius: 13px;

    color: var(--pink);

    background: var(--glass);
    box-shadow: var(--shadow);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    min-height: 42px;
    padding: 8px 14px;

    border: 1px solid var(--line);
    border-radius: 14px;

    color: var(--text);
    font-weight: 800;

    background: var(--glass);

    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.theme-icon {
    font-size: 1.05rem;
}

.glass-card,
.hero-card {
    border: 1px solid var(--line);

    box-shadow: var(--shadow);

    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.hero-card {
    display: grid;
    grid-template-columns:
        minmax(0, 1.45fr)
        minmax(220px, 0.55fr);

    min-height: 235px;
    overflow: hidden;

    border-radius: 28px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.08),
            transparent 45%
        ),
        linear-gradient(
            145deg,
            var(--hero-start),
            var(--hero-end)
        );
}

.hero-copy {
    align-self: center;
    padding: clamp(26px, 4vw, 42px);
}

.kicker,
.eyebrow {
    display: block;

    color: var(--pink);

    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero-copy h1 {
    max-width: 720px;
    margin: 10px 0 12px;

    font-size: clamp(2rem, 5vw, 3.8rem);
    line-height: 1.02;
    letter-spacing: -0.05em;
}

.hero-copy h1 span {
    background:
        linear-gradient(
            90deg,
            var(--text),
            var(--pink) 48%,
            var(--blue)
        );

    -webkit-background-clip: text;
    background-clip: text;

    color: transparent;
}

.hero-copy p {
    max-width: 650px;
    margin: 0;

    color: var(--muted);

    font-size: 0.98rem;
    line-height: 1.65;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 16px;
}

.hero-tags span {
    padding: 8px 11px;

    border: 1px solid var(--line);
    border-radius: 999px;

    color: var(--text);
    background: var(--surface);

    font-size: 0.82rem;
}

.mascot-panel {
    position: relative;

    display: grid;
    place-items: center;

    min-height: 220px;

    isolation: isolate;
}

.moon {
    position: absolute;

    width: 155px;
    aspect-ratio: 1;

    border-radius: 50%;

    background:
        radial-gradient(
            circle at 32% 30%,
            #fff7fb,
            #ffd1e8 35%,
            #c4a6ff 75%
        );

    box-shadow:
        0 0 55px rgba(255, 183, 221, 0.35);

    opacity: 0.9;
}

.mascot-card {
    position: relative;

    width: 135px;
    padding: 17px 14px 13px;

    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 28px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.28),
            rgba(255, 255, 255, 0.1)
        );

    box-shadow:
        0 17px 40px rgba(45, 20, 76, 0.28);

    transform: rotate(3deg);
}

.mascot-face {
    position: relative;

    width: 92px;
    height: 82px;
    margin: 0 auto;

    border-radius: 46% 46% 42% 42%;

    background:
        linear-gradient(
            160deg,
            #ffffff,
            #fce2f1
        );
}

.ear {
    position: absolute;
    top: -12px;

    width: 30px;
    height: 37px;

    background: #fff3fb;

    clip-path:
        polygon(
            50% 0,
            100% 100%,
            0 100%
        );
}

.ear.left {
    left: 10px;
    transform: rotate(-12deg);
}

.ear.right {
    right: 10px;
    transform: rotate(12deg);
}

.eye {
    position: absolute;
    top: 36px;

    width: 9px;
    height: 13px;

    border-radius: 50%;

    background: #59406f;
}

.eye.left {
    left: 25px;
}

.eye.right {
    right: 25px;
}

.mouth {
    position: absolute;
    left: 50%;
    bottom: 19px;

    width: 14px;
    height: 8px;

    border-bottom: 3px solid #c45c92;
    border-radius: 50%;

    transform: translateX(-50%);
}

.mascot-label {
    margin-top: 10px;

    color: white;

    font-size: 0.73rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-align: center;
}

.sparkle {
    position: absolute;

    color: white;

    text-shadow:
        0 0 16px rgba(255, 255, 255, 0.9);

    animation:
        twinkle 2.5s ease-in-out infinite;
}

.s1 {
    top: 14px;
    right: 9px;
}

.s2 {
    left: -6px;
    top: 60px;

    animation-delay: 0.7s;
}

.s3 {
    right: 3px;
    bottom: 42px;

    animation-delay: 1.2s;
}

.search-card,
.latest-card,
.inbox-card,
.history-card {
    border-radius: 24px;
    background: var(--glass);
}

.search-card {
    margin-top: 14px;
    padding: 22px;
}

.section-heading,
.card-topline,
.sender-grid,
.otp-card,
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.section-heading h2,
.card-topline h2,
.inbox-card h2,
.history-card h2 {
    margin: 5px 0 0;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    color: var(--muted);

    font-size: 0.85rem;
}

.status-dot span {
    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 16px rgba(126, 240, 196, 0.8);
}

form {
    margin-top: 20px;
}

label {
    display: block;

    margin-bottom: 10px;

    color: var(--text);

    font-weight: 800;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 17px;

    color: var(--pink);

    transform: translateY(-50%);
}

input[type="email"] {
    width: 100%;
    min-width: 0;

    padding:
        17px
        18px
        17px
        48px;

    border: 1px solid var(--line);
    border-radius: 16px;
    outline: none;

    color: var(--text);
    background: var(--surface-strong);

    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.25s ease,
        background 0.25s ease;
}

input[type="email"]:focus {
    border-color:
        rgba(255, 143, 199, 0.7);

    box-shadow:
        0 0 0 5px
        rgba(255, 92, 168, 0.12);

    transform: translateY(-1px);
}

.primary-button,
.copy-button,
.icon-button {
    border: 0;

    color: white;

    font-weight: 900;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    min-width: 190px;
    padding: 0 22px;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            var(--pink-strong),
            #8b5cf6
        );

    box-shadow:
        0 12px 30px
        rgba(255, 92, 168, 0.25);

    transition:
        transform 0.2s ease;
}

.primary-button:hover {
    transform: translateY(-2px);
}

.primary-button:disabled,
.icon-button:disabled,
.copy-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.toolbar {
    margin-top: 14px;
    min-height: 26px;
}

.switch-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    margin: 0;

    color: var(--muted);

    font-size: 0.9rem;

    cursor: pointer;
}

.switch-row input {
    display: none;
}

.switch {
    position: relative;

    width: 42px;
    height: 23px;

    border-radius: 999px;

    background:
        rgba(127, 102, 156, 0.22);

    transition: 0.25s ease;
}

.switch::after {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 17px;
    height: 17px;

    border-radius: 50%;

    background: white;

    transition: 0.25s ease;
}

.switch-row input:checked + .switch {
    background:
        linear-gradient(
            90deg,
            var(--pink-strong),
            var(--purple)
        );
}

.switch-row input:checked + .switch::after {
    transform: translateX(19px);
}

.message {
    margin: 0;

    color: var(--muted);

    font-size: 0.9rem;
    text-align: right;
}

.message.success {
    color: var(--green);
}

.message.error {
    color: var(--danger);
}

.message.loading {
    color: var(--blue);
}

.result-layout {
    display: grid;
    grid-template-columns:
        minmax(0, 1.55fr)
        minmax(280px, 0.75fr);

    gap: 20px;
    margin-top: 18px;

    opacity: 0;
    transform: translateY(18px);

    transition: 0.45s ease;
}

.result-layout.visible {
    opacity: 1;
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.latest-card,
.inbox-card,
.history-card {
    padding: 22px;
}

.icon-button {
    width: 44px;
    height: 44px;

    border-radius: 14px;

    color: var(--text);
    background: var(--surface);

    font-size: 1.2rem;
}

.sender-grid {
    display: grid;
    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    margin-top: 20px;
    padding: 15px;

    border: 1px solid var(--line);
    border-radius: 18px;

    background: var(--surface);
}

.sender-avatar,
.history-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;

    color: #2a173b;
    font-weight: 1000;

    background:
        linear-gradient(
            135deg,
            #ffc6e3,
            #a7e8ff
        );
}

.sender-avatar {
    width: 52px;
    height: 52px;

    border-radius: 18px;

    font-size: 1.25rem;
}

.sender-grid strong,
.sender-grid span {
    display: block;
}

.sender-grid span,
.sender-grid time {
    margin-top: 5px;

    color: var(--muted);

    font-size: 0.88rem;
}

.otp-card {
    margin-top: 18px;
    padding: 22px;

    border:
        1px solid
        rgba(255, 143, 199, 0.18);

    border-radius: 22px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 92, 168, 0.14),
            rgba(125, 211, 252, 0.09)
        ),
        var(--surface);
}

.otp-code {
    margin-top: 4px;

    font-size:
        clamp(
            2.5rem,
            7vw,
            4.7rem
        );

    font-weight: 1000;
    letter-spacing: 0.13em;

    text-shadow:
        0 0 28px
        rgba(255, 143, 199, 0.25);
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;

    padding: 13px 17px;

    border-radius: 14px;

    color: var(--text);
    background: var(--surface);
}

.inbox-card {
    align-self: start;
}

.info-list {
    display: grid;
    gap: 13px;

    margin-top: 22px;
}

.info-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    padding: 14px 0;

    border-bottom:
        1px solid var(--line);
}

.info-list span {
    color: var(--muted);
}

.online-text {
    color: var(--green);
}

.history-card {
    grid-column: 1 / -1;
}

.compact {
    margin-bottom: 15px;
}

.history-list {
    display: grid;
    gap: 12px;
}

.history-item {
    display: grid;
    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;
    gap: 15px;

    padding: 15px;

    border: 1px solid var(--line);
    border-radius: 17px;

    background: var(--surface);

    animation:
        historyIn 0.45s ease both;

    animation-delay: var(--delay);
}

.history-avatar {
    width: 44px;
    height: 44px;

    border-radius: 15px;
}

.history-main strong,
.history-main span,
.history-main small {
    display: block;
}

.history-main span,
.history-main small {
    margin-top: 4px;

    color: var(--muted);
}

.history-code {
    color: var(--green);

    font-size: 1.25rem;
    font-weight: 1000;
    letter-spacing: 0.08em;
}

.empty-state {
    display: grid;
    place-items: center;

    min-height: 180px;

    color: var(--muted);

    text-align: center;
}

.empty-state strong {
    margin-top: 8px;

    color: var(--text);
}

.empty-state span {
    margin-top: 6px;
}

.empty-icon {
    display: grid;
    place-items: center;

    width: 62px;
    height: 62px;

    border-radius: 20px;

    color: var(--pink);
    background: var(--surface);

    font-size: 1.6rem;
}

.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    z-index: 50;

    max-width: calc(100% - 32px);
    padding: 13px 17px;

    border: 1px solid var(--line);
    border-radius: 14px;

    color: var(--text);
    background: var(--glass-strong);

    box-shadow:
        0 18px 45px rgba(0, 0, 0, 0.25);

    opacity: 0;
    pointer-events: none;

    transform: translate(-50%, 20px);

    transition: 0.3s ease;
}

.toast.show {
    opacity: 1;

    transform: translate(-50%, 0);
}

.sky-effects {
    position: fixed;
    inset: 0;
    z-index: 1;

    overflow: hidden;

    pointer-events: none;
}

.star {
    position: absolute;

    width: 4px;
    height: 4px;

    border-radius: 50%;

    background: white;

    box-shadow:
        0 0 16px
        rgba(255, 255, 255, 0.9);

    animation:
        twinkle 3s ease-in-out infinite;
}

html[data-theme="light"] .star {
    background: #b48bca;

    box-shadow:
        0 0 12px
        rgba(176, 128, 199, 0.4);
}

.star-1 {
    top: 10%;
    left: 8%;
}

.star-2 {
    top: 20%;
    right: 12%;

    animation-delay: 0.7s;
}

.star-3 {
    top: 48%;
    left: 5%;

    animation-delay: 1.4s;
}

.star-4 {
    top: 72%;
    right: 7%;

    animation-delay: 0.2s;
}

.star-5 {
    bottom: 8%;
    left: 35%;

    animation-delay: 1s;
}

.petal {
    position: absolute;

    color:
        rgba(
            255,
            192,
            225,
            0.72
        );

    animation:
        floatPetal 10s linear infinite;
}

.petal-1 {
    top: -10%;
    left: 18%;
}

.petal-2 {
    top: -15%;
    left: 48%;

    animation-delay: 2.5s;
}

.petal-3 {
    top: -20%;
    left: 73%;

    animation-delay: 5s;
}

.petal-4 {
    top: -12%;
    left: 90%;

    animation-delay: 7s;
}

@keyframes twinkle {
    0%,
    100% {
        opacity: 0.35;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

@keyframes floatPetal {
    from {
        transform:
            translate3d(
                0,
                -10vh,
                0
            )
            rotate(0deg);
    }

    to {
        transform:
            translate3d(
                -90px,
                120vh,
                0
            )
            rotate(380deg);
    }
}

@keyframes historyIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .hero-card {
        grid-template-columns: 1fr 0.55fr;
    }

    .result-layout {
        grid-template-columns: 1fr;
    }

    .history-card {
        grid-column: auto;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: min(100% - 20px, 680px);
        padding-top: 12px;
    }

    .topbar {
        margin-bottom: 12px;
    }

    .brand span:last-child {
        font-size: 0.92rem;
    }

    .theme-toggle {
        padding: 8px 11px;
    }

    .theme-toggle span:last-child {
        display: none;
    }

    .hero-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .hero-copy {
        padding: 24px 20px;
        text-align: center;
    }

    .hero-copy h1 {
        font-size: clamp(2.15rem, 11vw, 3.1rem);
    }

    .hero-copy p {
        font-size: 0.92rem;
    }

    .hero-tags {
        justify-content: center;
        margin-top: 13px;
    }

    .mascot-panel {
        display: none;
    }

    .search-card {
        margin-top: 11px;
    }

    .search-row {
        grid-template-columns: 1fr;
    }

    .primary-button {
        min-height: 54px;
    }

    .toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .message {
        text-align: left;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 14px, 680px);
    }

    .hero-card,
    .search-card,
    .latest-card,
    .inbox-card,
    .history-card {
        border-radius: 20px;
    }

    .hero-copy {
        padding: 22px 17px;
    }

    .hero-copy h1 {
        margin-top: 9px;
        margin-bottom: 10px;
    }

    .hero-tags {
        gap: 6px;
    }

    .hero-tags span {
        padding: 7px 9px;
        font-size: 0.75rem;
    }

    .search-card,
    .latest-card,
    .inbox-card,
    .history-card {
        padding: 17px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .sender-grid {
        grid-template-columns: auto 1fr;
    }

    .sender-grid time {
        grid-column: 1 / -1;
    }

    .otp-card {
        align-items: stretch;
        flex-direction: column;
    }

    .otp-code {
        font-size: clamp(2.2rem, 13vw, 3.4rem);
        letter-spacing: 0.09em;
    }

    .copy-button {
        justify-content: center;
        width: 100%;
    }

    .history-item {
        grid-template-columns: auto 1fr;
    }

    .history-code {
        grid-column: 1 / -1;
        padding-left: 59px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
