* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: #e9eef8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #0b0320;
    overflow: hidden;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    background: radial-gradient(1200px 800px at 10% 20%, rgba(255, 80, 160, 0.16), transparent 10%),
                radial-gradient(800px 600px at 90% 80%, rgba(90, 120, 255, 0.12), transparent 10%),
                linear-gradient(180deg, #0b0320 0%, #140425 45%, #23103b 100%);
    filter: saturate(1.2);
    transform-origin: center center;
    animation: bgZoom 8s ease-out infinite alternate;
}

.bg::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0.06;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 24px;
}

.bg::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    background-image: url('background.jpg');
    transition: opacity 0.4s, transform 0.6s;
    transform-origin: center;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(11, 3, 32, 0.35), rgba(11, 3, 32, 0.6));
    backdrop-filter: blur(8px) saturate(1.05);
}

.app {
    position: relative;
    z-index: 2;
    height: 100vh;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.left-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clock {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 30px rgba(9, 6, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    text-align: center;
}

.time-container {
    display: flex;
    align-items: baseline;
}

#time {
    font-size: 28px;
    font-weight: 600;
}

#seconds {
    font-size: 14px;
    color: #ff66ff;
    text-shadow: 0 0 8px #ff66ff, 0 0 16px #ff66ff;
    opacity: 0;
    max-width: 0;
    margin-left: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: all .3s;
}

.clock:hover #seconds {
    opacity: 1;
    max-width: 50px;
    margin-left: 6px;
    transform: scaleX(1);
}

.date {
    font-size: 13px;
    color: #ddd;
    margin-top: 4px;
}

.search {
    max-width: 900px;
    flex: 1;
    display: flex;
    justify-content: center;
}

.search form {
    width: 100%;
    display: flex;
    gap: 0;
}

.search input[type="search"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px 0 0 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    outline: none;
    color: inherit;
    font-size: 15px;
    backdrop-filter: blur(6px);
}

.search button {
    padding: 12px 16px;
    border-radius: 0 12px 12px 0;
    border: none;
    background: linear-gradient(90deg, #ff4fb0, #6ac8ff);
    font-weight: 600;
    cursor: pointer;
    color: #071026;
    min-width: 56px;
    box-shadow: 0 6px 24px rgba(106, 200, 255, 0.08), inset 0 -2px 8px rgba(255, 255, 255, 0.06);
}

.right-top {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: inherit;
}

.btn.primary {
    background: linear-gradient(90deg, #ff4fb0, #6ac8ff);
    color: #071026;
    font-weight: 700;
}

.cards-wrap {
    flex: 1;
    overflow: auto;
    padding-top: 8px;
    padding-bottom: 8px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    width: 100%;
    justify-content: center;
    padding-bottom: 24px;
}

.card {
    opacity: 0;
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    padding: 14px;
    width: 220px;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(6px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 10px 30px rgba(13, 8, 30, 0.6);
    transition: transform 0.28s cubic-bezier(.2, .9, .2, 1), box-shadow 0.28s;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 50px rgba(22, 8, 50, 0.7);
}

.card.bg-image {
    color: #fff;
}

.card.bg-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0.42));
    pointer-events: none;
}

.card .meta {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.favicon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.favicon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.title {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.url {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.9);
}

.card .actions {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: flex;
    gap: 8px;
    z-index: 3;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 14px;
}

.add-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    color: transparent;
    background: linear-gradient(90deg, #ff4fb0, #6ac8ff);
    -webkit-background-clip: text;
    background-clip: text;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    padding: 12px;
    cursor: pointer;
    width: 220px;
    height: 140px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 40;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal .panel {
    width: 520px;
    max-width: 95%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02));
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 30px 80px rgba(7, 3, 24, 0.8);
}

.form-row {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.form-row input,
.form-row select {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
    color: inherit;
}

.modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.muted {
    opacity: 0.76;
    font-size: 13px;
}

.card, .add-card, .clock .search .top > div {
    opacity: 0;
    transform: translateY(24px);
}

.animate {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: transform 0.42s cubic-bezier(.2, .9, .2, .1), opacity 0.42s ease;
}

@keyframes bgZoom {
    0% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(auto-fill, minmax(170px, 170px)); justify-content: center; gap: 14px; }
    .card { width: 170px; height: 130px; }
    .add-card { width: 170px; height: 130px; }
}

@media (max-width: 700px) {
    .top { flex-direction: column; align-items: flex-start; gap: 10px; }
    .search { width: 100%; }
    .cards { justify-content: stretch; padding-left: 12px; padding-right: 12px; }
}