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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #0a0a0f 100%);
    background-size: 400% 400%;
    animation: gradientFlow 20s ease infinite;
    min-height: 100vh;
    color: #212121;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow: hidden;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 100% 50%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

#starlinkCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.logo {
    position: fixed;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
    cursor: pointer;
}

.logo-text {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #60a5fa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoShimmer 3s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.3));
}

@keyframes logoShimmer {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 200% center;
    }
}

@keyframes bgShift {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(2%, -2%) rotate(1deg);
    }
    66% {
        transform: translate(-1%, 1%) rotate(-1deg);
    }
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 220px 24px 80px;
    position: relative;
    z-index: 1;
}

.top-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    gap: 12px;
    z-index: 100;
}

.free-id-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    letter-spacing: 1px;
}

.free-id-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 0 0 40px rgba(255, 255, 255, 0.05);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.free-id-btn svg {
    transition: all 0.25s ease;
}

.free-id-btn:hover svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 0 0 40px rgba(255, 255, 255, 0.05);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.nav-btn svg {
    transition: all 0.25s ease;
}

.nav-btn:hover svg {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.lang-dropdown {
    position: relative;
}

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.lang-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    padding: 10px 14px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.lang-option.active {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.header {
    margin-bottom: 64px;
    text-align: center;
}

.header h1 {
    font-size: 48px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.48px;
    color: #ffffff;
    text-shadow: 0 0 30px rgba(120, 119, 198, 0.5), 0 0 60px rgba(59, 130, 246, 0.3);
}

.header p {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.4;
    color: #616161;
    margin-top: 16px;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.form-group {
    margin-bottom: 0;
}

.form-group input {
    width: 100%;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.btn {
    padding: 19px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.98);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: none;
    font-size: 14px;
    line-height: 1.4;
}

.alert-success {
    background: #edfce9;
    color: #003c33;
    border: 1px solid #d9d9dd;
}

.alert-error {
    background: #fff5f3;
    color: #b30000;
    border: 1px solid #ffad9b;
}

#resultGroup {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#resultGroup label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.result-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.result-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    letter-spacing: 0.28px;
}

.result-input:focus {
    outline: none;
}

.copy-btn {
    padding: 12px 20px;
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.copy-btn:active {
    transform: scale(0.98);
}

/* ===== Responsive Design ===== */

/* Tablet */
@media (max-width: 768px) {
    .container {
        padding: 180px 20px 60px;
    }

    .header {
        margin-bottom: 48px;
    }

    .header h1 {
        font-size: 36px;
    }

    .card {
        padding: 32px 24px;
    }

    .logo {
        top: 16px;
        left: 16px;
    }

    .logo svg {
        width: 28px;
        height: 28px;
    }

    .logo-text {
        font-size: 20px;
        letter-spacing: 2px;
    }

    .top-nav {
        top: 16px;
        right: 16px;
    }

    .free-id-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container {
        padding: 140px 16px 40px;
    }

    .header {
        margin-bottom: 36px;
    }

    .header h1 {
        font-size: 28px;
        letter-spacing: -0.28px;
    }

    .card {
        padding: 24px 16px;
        border-radius: 10px;
    }

    .form-group {
        flex-direction: column;
        gap: 12px !important;
    }

    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .btn {
        width: 100% !important;
        padding: 16px 24px;
        text-align: center;
    }

    .result-row {
        flex-direction: column;
        gap: 10px;
    }

    .result-input {
        width: 100%;
        padding: 12px 14px;
    }

    .copy-btn {
        width: 100%;
        padding: 14px 20px;
        text-align: center;
    }

    .logo {
        top: 12px;
        left: 12px;
    }

    .logo svg {
        width: 24px;
        height: 24px;
    }

    .logo-text {
        font-size: 18px;
        letter-spacing: 1.5px;
    }

    .top-nav {
        top: 12px;
        right: 12px;
        gap: 8px;
    }

    .free-id-btn {
        padding: 6px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .free-id-btn span {
        display: none;
    }

    .free-id-btn svg {
        width: 18px;
        height: 18px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn svg {
        width: 18px;
        height: 18px;
    }

    .lang-menu {
        right: -10px;
        min-width: 140px;
    }

    .lang-option {
        padding: 8px 12px;
        font-size: 12px;
    }

    #resultGroup {
        margin-top: 20px;
        padding-top: 20px;
    }
}

/* Small mobile */
@media (max-width: 360px) {
    .header h1 {
        font-size: 24px;
    }

    .card {
        padding: 20px 12px;
    }

    .logo-text {
        font-size: 16px;
    }
}

/* ===== History Card ===== */
.history-card {
    display: none;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.history-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 10px;
    border-radius: 12px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.history-item:last-child {
    margin-bottom: 0;
}

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

.history-short-link {
    font-size: 14px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    color: #60a5fa;
    cursor: pointer;
    text-decoration: none;
    word-break: break-all;
}

.history-short-link:hover {
    text-decoration: underline;
}

.history-original-url {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: 12px;
}

.history-clicks {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.history-copy-btn {
    padding: 6px 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.history-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* History list scrollbar */
.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* History mobile */
@media (max-width: 480px) {
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-meta {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .history-card {
        margin-top: 16px !important;
    }
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.2s ease-out;
    position: relative;
}

.modal-large {
    max-width: 560px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
}

.free-id-display {
    text-align: center;
    margin-bottom: 24px;
}

.free-id-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.free-id-value {
    font-size: 28px;
    font-weight: 700;
    color: #60a5fa;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.free-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: center;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-danger:active {
    transform: scale(0.98);
}

/* Modal links section */
.modal-links-section {
    margin-top: 16px;
}

.modal-links-list {
    max-height: 320px;
    overflow-y: auto;
}

.modal-links-list .history-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-links-list .history-item:last-child {
    margin-bottom: 0;
}

.modal-links-list .history-link-info {
    flex: 1;
    min-width: 0;
}

.modal-links-list .history-short-link {
    font-size: 14px;
    font-weight: 500;
    color: #818cf8;
    text-decoration: none;
    word-break: break-all;
}

.modal-links-list .history-short-link:hover {
    text-decoration: underline;
}

.modal-links-list .history-original-url {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-links-list .history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.modal-links-list .history-clicks {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    margin-right: 12px;
}

.modal-links-list .history-copy-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-links-list .history-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.modal-links-list .history-delete-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-links-list .history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.modal-links-list::-webkit-scrollbar {
    width: 4px;
}

.modal-links-list::-webkit-scrollbar-track {
    background: transparent;
}

.modal-links-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* Pagination */
.modal-pagination {
    margin-top: 36px;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
}

.page-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
}

.page-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.page-btn.disabled {
    opacity: 0.15;
    cursor: not-allowed;
}

