* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #000;
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.nav-logo {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

.nav-ton {
    color: #1e88e5;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #fff;
}

#ton-connect-button {
    display: flex;
    align-items: center;
}

/* Pages */
.page {
    display: none;
    padding-top: 60px;
    min-height: 100vh;
}

.page.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    padding-top: 100px;
}

/* Search Page */
.search-content {
    width: 100%;
    max-width: 560px;
    text-align: center;
}

.hero {
    margin-top: 30px;
    margin-bottom: 48px;
    position: relative;
    overflow: visible;
}

.hero h1 {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-glow {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(30, 136, 229, 0.5) 0%, rgba(30, 136, 229, 0.2) 30%, transparent 60%);
    border-radius: 50%;
    filter: blur(50px);
    z-index: 0;
    animation: pulse-glow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.hero-animation {
    width: 280px;
    height: 280px;
    margin: 0 auto -140px;
    position: relative;
    z-index: 1;
    transform: translateY(-30px);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 50%, rgba(0,0,0,0) 50%, rgba(0,0,0,1) 60%, rgba(0,0,0,1) 100%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 50%, rgba(0,0,0,0) 50%, rgba(0,0,0,1) 60%, rgba(0,0,0,1) 100%);
}

.hero h2 {
    font-size: 72px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    position: relative;
    z-index: 1;
}

.hero h2 span {
    font-size: 64px;
    font-weight: 700;
    background: linear-gradient(135deg, #1e88e5 0%, #64b5f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* Search Box */
.search-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.06) 100%);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 16px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 4px 8px;
    transition: all 0.2s;
}

.search-wrapper:focus-within {
    border-color: #1e88e5;
}

.search-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 18px;
    font-size: 17px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    outline: none;
    min-width: 0;
    color: #fff;
}

.search-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.domain-suffix {
    padding: 14px 18px;
    font-size: 17px;
    font-weight: 600;
    color: #1e88e5;
    white-space: nowrap;
}

.error-msg {
    color: #ef5350;
    font-size: 13px;
    margin-top: 6px;
    min-height: 18px;
    text-align: left;
    padding-left: 4px;
}

.btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    margin-top: 8px;
    background: #1e88e5;
    color: white;
}

.btn:hover {
    background: #1976d2;
    transform: translateY(-2px);
}

.btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    transform: none;
}

.btn-group {
    display: flex;
    gap: 12px;
}

.btn-group .btn {
    flex: 1;
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-secondary:disabled {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
}

.info-footer p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.5;
}

/* Register Page */
#page-register.active {
    align-items: flex-start;
    padding: 12px 8px;
    padding-top: 85px;
}

.register-content {
    width: 100%;
    max-width: 850px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
    align-items: center;
}

.nft-section {
    display: flex;
    justify-content: center;
}

.nft-card {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(30, 136, 229, 0.3);
}

.nft-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.domain-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.domain-name {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    word-break: break-all;
}

.dns-label {
    color: #fff;
    margin-right: 4px;
}

.domain-ton {
    color: #1e88e5;
}

.rarity-badge {
    display: inline-flex;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    width: fit-content;
}

.rarity-legendary { background: linear-gradient(135deg, #FFD700, #FFA500); color: #1a1a1a; }
.rarity-epic { background: linear-gradient(135deg, #9C27B0, #E040FB); color: white; }
.rarity-rare { background: linear-gradient(135deg, #2196F3, #00BCD4); color: white; }
.rarity-common { background: linear-gradient(135deg, #4CAF50, #8BC34A); color: white; }

.details-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-row:first-child { padding-top: 0; }

.detail-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.detail-value {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.price-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e88e5;
}

.price-value span {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-section .btn {
    border-radius: 12px;
    margin-top: 0;
}

.connect-hint {
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.back-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #1e88e5;
}

.btn-success { background: #2e7d32; }
.btn-success:hover { background: #388e3c; }
.btn-error { background: #c62828; }
.btn-error:hover { background: #d32f2f; }
.btn-manage { background: linear-gradient(135deg, #7c4dff, #536dfe); }
.btn-manage:hover { background: linear-gradient(135deg, #651fff, #304ffe); }
.btn-disabled { background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.3); }
.btn-small { width: auto; padding: 10px 20px; font-size: 13px; margin-top: 10px; }

.rarity-owned { background: linear-gradient(135deg, #7c4dff, #536dfe); color: white; }

/* Manage Page */
#page-manage.active {
    align-items: center;
    padding: 12px 8px;
    padding-top: 70px;
}

.manage-content {
    width: 100%;
    max-width: 800px;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
    align-items: start;
}

.manage-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
}

.manage-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
}

.manage-info {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 14px;
}

.manage-field {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.manage-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.manage-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.field-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 6px;
}

.manage-field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 13px;
    font-family: 'Inter', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.manage-field input[type="text"]:focus {
    border-color: #1e88e5;
}

.manage-field input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #1e88e5;
    cursor: pointer;
}

.checkbox-label span {
    font-weight: 500;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    text-align: center;
    background: linear-gradient(transparent, #000);
    z-index: 50;
}

footer a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #555;
    text-decoration: none;
    font-size: 0.75rem;
}

footer img {
    height: 16px;
    opacity: 0.5;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* Mobile */
@media (max-width: 768px) {
    nav { padding: 0 16px; height: 56px; }
    .page { padding-top: 56px; }
    .page.active { padding: 16px; padding-top: 80px; }

    .hero { margin-bottom: 32px; }
    .hero-glow { width: 300px; height: 300px; }
    .hero-animation { width: 200px; height: 200px; margin-bottom: -100px; }
    .hero h2 { font-size: 42px; }
    .hero h2 span { font-size: 38px; }
    .hero p { font-size: 14px; }

    .search-box { padding: 20px; border-radius: 18px; }
    .search-wrapper input { padding: 12px 14px; font-size: 15px; }
    .domain-suffix { padding: 12px 14px; font-size: 15px; }
    .btn { padding: 12px 20px; font-size: 14px; }

    .register-content {
        grid-template-columns: 1fr;
        gap: 32px;
        max-width: 380px;
    }
    .nft-card { max-width: 260px; }
    .domain-name { font-size: 26px; text-align: center; }
    .domain-header { align-items: center; }
    .back-link { text-align: center; display: block; }

    .manage-content {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 100%;
    }

    #page-manage.active {
        padding: 8px 4px;
        padding-top: 64px;
    }
}

@media (max-width: 480px) {
    .hero h2 { font-size: 32px; }
    .hero h2 span { font-size: 28px; }
    .nft-card { max-width: 220px; }
    .domain-name { font-size: 22px; }
}
