* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    color-scheme: dark;
    --bg: #0b0b0e;
    --container-bg: rgba(17, 17, 21, 0.86);
    --surface: #18181d;
    --surface-hover: #212128;
    --surface-active: #272730;
    --surface-subtle: #141418;
    --border-card: rgba(255, 255, 255, 0.10);
    --border-control: #6e6e78;
    --border-hover: #9a9aa6;
    --divider: rgba(255, 255, 255, 0.10);
    --shadow-border: 0 0 0 1px oklch(1 0 0 / 0.08);
    --shadow-border-hover: 0 0 0 1px oklch(1 0 0 / 0.16);
    --shadow-featured: 0 0 0 1px rgba(234, 108, 30, 0.45);
    --shadow-featured-hover: 0 0 0 1px rgba(234, 108, 30, 0.82);
    --image-outline: oklch(1 0 0 / 0.1);
    --text: #f4f4f6;
    --muted: #b8b8c2;
    --subtle: #9696a0;
    --accent: #ea6c1e;
    --accent-hover: #f5823b;
    --accent-text: #0b0b0e;
    --accent-soft: rgba(234, 108, 30, 0.12);
    --accent-surface: rgba(234, 108, 30, 0.055);
    --accent-border: rgba(234, 108, 30, 0.45);
    --surface-sheen: rgba(255, 255, 255, 0.055);
    --featured-sheen: rgba(234, 108, 30, 0.13);
    --status-offline: #767680;
    --dialog-bg: #15151a;
    --backdrop-bg: rgba(0, 0, 0, 0.72);
    --shadow-elevated: 0 24px 64px rgba(0, 0, 0, 0.55);
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #e8e6e0;
    --container-bg: rgba(244, 242, 236, 0.88);
    --surface: #f8f7f3;
    --surface-hover: #ebe8e0;
    --surface-active: #e0dcd2;
    --surface-subtle: #eeebe4;
    --border-card: rgba(24, 24, 27, 0.12);
    --border-control: #7a7a84;
    --border-hover: #52525b;
    --divider: rgba(24, 24, 27, 0.11);
    --shadow-border:
        0 0 0 1px oklch(0 0 0 / 0.07),
        0 1px 2px -1px oklch(0 0 0 / 0.06),
        0 2px 4px 0 oklch(0 0 0 / 0.04);
    --shadow-border-hover:
        0 0 0 1px oklch(0 0 0 / 0.12),
        0 2px 4px -1px oklch(0 0 0 / 0.08),
        0 4px 8px 0 oklch(0 0 0 / 0.05);
    --shadow-featured:
        0 0 0 1px rgba(184, 67, 20, 0.36),
        0 1px 2px -1px rgba(184, 67, 20, 0.10),
        0 2px 4px 0 oklch(0 0 0 / 0.04);
    --shadow-featured-hover:
        0 0 0 1px rgba(184, 67, 20, 0.68),
        0 2px 4px -1px rgba(184, 67, 20, 0.14),
        0 4px 8px 0 oklch(0 0 0 / 0.06);
    --image-outline: oklch(0 0 0 / 0.1);
    --text: #18181b;
    --muted: #47474f;
    --subtle: #5c5c66;
    --accent: #b84314;
    --accent-hover: #9a360e;
    --accent-text: #f8f7f3;
    --accent-soft: rgba(184, 67, 20, 0.09);
    --accent-surface: rgba(184, 67, 20, 0.045);
    --accent-border: rgba(184, 67, 20, 0.36);
    --surface-sheen: rgba(24, 24, 27, 0.045);
    --featured-sheen: rgba(184, 67, 20, 0.10);
    --status-offline: #6e6e77;
    --dialog-bg: #f8f7f3;
    --backdrop-bg: rgba(24, 24, 27, 0.48);
    --shadow-elevated: 0 20px 50px rgba(24, 24, 27, 0.10);
}

a[href],
button:not(:disabled),
label[for],
[role="button"]:not([aria-disabled="true"]) {
    cursor: pointer;
}

button:disabled,
input:disabled,
[aria-disabled="true"] {
    cursor: not-allowed;
}

html, body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    min-height: 100dvh;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 472px;
    margin: auto;
    padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
    flex-direction: column;
}

@media (min-width: 768px) {
    .container {
        margin: auto;
        padding: 30px 28px;
        border: 1px solid transparent;
        border-radius: 24px;
        background: var(--container-bg);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: var(--shadow-border), var(--shadow-elevated);
    }
}

.skeleton-wrapper {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: inherit;
    border-radius: inherit;
    background: var(--bg);
    transition: opacity 250ms ease-out, visibility 250ms ease-out;
}

@media (min-width: 768px) {
    .skeleton-wrapper {
        background: var(--container-bg);
    }
}

.skeleton-wrapper.loaded {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.skeleton-meta {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.skeleton-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .skeleton-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.shimmer {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid transparent;
    box-shadow: var(--shadow-border);
}

.shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(128, 128, 128, 0.14), transparent);
    animation: shimmerSweep 1.6s ease-in-out infinite;
}

.skeleton-wrapper.loaded .shimmer::after {
    animation: none;
}

@keyframes shimmerSweep {
    100% {
        transform: translateX(100%);
    }
}

.sk-avatar {
    width: 60px;
    height: 60px;
    border-radius: 16px;
}

.sk-name {
    width: 110px;
    height: 20px;
    border-radius: 6px;
}

.sk-handle {
    width: 84px;
    height: 13px;
    border-radius: 5px;
}

.sk-presence {
    width: 100%;
    height: 60px;
    margin-bottom: 18px;
    border-radius: 16px;
}

.sk-featured {
    width: 100%;
    height: 66px;
    margin-bottom: 16px;
    border-radius: 16px;
}

