/* === Base and Body === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrollbars from canvas */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #001a29; /* Fallback background */
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* === Canvas Background === */
#galaxy-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Place it behind all content */
}

/* === Flex Break Helper === */
.flex-break {
    display: none;
}

/* === Main Content Frame (Invisible Sizing Container) === */
.main-content {
    width: 90%;
    max-width: 960px;
    height: 240px;
    display: flex; /* Use flex to make child fill space */
    padding: 0;
    margin-bottom: 2rem;
}

/* === Textarea === */
.main-input {
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 1.2rem;
    color: #555;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    resize: none;
    outline: none;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.main-input:focus {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(0, 107, 170, 0.3);
}

.main-input::placeholder {
    color: #888;
}

/* === Footer Buttons === */
.footer-tools {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 0 1rem;
}

.tool-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 0.8rem 1.8rem; /* 左右padding增加20% (1.5rem -> 1.8rem) */
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    opacity: 1;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* === Core CTA Button (.cta-btn) === */
/* 现在只用于标识，不包含视觉样式，视觉效果由.selected类统一管理 */
.cta-btn {
    /* 保留用于JavaScript标识 */
}

/* === Selected State (Static, No Movement) === */
.tool-btn.selected {
    background: #ff6b00;
    box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
}

/* === Hover State (With Movement) === */
.tool-btn:hover {
    background: #ff6b00;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.4);
}

.tool-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* === Responsive Design === */
@media (max-width: 1024px) {
    .main-content {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .main-content {
        height: 250px;
        min-height: 200px;
    }
    .main-input {
        font-size: 1rem;
    }
    .tool-btn {
        padding: 0.7rem 1rem;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    /* 窄屏按钮重新排列 */
    .tool-row {
        flex-wrap: wrap;
        justify-content: center; /* 确保每一行都居中 */
    }

    /* --- 视觉排序：第一行 --- */
    .tool-btn[data-tool="ai-illustrator"] { order: 1; }
    .tool-btn[data-tool="ai-chat"]        { order: 2; }
    .tool-btn[data-tool="text-organizer"]  { order: 3; }

    /* --- 强制换行符 --- */
    .flex-break {
        display: block;        /* 在窄屏时激活 */
        flex-basis: 100%;      /* 占据100%宽度以强制换行 */
        height: 0;             /* 不产生额外高度 */
        order: 4;              /* 排序在第一行之后 */
    }

    /* --- 视觉排序：第二行 --- */
    .tool-btn[data-tool="live-translate"] { order: 5; }
    .tool-btn[data-tool="pro-translate"]  { order: 6; }
}

/* === Header & Logo === */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    opacity: 0.75; /* 明确设置默认透明度 */
    transition: opacity 0.3s ease; /* 增加平滑过渡效果 */
}

.logo-link:hover {
    opacity: 1; /* 悬浮时完全不透明 */
}

.logo {
    width: 42px;
    height: 42px;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

/* === Main Navigation === */
.main-nav {
    display: flex;
    gap: 2rem;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.main-nav a:hover {
    color: white;
}

/* === Site Footer (Copyright) === */
.site-footer {
    position: fixed;
    bottom: 1rem; /* 直接定义离底部的距离来实现上移 */
    left: 0;
    width: 100%;
    padding: 1rem;
    text-align: center;
    font-size: 1.0rem;
    color: rgba(255, 255, 255, 0.5);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: white;
}

/* === Responsive adjustments for Header/Footer === */
@media (max-width: 768px) {
    .site-header {
        padding: 1rem 1.5rem;
    }
    .main-nav {
        display: none; /* Hide nav on mobile for simplicity, can be replaced with a menu icon later */
    }
    .site-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* === New Nav & Language Selector Styles === */
.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}
.main-nav {
    display: flex;
    gap: 2rem;
}
.nav-item {
    position: relative;
}
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(25, 35, 50, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 20;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}
.nav-item:hover .submenu {
    display: block;
}
.submenu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}
.submenu a:hover {
    background-color: rgba(0, 107, 170, 0.5);
    color: white;
}
.language-selector-container {
    position: relative;
}
.language-selector {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}
.language-selector:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}
.language-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(25, 35, 50, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.5rem 0;
    min-width: 150px;
    z-index: 20;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}
.language-selector:hover .language-dropdown {
    display: block;
}
.language-dropdown a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}
.language-dropdown a:hover {
    background-color: rgba(0, 107, 170, 0.5);
    color: white;
}
