:root {
    --header-bg: #2d3436;
    --main-bg: #f4f7f6;
    --accent: #6c5ce7;
    --text-main: #2d3436;
    --white: #ffffff;
    --danger: #e17055;
}

body {
    font-family: 'PingFang TC', 'Microsoft JhengHei', sans-serif;
    margin: 0;
    background-color: var(--main-bg);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.top-nav {
    background-color: var(--header-bg);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

.nav-brand { font-size: 1.1rem; font-weight: bold; color: #a29bfe; }

.nav-dropdown { position: relative; display: inline-block; }
.drop-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    outline: none;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1001;
}

.dropdown-content.show { display: block; }

.dropdown-content a {
    color: var(--text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f1f1;
}

.dropdown-content a:hover { background-color: #f1f1f1; }

.main-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page { display: none; width: 100%; max-width: 900px; animation: fadeIn 0.3s; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    margin-bottom: 20px;
}

h2 { margin-top: 0; color: var(--accent); font-size: 1.4rem; }

.form-group { text-align: left; margin-bottom: 1rem; }
label { font-size: 0.8rem; font-weight: bold; color: #636e72; margin-bottom: 5px; display: block; }

select, input[type="text"] {
    width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #ddd;
    font-size: 1rem; background: #fff; outline: none; box-sizing: border-box;
}

button.primary {
    width: 100%; padding: 15px; background: var(--accent); color: white;
    border: none; border-radius: 12px; font-size: 1.1rem; font-weight: bold; cursor: pointer;
    transition: 0.2s;
}

button.primary:disabled { background: #b2bec3; cursor: not-allowed; }

.result-box {
    margin-top: 1.5rem; padding: 25px; border: 2px dashed var(--accent);
    border-radius: 15px; font-size: 1.6rem; font-weight: 900; color: var(--danger);
    min-height: 40px; cursor: pointer;
}

.item-tag {
    display: inline-block; background: #f1f2f6; padding: 5px 10px;
    margin: 3px; border-radius: 6px; font-size: 0.85rem; color: #2d3436;
    border: 1px solid #dfe6e9; cursor: pointer; text-decoration: none;
}
.matrix-container { width: 100%; overflow-x: auto; border-radius: 10px; border: 1px solid #eee; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 900px; table-layout: fixed; }
.matrix-table th, .matrix-table td { padding: 10px; border: 1px solid #eee; vertical-align: top; }
.matrix-table th { background: var(--accent); color: white; position: sticky; top: 0; z-index: 10; }
.matrix-table td:first-child, .matrix-table th:first-child { position: sticky; left: 0; background: #f8f9fa; z-index: 11; font-weight: bold; width: 80px; }
.matrix-table th:first-child { z-index: 12; background: var(--accent); }
.matrix-sub-item { display: block; margin-bottom: 4px; border-bottom: 1px solid #f1f1f1; padding-bottom: 2px; color: #2d3436; text-decoration: none; cursor: pointer; }
.empty-cell { color: #ccc; font-style: italic; }
.rolling { filter: blur(1px); opacity: 0.7; }

/* 管理列表樣式 */
.manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}
.manage-item:hover { background-color: #f9f9f9; }
.btn-delete {
    background: #ff7675;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-delete:hover { background: #d63031; }
.tag-label {
    font-size: 0.7rem;
    color: #6c5ce7;
    background: #efecff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
}