ILRDF-Lowking's picture
feat: Use is_api_key_error flag from backend + onclick-based button for reliable change key UX
bc7bdb7
Raw
History Blame Contribute Delete
12.9 kB
/* static/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');
:root {
--bg-dark: #090d16;
--bg-card: rgba(16, 24, 40, 0.75);
--bg-card-hover: rgba(23, 34, 56, 0.85);
--border-glow: rgba(0, 242, 254, 0.25);
--primary-cyan: #00f2fe;
--primary-blue: #4facfe;
--accent-purple: #7f00ff;
--accent-gold: #ffb703;
--text-bright: #ffffff;
--text-muted: #94a3b8;
--text-dim: #64748b;
--danger-red: #ff4d4d;
--success-green: #00e676;
--radius-lg: 20px;
--radius-md: 12px;
--radius-sm: 8px;
--transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Outfit', 'Noto Sans TC', sans-serif;
}
body {
background-color: var(--bg-dark);
color: var(--text-bright);
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
background-image:
radial-gradient(circle at 15% 15%, rgba(0, 242, 254, 0.12) 0%, transparent 40%),
radial-gradient(circle at 85% 85%, rgba(127, 0, 255, 0.12) 0%, transparent 40%),
radial-gradient(circle at 50% 50%, rgba(255, 183, 3, 0.05) 0%, transparent 60%);
background-attachment: fixed;
}
/* 網頁導覽標頭 */
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1.2rem 2.5rem;
background: rgba(9, 13, 22, 0.85);
backdrop-filter: blur(16px);
border-bottom: 1px solid var(--border-glow);
position: sticky;
top: 0;
z-index: 100;
}
.brand {
display: flex;
align-items: center;
gap: 12px;
}
.brand-icon {
font-size: 1.8rem;
background: linear-gradient(135deg, var(--primary-cyan), var(--accent-purple));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
filter: drop-shadow(0 0 10px rgba(0, 242, 254, 0.5));
}
.brand-title {
font-size: 1.4rem;
font-weight: 700;
background: linear-gradient(90deg, #ffffff, var(--primary-cyan));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
letter-spacing: 0.5px;
}
.brand-tag {
font-size: 0.75rem;
padding: 3px 8px;
border-radius: 20px;
background: rgba(0, 242, 254, 0.15);
color: var(--primary-cyan);
border: 1px solid rgba(0, 242, 254, 0.3);
font-weight: 600;
}
.tribe-selector-container {
display: flex;
align-items: center;
gap: 10px;
background: var(--bg-card);
padding: 6px 16px;
border-radius: var(--radius-lg);
border: 1px solid var(--border-glow);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.tribe-selector-label {
font-size: 0.85rem;
color: var(--text-muted);
display: flex;
align-items: center;
gap: 6px;
}
.tribe-select {
background: transparent;
color: var(--primary-cyan);
border: none;
font-size: 1rem;
font-weight: 700;
outline: none;
cursor: pointer;
padding-right: 5px;
}
.tribe-select option {
background: #0d1527;
color: #ffffff;
}
/* 主容器 */
.app-container {
max-width: 1200px;
margin: 2rem auto;
padding: 0 1.5rem;
width: 100%;
flex: 1;
}
/* Tab 導覽按鈕列 */
.tabs-header {
display: flex;
gap: 10px;
margin-bottom: 1.5rem;
background: rgba(16, 24, 40, 0.6);
padding: 8px;
border-radius: var(--radius-lg);
border: 1px solid rgba(255, 255, 255, 0.08);
overflow-x: auto;
}
.tab-btn {
flex: 1;
min-width: 130px;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 18px;
background: transparent;
border: none;
color: var(--text-muted);
font-size: 0.95rem;
font-weight: 600;
border-radius: var(--radius-md);
cursor: pointer;
transition: var(--transition-fast);
white-space: nowrap;
}
.tab-btn:hover {
color: var(--text-bright);
background: rgba(255, 255, 255, 0.05);
}
.tab-btn.active {
color: #ffffff;
background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(127, 0, 255, 0.25));
border: 1px solid var(--primary-cyan);
box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}
/* 卡片與分頁面板 */
.tab-content {
display: none;
animation: fadeIn 0.35s ease-out forwards;
}
.tab-content.active {
display: block;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.glass-card {
background: var(--bg-card);
backdrop-filter: blur(20px);
border: 1px solid var(--border-glow);
border-radius: var(--radius-lg);
padding: 2rem;
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
margin-bottom: 1.5rem;
}
/* 翻譯方向模式列 */
.direction-selector-bar {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.2rem;
padding-bottom: 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
flex-wrap: wrap;
}
.direction-label {
font-size: 0.92rem;
color: var(--primary-cyan);
font-weight: 600;
}
.direction-options {
display: flex;
gap: 8px;
background: rgba(10, 15, 26, 0.8);
padding: 4px;
border-radius: var(--radius-md);
border: 1px solid rgba(0, 242, 254, 0.15);
}
.dir-btn {
background: transparent;
border: none;
color: var(--text-muted);
padding: 6px 14px;
border-radius: var(--radius-sm);
font-size: 0.88rem;
font-weight: 600;
cursor: pointer;
transition: var(--transition-fast);
}
.dir-btn:hover {
color: var(--text-bright);
}
.dir-btn.active {
background: var(--gradient-cyber);
color: #040914;
font-weight: 700;
box-shadow: var(--shadow-cyan);
}
/* 文字翻譯區域 */
.translation-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.5rem;
margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
.translation-grid {
grid-template-columns: 1fr;
}
}
.input-box-wrapper, .output-box-wrapper {
display: flex;
flex-direction: column;
gap: 10px;
}
.box-header {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.9rem;
color: var(--text-muted);
font-weight: 600;
}
.text-area-styled {
width: 100%;
height: 180px;
background: rgba(9, 13, 22, 0.7);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: var(--radius-md);
padding: 1.2rem;
color: var(--text-bright);
font-size: 1.05rem;
resize: none;
outline: none;
transition: var(--transition-fast);
}
.text-area-styled:focus {
border-color: var(--primary-cyan);
box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}
.output-styled {
width: 100%;
height: 180px;
background: rgba(9, 13, 22, 0.85);
border: 1px solid var(--border-glow);
border-radius: var(--radius-md);
padding: 1.2rem;
color: var(--primary-cyan);
font-size: 1.2rem;
font-weight: 600;
overflow-y: auto;
line-height: 1.6;
position: relative;
}
.output-styled.empty {
color: var(--text-dim);
font-size: 1rem;
font-weight: 400;
}
.btn-group {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.btn {
padding: 12px 24px;
border-radius: var(--radius-md);
border: none;
font-weight: 600;
font-size: 0.95rem;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
transition: var(--transition-fast);
}
.btn-primary {
background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
color: #000;
font-weight: 700;
box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 242, 254, 0.6);
}
.btn-secondary {
background: rgba(255, 255, 255, 0.08);
color: var(--text-bright);
border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:hover {
background: rgba(255, 255, 255, 0.15);
transform: translateY(-2px);
}
.btn-accent {
background: linear-gradient(135deg, var(--accent-purple), #b5179e);
color: #ffffff;
box-shadow: 0 4px 15px rgba(127, 0, 255, 0.4);
}
.btn-accent:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(127, 0, 255, 0.6);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none !important;
}
/* 信心值標籤與速度控制 */
.meta-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1rem;
padding-top: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.08);
flex-wrap: wrap;
gap: 10px;
}
.badge-confidence {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 600;
background: rgba(0, 230, 118, 0.15);
color: var(--success-green);
border: 1px solid rgba(0, 230, 118, 0.3);
}
.badge-confidence.medium {
background: rgba(255, 183, 3, 0.15);
color: var(--accent-gold);
border-color: rgba(255, 183, 3, 0.3);
}
.badge-confidence.low {
background: rgba(255, 77, 77, 0.15);
color: var(--danger-red);
border-color: rgba(255, 77, 77, 0.3);
}
/* 語法分析卡片展示 */
.analysis-result-container {
margin-top: 1.5rem;
display: none;
}
.glossing-card-preview {
max-width: 100%;
border-radius: var(--radius-md);
border: 1px solid var(--border-glow);
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}
/* 常用單字速查快卡 */
.phrasebook-section {
margin-top: 2rem;
}
.section-title {
font-size: 1.1rem;
font-weight: 700;
margin-bottom: 1rem;
color: var(--text-bright);
display: flex;
align-items: center;
gap: 8px;
}
.phrases-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 12px;
}
.phrase-card {
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
padding: 12px;
border-radius: var(--radius-md);
cursor: pointer;
transition: var(--transition-fast);
text-align: center;
}
.phrase-card:hover {
background: rgba(0, 242, 254, 0.1);
border-color: var(--primary-cyan);
transform: translateY(-3px);
}
.phrase-zh {
font-weight: 600;
color: var(--text-bright);
font-size: 0.95rem;
}
.phrase-desc {
font-size: 0.75rem;
color: var(--text-dim);
margin-top: 4px;
}
/* 歷史紀錄列表 */
.history-list {
display: flex;
flex-direction: column;
gap: 10px;
max-height: 250px;
overflow-y: auto;
}
.history-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 14px;
background: rgba(0, 0, 0, 0.3);
border-radius: var(--radius-sm);
border-left: 3px solid var(--primary-cyan);
font-size: 0.9rem;
}
/* 上傳區塊樣式 (語音, 圖片, 影片) */
.dropzone {
border: 2px dashed rgba(0, 242, 254, 0.4);
border-radius: var(--radius-lg);
padding: 3rem 2rem;
text-align: center;
background: rgba(9, 13, 22, 0.5);
cursor: pointer;
transition: var(--transition-fast);
}
.dropzone:hover, .dropzone.dragover {
border-color: var(--primary-cyan);
background: rgba(0, 242, 254, 0.08);
}
.dropzone-icon {
font-size: 3rem;
color: var(--primary-cyan);
margin-bottom: 1rem;
}
/* 載入中 Loading 遮罩與動畫 */
.loading-spinner {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
border-top-color: #ffffff;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Footer */
.footer {
text-align: center;
padding: 1.5rem;
color: var(--text-dim);
font-size: 0.85rem;
border-top: 1px solid rgba(255, 255, 255, 0.05);
background: rgba(9, 13, 22, 0.9);
}
/* Modal 樣式 */
.modal-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.7);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
}
.modal-content {
background: var(--bg-card);
border: 1px solid var(--border-glow);
border-radius: var(--radius-lg);
width: 90%;
max-width: 800px;
box-shadow: 0 10px 40px rgba(0,0,0,0.8);
display: flex;
flex-direction: column;
}
.modal-header {
padding: 15px 20px;
border-bottom: 1px solid rgba(255,255,255,0.1);
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h3 {
margin: 0;
color: var(--primary-cyan);
}
.close-btn {
background: none;
border: none;
color: var(--text-muted);
font-size: 1.5rem;
cursor: pointer;
}
.close-btn:hover {
color: var(--danger-red);
}