:root {
    --bg-color: #0b0c10;
    --card-bg: #1f2833;
    --primary: #facb11;
    --text-main: #ffffff;
    --text-muted: #c5c6c7;
}

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.hero {
    height: 65vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(rgba(11, 12, 16, 0.4), rgba(11, 12, 16, 1)),
        url('https://images.unsplash.com/photo-1542224566-6e85f2e6772f?auto=format&fit=crop&q=80&w=2000') center/cover;
    position: relative;
    padding: 2rem;
    border-bottom: 2px solid rgba(250, 203, 17, 0.2);
    transition: height 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.hero.hero-full {
    height: 100vh;
    border-bottom: none;
    background: linear-gradient(rgba(11, 12, 16, 0.2), rgba(11, 12, 16, 0.95)),
        url('https://images.unsplash.com/photo-1542224566-6e85f2e6772f?auto=format&fit=crop&q=80&w=2000') center/cover;
}

.hero h1 {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}

.hero h1 span {
    color: var(--primary);
    display: block;
    margin-top: 10px;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 650px;
    line-height: 1.8;
    font-weight: 300;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    margin-bottom: 2rem;
}

/* Top Config Button */
.controls-top {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 15px;
    z-index: 20;
}

.btn {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-family: 'Noto Sans SC', sans-serif;
    box-shadow: 0 4px 10px rgba(250, 203, 17, 0.2);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(250, 203, 17, 0.4);
    background: #fff;
}

.btn-large {
    font-size: 1.4rem;
    padding: 16px 45px;
    border-radius: 35px;
    margin-top: 2rem;
    animation: pulse-glow 2s infinite;
}

.btn-large:hover {
    animation: none;
    transform: scale(1.05);
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(250, 203, 17, 0.6);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(250, 203, 17, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(250, 203, 17, 0);
    }
}

.btn-outline {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
    backdrop-filter: blur(5px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: #fff;
}

.stats {
    position: absolute;
    bottom: -25px;
    background: rgba(31, 40, 51, 0.9);
    backdrop-filter: blur(10px);
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 400;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(250, 203, 17, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stats .stats-text span {
    color: var(--primary);
    font-weight: 700;
    margin: 0 5px;
}

.container {
    max-width: 1400px;
    margin: 6rem auto 2rem;
    padding: 0 2rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background: rgba(31, 40, 51, 0.6);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    min-height: 180px;
    user-select: none;
    -webkit-user-select: none;
}

.card::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 8rem;
    color: rgba(255, 255, 255, 0.02);
    font-family: serif;
    transition: all 0.4s;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
    border-color: rgba(250, 203, 17, 0.5);
    background: rgba(31, 40, 51, 0.9);
}

.card:hover::before {
    color: rgba(250, 203, 17, 0.05);
    transform: scale(1.1);
}

.card::after {
    content: '点击复制文案';
    position: absolute;
    bottom: -40px;
    right: 20px;
    background: var(--primary);
    color: #000;
    padding: 6px 16px;
    font-size: 0.85rem;
    border-radius: 20px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(250, 203, 17, 0.3);
}

.card:hover::after {
    bottom: 20px;
    opacity: 1;
}

.card.copied::after {
    content: '已复制！ ✓';
    background: #4caf50;
    color: #fff;
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.card .index {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.85rem;
    color: var(--primary);
    opacity: 0.6;
    font-weight: 700;
    letter-spacing: 1px;
}

.card .text {
    font-size: 1.15rem;
    line-height: 1.7;
    font-weight: 300;
    z-index: 1;
    margin-top: 15px;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
}

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

.footer {
    text-align: center;
    padding: 3rem;
    margin-top: 2rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 300;
}

.footer span {
    color: var(--primary);
    font-weight: bold;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-color);
    border: 1px solid rgba(250, 203, 17, 0.3);
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    height: 90vh;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 900;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
}

.auto-save-notifier {
    font-size: 0.85rem;
    color: #4caf50;
    font-weight: normal;
    border: 1px solid #4caf50;
    margin-left: 20px;
    padding: 3px 10px;
    border-radius: 20px;
    opacity: 0.8;
    background: rgba(76, 175, 80, 0.1);
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex: 1;
    overflow: hidden;
}

.form-group {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.form-group label span {
    font-size: 0.8rem;
    font-weight: 300;
    opacity: 0.6;
    margin-left: 10px;
    text-align: right;
}

.dict-section {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding-right: 1.5rem;
}

.template-section {
    padding-left: 0.5rem;
}

.dict-scroller {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-content: start;
}

.dict-scroller::-webkit-scrollbar,
.template-list::-webkit-scrollbar {
    width: 6px;
}

.dict-scroller::-webkit-scrollbar-track,
.template-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.dict-scroller::-webkit-scrollbar-thumb,
.template-list::-webkit-scrollbar-thumb {
    background: rgba(250, 203, 17, 0.3);
    border-radius: 10px;
}

.dict-scroller::-webkit-scrollbar-thumb:hover,
.template-list::-webkit-scrollbar-thumb:hover {
    background: rgba(250, 203, 17, 0.8);
}

.dict-item {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    transition: 0.3s;
}

.dict-item:hover {
    border-color: rgba(250, 203, 17, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.dict-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dict-label span {
    color: #a9b7c6;
    font-weight: normal;
    font-family: monospace;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.dict-item textarea {
    background: #13151a;
    color: #a9b7c6;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 10px;
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 0.85rem;
    resize: vertical;
    line-height: 1.6;
    height: 140px;
    outline: none;
    transition: 0.3s;
}

.dict-item textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(250, 203, 17, 0.2);
    color: #fff;
}

.template-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-content: start;
}

.template-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.template-item:hover {
    border-color: rgba(250, 203, 17, 0.4);
    background: rgba(0, 0, 0, 0.5);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 8px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #ff4d4f;
    font-size: 1.2rem;
    padding: 0 5px;
    opacity: 0.6;
    transition: 0.3s;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.template-item textarea {
    background: #13151a;
    color: #a9b7c6;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    resize: vertical;
    line-height: 1.8;
    height: 75px;
    outline: none;
    transition: 0.3s;
}

.template-item textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(250, 203, 17, 0.1);
    color: #fff;
}

.add-template-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 14px;
    border-style: dashed;
    color: var(--text-muted);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
    font-weight: normal;
    font-size: 1rem;
}

.add-template-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    border-style: solid;
    background: rgba(250, 203, 17, 0.05);
    transform: translateY(-2px);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    flex-wrap: wrap;
    /* Prevent button overflow on smaller screens */
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 992px) {
    .modal-content {
        padding: 1.5rem;
    }

    .editor-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
        display: block;
    }

    .dict-section {
        border-right: none;
        padding-right: 0;
        padding-bottom: 2rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 2rem;
    }

    .template-section {
        padding-left: 0;
    }

    .dict-scroller {
        display: block;
        overflow-y: visible;
    }

    .dict-item {
        margin-bottom: 1rem;
    }

    .template-list {
        display: block;
        overflow-y: visible;
    }

    .template-item {
        margin-bottom: 1rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .container {
        margin-top: 4rem;
        padding: 0 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stats {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    .controls-top {
        top: 15px;
        right: 15px;
    }

    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-actions button {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .modal-actions button:last-child {
        margin-bottom: 0;
    }

    /* Toast Notification */
    .toast {
        position: fixed;
        top: 40px;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        background: rgba(76, 175, 80, 0.95);
        color: white;
        padding: 12px 30px;
        border-radius: 30px;
        font-size: 1.1rem;
        font-weight: bold;
        box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        z-index: 9999;
        pointer-events: none;
        backdrop-filter: blur(5px);
    }

    .toast.toast-show {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
}