.sk-card {
    width: 100%;
    height: 52px;
    border-radius: 12px;
}

@media (min-width: 640px) {
    .sk-card {
        height: 66px;
    }
}

@keyframes fadeInOnly {
    from {
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(4px);
    }
}

body.web-ready .fade-in {
    animation: fadeInOnly 300ms ease-out both;
}

@media (prefers-reduced-motion: no-preference) {
    body.web-ready .fade-in {
        animation-name: fadeInUp;
    }
}

.delay-1 {
    animation-delay: 0ms;
}

.delay-2 {
    animation-delay: 100ms;
}

.delay-3 {
    animation-delay: 200ms;
}

.delay-4 {
    animation-delay: 320ms;
}

body.web-ready .link-card {
    animation: fadeInOnly 300ms ease-out both;
    animation-delay: calc(180ms + var(--stagger, 1) * 50ms);
}

@media (prefers-reduced-motion: no-preference) {
    body.web-ready .link-card {
        animation-name: fadeInUp;
    }
}

.profile {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.profile-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
    border-radius: 16px;
    background: var(--surface);
    object-fit: cover;
    outline: 1px solid var(--image-outline);
    outline-offset: -1px;
    transition: transform 200ms cubic-bezier(0.2, 0, 0, 1);
}

.profile-identity {
    min-width: 0;
    flex: 1;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

h1 {
    color: var(--text);
    font-size: clamp(1.25rem, 4vw, 1.42rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.greeting-tag {
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow-border);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
}

.username {
    color: var(--subtle);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
}

.profile-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.local-clock {
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-border);
    color: var(--subtle);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.theme-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow-border);
    color: var(--text);
    font-size: 0.92rem;
    transition-property: background-color, box-shadow, scale;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

.theme-toggle:not(:disabled):active {
    background: var(--surface-active);
    scale: 0.96;
}

.theme-icon-stack {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
}

.theme-icon-layer {
    grid-area: 1 / 1;
    opacity: 0;
    scale: 0.25;
    filter: blur(4px);
    transition-property: opacity, scale, filter;
    transition-duration: 300ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.theme-toggle[data-theme-icon="system"] [data-icon-mode="system"],
.theme-toggle[data-theme-icon="light"] [data-icon-mode="light"],
.theme-toggle[data-theme-icon="dark"] [data-icon-mode="dark"] {
    opacity: 1;
    scale: 1;
    filter: blur(0px);
}

.utility-section {
    width: 100%;
    margin-bottom: 16px;
}

.featured-tool-card {
    position: relative;
    overflow: hidden;
    display: flex;
    width: 100%;
    min-height: 66px;
    align-items: center;
    gap: 13px;
    padding: 10px 14px 10px 10px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--accent-surface), transparent), var(--surface);
    box-shadow: var(--shadow-featured);
    color: var(--text);
    font-family: inherit;
    text-align: left;
    transition-property: background-color, box-shadow, translate, scale;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

.featured-tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(
        180px circle at var(--mx, 50%) var(--my, 50%),
        var(--featured-sheen),
        transparent 72%
    );
    transition: opacity 180ms ease-out;
}

.featured-tool-card.is-hovering::before {
    opacity: 1;
}

.featured-tool-card > * {
    position: relative;
    z-index: 1;
}

.featured-tool-card:not(:disabled):active {
    background: var(--surface-active);
    scale: 0.96;
}

.featured-tool-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.95rem;
    transition-property: background-color, color, scale;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.featured-tool-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.featured-tool-title {
    color: var(--text);
    font-size: 0.93rem;
    font-weight: 700;
    line-height: 1.25;
}

.featured-tool-desc {
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.featured-tool-cta {
    flex: 0 0 auto;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.76rem;
    font-weight: 700;
    transition-property: background-color, translate;
    transition-duration: 160ms;
    transition-timing-function: ease-out;
}

.links-container {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
    gap: 10px;
}

.link-card {
    position: relative;
    overflow: hidden;
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-border);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    appearance: none;
    transition-property: background-color, box-shadow, translate, scale;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

.link-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(
        160px circle at var(--mx, 50%) var(--my, 50%),
        var(--surface-sheen),
        transparent 72%
    );
    transition: opacity 180ms ease-out;
}

.link-card.is-hovering::before {
    opacity: 1;
}

.link-card > * {
    position: relative;
    z-index: 1;
}

.link-left {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.link-left > i {
    width: 18px;
    flex: 0 0 18px;
    color: var(--muted);
    font-size: 1.02rem;
    text-align: center;
    transition-property: color, translate, scale;
    transition-duration: 180ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.link-handle {
    color: var(--subtle);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    transition-property: color, translate;
    transition-duration: 180ms;
    transition-timing-function: ease-out;
}

@media (min-width: 640px) {
    .links-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .link-card {
        min-height: 66px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 4px;
        padding: 12px 14px;
    }

    .link-handle {
        padding-left: 29px;
    }
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--divider);
    color: var(--subtle);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
    .avatar:hover {
        transform: scale(1.04);
    }

    .theme-toggle:hover {
        background: var(--surface-hover);
        box-shadow: var(--shadow-border-hover);
    }

    .featured-tool-card:hover {
        background: linear-gradient(180deg, var(--accent-surface), transparent), var(--surface-hover);
        box-shadow: var(--shadow-featured-hover);
        translate: 0 -1px;
    }

    .featured-tool-card:hover .featured-tool-icon {
        background: var(--accent);
        color: var(--accent-text);
        scale: 1.05;
    }

    .featured-tool-card:hover .featured-tool-cta {
        background: var(--accent-hover);
        translate: 2px 0;
    }
}
