/* 01. Biến màu và giao diện */

:root {
    --ink: #f3f5ff;
    --muted: #aebad0;
    --surface: rgba(20,29,48,.45);
    --edge: rgba(230,240,255,.19);
    --inset: rgba(255,255,255,.13);
    --chip: rgba(255,255,255,.07);
    --shadow: rgba(0,0,0,.28);
    --bg: #0b1124;
    --a: #84e8d3;
    --b: #b9b9ff;
    --line: rgba(255,255,255,.1);
    --input: #101a30;
    --halo: rgba(160,196,255,.17);
}

html[data-theme=light] {
    --ink: #17233a;
    --muted: #52617b;
    --surface: rgba(255,255,255,.49);
    --edge: rgba(255,255,255,.85);
    --inset: rgba(255,255,255,.85);
    --chip: rgba(255,255,255,.36);
    --shadow: rgba(35,61,112,.16);
    --bg: #dce9fa;
    --a: #087e79;
    --b: #5952bb;
    --line: rgba(40,64,100,.12);
    --input: #f4f8ff;
    --halo: rgba(255,255,255,.8);
}

/* 02. Thiết lập cơ bản */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
    font-size: 15px;
    line-height: 1.55;
    overflow-x: hidden;
    transition: color .3s,background .3s;
}

button,input,textarea {
    font: inherit;
}

button,a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
    cursor: pointer;
}

button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible {
    outline: 2px solid var(--a);
    outline-offset: 4px;
}

a {
    color: inherit;
    text-decoration: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

svg {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 03. Nền động */

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(ellipse at 45% -20%,#26376e55,transparent 60%),radial-gradient(ellipse at 90% 100%,#6e399b40,transparent 55%);
}

.orb {
    position: absolute;
    filter: blur(74px);
    border-radius: 50%;
    opacity: .58;
    animation: float 18s ease-in-out infinite alternate;
}

.orb.one {
    width: 48vw;
    height: 42vw;
    background: #2258bf;
    left: -12%;
    top: -16%;
}

.orb.two {
    width: 34vw;
    height: 38vw;
    background: #744bc7;
    right: -10%;
    top: 10%;
    animation-delay: -6s;
}

.orb.three {
    width: 42vw;
    height: 35vw;
    background: #147f83;
    left: 19%;
    bottom: -22%;
    animation-delay: -10s;
}

html[data-theme=light] .orb {
    opacity: .38;
    filter: blur(85px);
}

.grain {
    position: absolute;
    inset: 0;
    opacity: .16;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.91' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.22' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}

@keyframes float {
    to {
        transform: translate(9%,13%) scale(1.12);
    }
}

/* 04. Khung trang và thanh điều hướng */

.shell {
    width: min(1080px,calc(100% - 48px));
    margin: auto;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 27px 0;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.brand-icon {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    border-radius: 12px;
    background: linear-gradient(135deg,#a8eee9,#9a9bf4);
    color: #182841;
    box-shadow: 0 3px 20px #92dbea33;
}

.brand-icon svg {
    width: 18px;
    height: 18px;
}

.nav-actions {
    display: flex;
    gap: 9px;
    align-items: center;
}

/* 05. Hiệu ứng Liquid Glass */

.glass {
    position: relative;
    isolation: isolate;
    border: 1px solid var(--edge);
    background: linear-gradient(145deg,var(--inset),transparent 40%),var(--surface);
    backdrop-filter: blur(28px) saturate(155%);
    -webkit-backdrop-filter: blur(28px) saturate(155%);
    box-shadow: 0 18px 65px var(--shadow),inset 0 1px 1px var(--inset),inset 0 -1px 1px var(--inset);
    overflow: hidden;
}

.glass:before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: radial-gradient(360px circle at var(--px,50%) var(--py,0%),var(--halo),transparent 75%);
    opacity: 0;
    transition: opacity .3s;
}

.glass:hover:before {
    opacity: 1;
}

/* 06. Nút bấm */

.pill {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--edge);
    border-radius: 100px;
    background: var(--chip);
    padding: 11px 17px;
    transition: transform .2s,background .2s;
    box-shadow: inset 0 1px 0 var(--inset);
}

.pill:hover {
    transform: translateY(-2px);
    background: var(--inset);
}

.icon-btn {
    width: 45px;
    height: 45px;
    padding: 0;
}

.theme-light,.theme-dark {
    display: none;
}

html[data-theme=dark] .theme-dark,html[data-theme=light] .theme-light {
    display: block;
}

/* 07. Giới thiệu và avatar */

.hero {
    min-height: 400px;
    border-radius: 34px;
    padding: 48px 54px;
    display: grid;
    grid-template-columns: 1.5fr .9fr;
    align-items: center;
    gap: 26px;
}

.hero-copy {
    z-index: 1;
}

.eyebrow {
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--a);
    display: flex;
    align-items: center;
    gap: 9px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--a);
    box-shadow: 0 0 15px var(--a);
}

