:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --primary-color: #8b5cf6;
    --secondary-color: #3b82f6;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --card-bg: rgba(30, 41, 59, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans KR', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
}

/* Background Animation */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary-color);
    bottom: -50px;
    right: -50px;
    animation-delay: 2s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #ec4899;
    top: 40%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

/* Layout */
.container {
    width: 90%;
    max-width: 800px;
    margin-bottom: 50px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, #c4b5fd, #67e8f9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subtitle {
    color: #94a3b8;
    font-size: 1.1rem;
}

.icon-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* Search Section */
.search-box {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

textarea {
    width: 100%;
    height: 80px;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.1rem;
    resize: none;
    outline: none;
}

textarea::placeholder {
    color: #64748b;
}

#search-btn {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Results */
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 30px;
}

.word-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 25px;
    animation: slideUp 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.word-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.word-term {
    font-size: 1.8rem;
    font-weight: 700;
    color: #a78bfa;
}

.word-hanja {
    font-size: 1rem;
    color: #94a3b8;
    margin-left: 10px;
}

.word-pos {
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    color: #e2e8f0;
}

.definition-list {
    list-style: none;
}

.definition-list li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #cbd5e1;
    display: flex;
    gap: 10px;
}

.def-num {
    color: var(--secondary-color);
    font-weight: bold;
}

/* Loading */
#loading {
    text-align: center;
    margin-top: 40px;
    color: #94a3b8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* Settings Dropdown Menu */
.settings-dropdown {
    position: fixed;
    top: 70px;
    right: calc((100vw - 800px) / 2 + 5%);
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 99;
    min-width: 180px;
}

.menu-item {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 12px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.menu-item i {
    width: 20px;
    color: var(--primary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: #1e293b;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-body {
    padding: 25px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.link-hint {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.8rem;
    margin-left: 5px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
    border-radius: 8px;
    color: white;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary-color);
}

.info-box {
    background: rgba(59, 130, 246, 0.1);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    color: #93c5fd;
    font-size: 0.9rem;
    align-items: center;
}

.modal-footer {
    padding: 20px;
    text-align: right;
    border-top: 1px solid #334155;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.primary-btn:hover {
    background: #7c3aed;
}

/* Support Modal Sections */
.support-section {
    margin-bottom: 25px;
}

.support-section:last-child {
    margin-bottom: 0;
}

.support-section h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.support-section p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 8px;
}

.support-section p:last-child {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .settings-dropdown {
        right: 5%;
    }
}