:root {
    /* Academic Palette (Black & White) */
    --primary-color: #000000;
    --hover-color: #333333;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --text-color: #000000;
    --text-secondary: #555555;
    --border-color: #000000;
    --shadow: none;
}

/* Touch Action Fix */
#paletteCanvas,
#hueSlider,
#tutPaletteCanvas,
#tutHueSlider {
    touch-action: none;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Times New Roman', 'SimSun', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 700px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.admin-container {
    max-width: 1000px;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 2px solid black;
    padding-bottom: 1rem;
}

h1 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 2rem;
    border: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 500;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="number"],
input[type="tel"],
input[type="password"],
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #000;
    border-radius: 0;
    font-size: 1rem;
    background: #fff;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border: 2px solid #000;
    box-shadow: none;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: 1px solid #000;
    border-radius: 0;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-btn {
    background-color: #000;
    color: #fff;
    width: 100%;
}

.primary-btn:hover {
    background-color: #333;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid #000;
    color: #000;
}

.secondary-btn:hover {
    background-color: #eee;
}

/* Color Picker Styles */
.color-picker-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.palette-area {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: 8px;
    cursor: crosshair;
    overflow: hidden;
    transition: opacity 0.3s;
}

.palette-area.disabled {
    opacity: 0.3;
    pointer-events: none;
}

#paletteCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.palette-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.preview-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.color-preview-box {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

#hueSlider,
#tutHueSlider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
    appearance: none;
    outline: none;
    cursor: pointer;
}

#hueSlider::-webkit-slider-thumb,
#tutHueSlider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #ccc;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Admin Table */
.hidden { display: none; }

.toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 0.5rem;
}

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th { background-color: #f8fafc; font-weight: 600; }

.color-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 4px;
    border: 1px solid #ddd;
}

.error-msg {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: auto;
    padding-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.guide-hint {
    text-align: center;
    color: #64748b;
    font-style: italic;
    margin: 2rem 0;
    font-size: 1.1rem;
}

/* Global Three-segment Progress Bar */
.global-progress-bar {
    display: flex;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem auto;
    gap: 15px;
    height: 40px;
    opacity: 0.5;
}

.progress-segment {
    flex: 1;
    border: 1px solid #000;
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.segment-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: #D9D9D9;
    z-index: 1;
    transition: width 0.3s ease;
}

.segment-text {
    position: relative;
    z-index: 2;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    font-family: inherit;
    white-space: nowrap;
}

/* Mobile Adaptation */
@media screen and (max-width: 600px) {
    .global-progress-bar {
        gap: 8px;
        height: 32px;
        margin-bottom: 1.5rem;
    }
    .segment-text {
        font-size: 0.8rem;
    }
}