.hero h1 {
    font-size: clamp(42px,6.4vw,76px);
    line-height: 1.02;
    letter-spacing: -.065em;
    margin: 17px 0 8px;
    overflow-wrap: anywhere;
}

.hero .handle {
    font-size: 16px;
    color: var(--muted);
    letter-spacing: .02em;
    overflow-wrap: anywhere;
}

.hero .intro {
    font-size: 17px;
    max-width: 500px;
    margin: 21px 0 27px;
    color: var(--muted);
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.primary {
    background: linear-gradient(135deg,#a8efe2,#aeb8ff);
    border-color: transparent;
    color: #172a43;
    font-weight: 700;
    box-shadow: 0 5px 24px #8dc4ff26;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.avatar-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 270px;
}

.avatar-zone:before,.avatar-zone:after {
    content: "";
    position: absolute;
    border: 1px solid var(--edge);
    width: 242px;
    height: 242px;
    border-radius: 50%;
    transform: rotate(-24deg) scaleX(1.22);
    pointer-events: none;
}

.avatar-zone:after {
    width: 278px;
    height: 278px;
    transform: rotate(28deg) scaleY(.82);
    opacity: .55;
}

.avatar-frame {
    z-index: 1;
    width: 218px;
    height: 218px;
    border: 1px solid #ffffff80;
    padding: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg,#ffffff55,#ffffff0a);
    box-shadow: 0 20px 55px var(--shadow),0 0 50px #96bbff25,inset 0 2px 1px #ffffff50;
    position: relative;
}

.avatar-frame img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-label {
    position: absolute;
    z-index: 2;
    bottom: 0;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    background: var(--input);
    border: 1px solid var(--edge);
    padding: 7px 12px;
    border-radius: 100px;
    box-shadow: 0 5px 18px var(--shadow);
}

.spark {
    position: absolute;
    z-index: 2;
    width: 9px;
    height: 9px;
    background: #d9e8ff;
    border-radius: 50%;
    box-shadow: 0 0 18px #d9e8ff;
    top: 17px;
    right: 35px;
}

.spark.small {
    width: 5px;
    height: 5px;
    top: auto;
    bottom: 40px;
    left: 28px;
    opacity: .7;
}

/* 08. Các khối nội dung */

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 34px 2px 14px;
    gap: 12px;
}

.section-title h2 {
    font-size: 19px;
    letter-spacing: -.025em;
    margin: 0;
}

.section-title span {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .12em;
    text-transform: uppercase;
}

.bento {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
}

.panel {
    border-radius: 25px;
    padding: 26px 28px;
    min-height: 180px;
}

.panel-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.tile-icon {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border-radius: 13px;
    background: var(--chip);
    border: 1px solid var(--edge);
    color: var(--b);
}

.panel h3 {
    font-size: 16px;
    letter-spacing: -.01em;
    margin: 0;
}

.panel p {
    margin: 0;
    color: var(--muted);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.tag {
    border: 1px solid var(--edge);
    background: var(--chip);
    border-radius: 9px;
    padding: 6px 11px;
    font-size: 12px;
    overflow-wrap: anywhere;
    max-width: 100%;
}

/* 09. Mạng xã hội */

.socials {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 12px;
}

.social {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 17px;
    border-radius: 20px;
    min-width: 0;
    transition: transform .2s;
}

.social[href]:hover {
    transform: translateY(-3px);
}

.social .tile-icon {
    width: 40px;
    height: 40px;
    color: var(--ink);
}

.social-info {
    min-width: 0;
    flex: 1;
}

.social-info strong {
    display: block;
    font-size: 14px;
}

.social-info small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.social .arrow {
    width: 15px;
    color: var(--muted);
}

.social[aria-disabled=true] {
    opacity: .62;
}

/* 10. Chân trang */

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 31px 3px 25px;
    color: var(--muted);
    font-size: 12px;
}

.footer span:first-child {
    letter-spacing: .03em;
}

.footer button {
    border: 0;
    background: none;
    padding: 6px;
    color: var(--muted);
}

/* 11. Hộp chỉnh sửa hồ sơ */

.dialog {
    border: 1px solid var(--edge);
    background: var(--input);
    color: var(--ink);
    padding: 26px;
    border-radius: 26px;
    width: min(560px,calc(100% - 30px));
    max-height: 90dvh;
    box-shadow: 0 30px 90px #0006;
}

.dialog::backdrop {
    background: #05091890;
    backdrop-filter: blur(9px);
}

.dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.dialog h2 {
    font-size: 23px;
    letter-spacing: -.04em;
    margin: 0;
}

.dialog .fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12px;
    color: var(--muted);
}

