:root {
    --primary-color: #c05e3c;
    --primary-hover: #b05334;
    --bg-color: #f5f2ee;
    --bg-light: #f5f7fa;
    --border-color: #e8e8e8;
    --text-color: #333;
    --text-muted: #666;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.admin-page {
    overflow: hidden;
}

body.contestant-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.contestant-header {
    flex-shrink: 0;
}

.contestant-nav {
    flex-shrink: 0;
}

.contestant-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.admin-sidebar {
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.admin-header {
    flex-shrink: 0;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.table-wrapper {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.input-field {
    border: 1px solid #e0e0e0;
    transition: border-color 0.3s;
}

.input-field:focus {
    border-color: var(--primary-color);
    outline: none;
}

.score-input::-webkit-inner-spin-button { 
    -webkit-appearance: none; 
}

@media (max-width: 1024px) {
    .score-table th, .score-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    .score-input {
        width: 50px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

@media (min-width: 1025px) {
    .score-table th, .score-table td {
        padding: 12px 12px;
    }
    .score-input {
        width: 60px !important;
        height: 40px !important;
    }
}

.table-scroll {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
}

.touch-btn {
    min-height: 44px;
    min-width: 44px;
}

#scoringSection > div:first-child {
    scrollbar-gutter: stable;
}

#scoringSection > div:nth-child(2) .max-w-5xl {
    margin-left: calc(50% - 512px - 17px) !important;
    transform: translateX(0) !important;
}

.page-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.content-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 1400px) {
    .content-wrapper {
        max-width: 1400px;
        padding: 0 24px;
    }
}

@media (min-width: 1600px) {
    .content-wrapper {
        max-width: 1600px;
        padding: 0 32px;
    }
}

.card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f5;
    color: #333;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e5;
}

.score-card {
    border-radius: 12px;
    overflow: hidden;
}

.score-table {
    border-radius: 0;
}

.score-table thead tr {
    background: #f8f9fc;
}

.score-table th {
    border-bottom: 2px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fc;
}

.score-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.score-table thead th {
    background: #f8f9fc;
}

.score-table td {
    border-bottom: 1px solid #f0f0f5;
}

.examinee-card {
    border-radius: 12px;
    transition: all 0.3s ease;
}

.examinee-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.score-input {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.score-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.status-badge {
    border-radius: 6px;
    font-weight: 500;
}

.category-row {
    border-top: 3px solid #e5e7eb !important;
}

.category-row td:first-child {
    background: #fafbfc !important;
}

.category-separator {
    border-top: 3px solid #d1d5db !important;
}

.category-header-bg {
    background: linear-gradient(to right, #f8f9fc, #ffffff) !important;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.sidebar {
    background: #fff;
    border-right: 1px solid var(--border-color);
}

.menu-item {
    color: var(--text-color);
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--bg-color);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.content-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #fafafa;
    font-weight: 500;
}

.data-table tr:hover {
    background-color: #fafafa;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(192, 94, 60, 0.2);
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-default {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-default:hover {
    background-color: #e5e7eb;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.p-4 {
    padding: 16px;
}

.p-6 {
    padding: 24px;
}

.rounded {
    border-radius: 6px;
}

.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mark-highlight {
    background-color: rgba(255, 255, 0, 0.3);
    cursor: pointer;
}

.marking-mode {
    cursor: crosshair;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.input-field {
    border: 1px solid #e0e0e0;
    transition: border-color 0.3s;
}

.input-field:focus {
    border-color: var(--primary-color);
    outline: none;
}