.field.full {
    grid-column: 1/-1;
}

.field input,.field textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 11px;
    border: 1px solid var(--edge);
    background: var(--chip);
    color: var(--ink);
    resize: vertical;
}

.field textarea {
    min-height: 74px;
}

.dialog .hint {
    font-size: 12px;
    color: var(--muted);
    margin: 10px 0 18px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}

.toast {
    position: fixed;
    z-index: 5;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%,20px);
    opacity: 0;
    pointer-events: none;
    background: var(--input);
    border: 1px solid var(--edge);
    padding: 12px 19px;
    border-radius: 100px;
    box-shadow: 0 8px 30px var(--shadow);
    transition: .25s;
    max-width: 90%;
    text-align: center;
    font-size: 13px;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%,0);
}

/* Điều chỉnh giao diện theo thiết bị */

@media (max-width:760px) {
    .shell {
        width: calc(100% - 30px);
    }

    .nav {
        padding: 18px 0;
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0;
        padding: 30px 23px 35px;
        min-height: 0;
        border-radius: 28px;
    }

    .avatar-zone {
        grid-row: 1;
        min-height: 228px;
        margin-bottom: 19px;
    }

    .avatar-frame {
        width: 177px;
        height: 177px;
    }

    .avatar-zone:before {
        width: 195px;
        height: 195px;
    }

    .avatar-zone:after {
        width: 229px;
        height: 229px;
    }

    .spark {
        right: calc(50% - 100px);
    }

    .spark.small {
        left: calc(50% - 100px);
    }

    .eyebrow,.hero-actions {
        justify-content: center;
    }

    .hero h1 {
        font-size: clamp(42px,10vw,64px);
    }

    .hero .intro {
        margin: 18px auto 24px;
        font-size: 15px;
    }

    .bento {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .panel {
        padding: 22px;
        min-height: 0;
    }

    .socials {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .section-title {
        margin-top: 27px;
    }

    .nav .edit-text {
        display: none;
    }

    .nav .edit {
        width: 45px;
        padding: 0;
    }

    .orb {
        min-width: 250px;
        min-height: 250px;
    }

    .footer {
        font-size: 11px;
    }

    .dialog .fields {
        grid-template-columns: 1fr;
    }

    .dialog {
        padding: 20px;
    }
}

/* Điều chỉnh giao diện theo thiết bị */

@media (prefers-reduced-motion:reduce) {
    *,*:before,*:after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* 12. Các lớp tiện ích (thay cho CSS viết trực tiếp trong HTML) */

.svg-library {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.brand-suffix {
    color: var(--muted);
    font-weight: 400;
}

.accent-text {
    color: var(--a);
}

.small-icon {
    width: 16px;
    height: 16px;
}

.small-dot {
    width: 6px;
    height: 6px;
}

.reset-avatar-button {
    padding: 4px 10px;
    font-size: 11px;
}

