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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    height: 60px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

/* Grading Page */
.grading-page {
    height: calc(100vh - 80px);
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 260px 400px;
    gap: 1rem;
    height: 100%;
}

/* Essay Panel */
.essay-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.essay-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.title-input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 200px;
}

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

.meta-inputs {
    display: flex;
    gap: 0.5rem;
}

.title-input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 200px;
}

.author-input {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    width: 100px;
}

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

.char-count {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Paper Type Selector */
.paper-selector {
    display: flex;
    gap: 0.25rem;
}

.paper-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.paper-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.paper-btn.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

/* View Selector Buttons */
.view-selector {
    display: flex;
    gap: 0.25rem;
}

.view-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.view-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.view-btn.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

/* Fullscreen Mode */
.essay-panel.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    height: 100vh !important;
}

.essay-panel.fullscreen .text-grid-container {
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.essay-panel.fullscreen .panel-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

/* Full Height Mode - show essay area with grading panel */
.content-wrapper.full-height {
    grid-template-rows: 1.3fr 1fr;
}

.essay-panel.full-height {
    height: 100% !important;
    display: flex;
    flex-direction: column;
}

.essay-panel.full-height .panel-body {
    flex: 1.3;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.essay-panel.full-height .text-grid-container {
    flex: 1.3;
    overflow: hidden;
}

/* Text Grid Container */
.panel-body {
    flex: 1;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.text-grid-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.text-grid {
    padding: 15px 20px;
    min-height: 100%;
    font-family: "STKaiti", "STKaiti", "楷体", serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    text-align: center;
    font-family: inherit;
}

.grid-placeholder p {
    margin: 0.25rem 0;
}

/* Writing Paper Style - 作文纸效果 */
.writing-paper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100%;
    padding: 0;
    margin: 0 auto;
}

.text-grid:not(.tian-grid) .content-area {
    padding: 5px 10px 5px 25px;
}

.text-grid:not(.tian-grid) .title-area {
    display: none;
    background: white;
    padding: 8px 20px;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.text-grid:not(.tian-grid) .char-row {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    height: 28px;
    position: relative;
}

.text-grid:not(.tian-grid) .char-row::before {
    content: '';
    position: absolute;
    left: 25px;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #a0cfff;
}

/* Line number on the left */
.text-grid:not(.tian-grid) .line-number {
    width: 25px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #999;
    flex-shrink: 0;
    margin-right: 0;
    font-family: Arial, sans-serif;
}

.char-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    vertical-align: middle;
    width: 28px;
    height: 28px;
    line-height: 28px;
    background: transparent;
    border: 1px solid transparent;
    font-size: 16px;
    color: #333;
    cursor: text;
    position: relative;
    transition: all 0.15s ease;
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    user-select: none;
}

.char-cell:hover {
    background: rgba(37, 99, 235, 0.05);
}

.char-cell:focus {
    outline: none;
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary);
}

.char-cell.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: #c53030;
}

.char-cell.error .red-pen-mark {
    color: #c53030;
}

/* Red pen marks on cells */
.red-pen-mark {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #c53030;
    opacity: 0;
    transition: opacity 0.2s;
    font-family: "KaiTi", serif;
}

.char-cell:hover .red-pen-mark,
.char-cell.error:hover .red-pen-mark {
    opacity: 1;
}

/* Annotation marker on character */
.annotation-marker {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #c53030;
    color: white;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.15s;
}

.annotation-marker:hover {
    transform: scale(1.2);
}

.annotation-marker.yellow {
    background: #d97706;
    color: white;
}

.annotation-marker.green {
    background: #059669;
    color: white;
}

/* Character cell with annotation highlight */
.char-cell.has-annotation {
    position: relative;
    background: rgba(197, 48, 48, 0.1);
    border-color: #c53030;
}

.char-cell.has-annotation.highlight-yellow {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: #d97706 !important;
}

.char-cell.has-annotation.highlight-green {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #059669 !important;
}

/* Highlight class for annotations (without has-annotation) */
.char-cell.highlight-yellow {
    background: rgba(245, 158, 11, 0.15);
    border-color: #d97706;
}

.char-cell.highlight-green {
    background: rgba(16, 185, 129, 0.15);
    border-color: #059669;
}

/* Selected range - only apply red when no annotation */
.char-cell.selected:not(.has-annotation) {
    background: rgba(197, 48, 48, 0.2);
    border-color: #c53030;
}

.char-cell.selected.has-annotation.highlight-yellow {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #d97706 !important;
}

.char-cell.selected.has-annotation.highlight-green {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: #059669 !important;
}

/* Highlight active annotation on click - smooth pulsing effect */
.char-cell.highlight-active {
    background: rgba(59, 130, 246, 0.15) !important;
    animation: highlight-pulse 1.5s ease-in-out infinite;
}

@keyframes highlight-pulse {
    0%, 100% {
        background: rgba(59, 130, 246, 0.15);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
    }
    50% {
        background: rgba(59, 130, 246, 0.08);
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    }
}

.tian-grid-mode .text-grid.tian-grid .char-cell.highlight-active {
    background: rgba(59, 130, 246, 0.12) !important;
    animation: highlight-pulse-tian 1.5s ease-in-out infinite;
}

@keyframes highlight-pulse-tian {
    0%, 100% {
        background: rgba(59, 130, 246, 0.12);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    }
    50% {
        background: rgba(59, 130, 246, 0.05);
        box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.2);
    }
}

/* Animate the annotation marker */
.char-cell.highlight-active .annotation-marker {
    animation: marker-pulse 1.5s ease-in-out infinite;
}

@keyframes marker-pulse {
    0%, 100% {
        transform: scale(1.15);
    }
    50% {
        transform: scale(1.3);
    }
}

/* ========== Tian Grid Style - 田字格 ========== */
.tian-grid-mode .text-grid-container {
    overflow-x: auto;
    overflow-y: auto;
}

.tian-grid-mode .text-grid {
    width: auto;
    min-width: 100%;
}

.tian-grid-mode .text-grid.tian-grid {
    min-width: calc(56px * 20 + 25px);
    width: calc(56px * 20 + 25px);
    max-width: calc(56px * 20 + 25px);
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

.tian-grid-mode .text-grid.tian-grid .char-cell {
    position: relative;
    border: 1px solid #a0cfff;
    box-sizing: border-box;
}

.tian-grid-mode .text-grid.tian-grid .char-cell::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: repeating-linear-gradient(
        to right,
        #a0cfff 0px,
        #a0cfff 3px,
        transparent 3px,
        transparent 6px
    );
    transform: translateY(-50%);
}

.tian-grid-mode .text-grid.tian-grid .char-cell::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: repeating-linear-gradient(
        to bottom,
        #a0cfff 0px,
        #a0cfff 3px,
        transparent 3px,
        transparent 6px
    );
    transform: translateX(-50%);
}

.tian-grid-mode .text-grid.tian-grid .writing-paper {
    background: transparent;
    width: calc(56px * 20 + 25px);
    min-width: calc(56px * 20 + 25px);
    max-width: calc(56px * 20 + 25px);
    padding: 0;
}

.tian-grid-mode .text-grid.tian-grid .title-area {
    display: none;
    background: white;
    padding: 8px 20px;
    border-bottom: 1px solid #eee;
}

.tian-grid-mode .text-grid.tian-grid .author-row {
    display: none;
    padding-right: 40px;
}

.tian-grid-mode .text-grid.tian-grid .content-area {
    background: transparent;
    width: calc(56px * 20 + 25px);
    min-width: calc(56px * 20 + 25px);
    max-width: calc(56px * 20 + 25px);
    padding: 0;
}

.tian-grid-mode .text-grid.tian-grid .char-row {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    height: 56px;
    width: calc(56px * 20 + 25px);
}

.tian-grid-mode .text-grid.tian-grid .char-row::before {
    display: none;
}

.tian-grid-mode .text-grid.tian-grid .char-cell,
.tian-grid-mode .text-grid.tian-grid .char-cell:hover,
.tian-grid-mode .text-grid.tian-grid .char-cell:focus,
.tian-grid-mode .text-grid.tian-grid .char-cell.error,
.tian-grid-mode .text-grid.tian-grid .char-cell.selected,
.tian-grid-mode .text-grid.tian-grid .char-cell.has-annotation {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    vertical-align: middle !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    font-size: 32px !important;
    line-height: 56px !important;
    letter-spacing: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    flex-shrink: 0 !important;
    position: relative !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.empty {
    background: transparent !important;
    color: transparent !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell:not(.empty):hover {
    background: rgba(37, 99, 235, 0.1) !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell:not(.empty):focus {
    background: rgba(37, 99, 235, 0.15) !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.error:not(.empty) {
    background: rgba(239, 68, 68, 0.25) !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.selected:not(.empty) {
    background: rgba(197, 48, 48, 0.35) !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.has-annotation:not(.empty) {
    background: rgba(197, 48, 48, 0.25) !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.has-annotation.highlight-yellow:not(.empty) {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #d97706 !important;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.has-annotation.highlight-green:not(.empty) {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: #059669 !important;
}

.char-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    vertical-align: middle;
    font-size: inherit;
    line-height: inherit;
}

.tian-grid-mode .text-grid.tian-grid .char-cell .char-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tian-grid-mode .text-grid.tian-grid .char-cell:hover {
    background: rgba(37, 99, 235, 0.05);
}

.tian-grid-mode .text-grid.tian-grid .char-cell:focus {
    background: rgba(37, 99, 235, 0.1);
}

.tian-grid-mode .text-grid.tian-grid .char-cell.error {
    background: rgba(239, 68, 68, 0.2);
}

.tian-grid-mode .text-grid.tian-grid .char-cell.selected {
    background: rgba(197, 48, 48, 0.3);
}

.tian-grid-mode .text-grid.tian-grid .char-cell.selected.has-annotation.highlight-yellow {
    background: rgba(245, 158, 11, 0.15);
    border-color: #d97706;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.selected.has-annotation.highlight-green {
    background: rgba(16, 185, 129, 0.15);
    border-color: #059669;
}

/* Highlight class for Tian grid */
.tian-grid-mode .text-grid.tian-grid .char-cell.highlight-yellow {
    background: rgba(245, 158, 11, 0.15);
    border-color: #d97706;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.highlight-green {
    background: rgba(16, 185, 129, 0.15);
    border-color: #059669;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.has-annotation {
    background: rgba(197, 48, 48, 0.2);
}

.tian-grid-mode .text-grid.tian-grid .line-number {
    height: 56px;
    font-size: 12px;
    width: 25px;
    min-width: 25px;
    flex-shrink: 0;
    margin-right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 56px;
}

.tian-grid-mode .text-grid.tian-grid .char-cell.empty {
    background: transparent !important;
    color: transparent;
}

.tian-grid-mode .text-grid.tian-grid .annotation-marker {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: #c53030;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.15s;
}

.tian-grid-mode .text-grid.tian-grid .annotation-marker:hover {
    transform: scale(1.15);
}

.tian-grid-mode .text-grid.tian-grid .annotation-marker.yellow {
    background: #d97706;
    color: white;
}

.tian-grid-mode .text-grid.tian-grid .annotation-marker.green {
    background: #059669;
    color: white;
}

.tian-grid-mode .text-grid.tian-grid .paragraph-gap {
    display: none;
}

/* Paragraph spacing */
.paragraph-gap {
    height: 0;
    margin: 5px 0;
    border: none;
    position: relative;
}

.text-grid:not(.tian-grid) .paragraph-gap {
    border-bottom: 1px solid #a0cfff;
    height: 15px;
}

.text-grid:not(.tian-grid) .paragraph-gap::after {
    content: attr(data-para);
    position: absolute;
    right: 0;
    bottom: 2px;
    font-size: 10px;
    color: #999;
    font-family: Arial, sans-serif;
}

.char-cell.has-side-comment {
    position: relative;
}

.char-cell.suggest {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary);
}

.char-cell.content {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--purple);
}

.char-cell.praise {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--success);
}

.char-cell.highlighted {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

/* Paragraph spacing */
.paragraph-gap {
    height: 20px;
    border-bottom: 2px double #a0cfff;
    margin: 5px 0;
    position: relative;
}

.paragraph-gap::after {
    content: attr(data-para);
    position: absolute;
    right: 0;
    bottom: 2px;
    font-size: 10px;
    color: #999;
    font-family: Arial, sans-serif;
}

/* Empty cell styling */
.char-cell.empty {
    color: transparent;
}

.char-cell.empty::before {
    display: none;
}

/* Title area styling */
.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    min-height: 35px;
}
    min-height: 35px;
    position: relative;
}

.title-cell {
    min-width: 50px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    font-family: "STKaiti", "STKaiti", "楷体", serif;
}

.title-placeholder {
    color: #ccc;
    font-size: 14px;
    font-weight: normal;
}

/* Author name area */
.author-row {
    display: none;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 15px;
    min-height: 28px;
    padding-right: 40px;
}

.author-label {
    font-size: 12px;
    color: #999;
    margin-right: 10px;
}

.author-cell {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    font-size: 14px;
    color: #333;
    font-family: "STKaiti", "KaiTi", "楷体", serif;
    user-select: none;
}

.author-cell:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}

/* Panel Footer */
.panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Side Comment Panel */
.side-comment-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.side-comment-panel .panel-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    background: #fff5f5;
    flex-shrink: 0;
}

.side-comment-panel .panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #c53030;
}

.side-comment-panel .panel-body {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.side-comment-empty {
    text-align: center;
    padding: 1rem;
    color: var(--gray-400);
    font-size: 0.8rem;
}

/* Add annotation button */
.add-annotation-row {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.add-annotation-btn {
    width: 100%;
    padding: 0.5rem;
    background: linear-gradient(135deg, #c53030, #e53e3e);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.add-annotation-btn:hover {
    background: linear-gradient(135deg, #9b2c2c, #c53030);
}

.add-annotation-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

/* Side Comment Items */
.side-comment-item {
    background: #fff9f9;
    border: 1px dashed #fc8181;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.side-comment-item:hover {
    background: #fff5f5;
    border-color: #c53030;
}

.side-comment-item.yellow {
    background: #fffbeb;
    border-color: #fcd34d;
}

.side-comment-item.yellow:hover {
    background: #fef3c7;
    border-color: #d97706;
}

.side-comment-item.green {
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.side-comment-item.green:hover {
    background: #d1fae5;
    border-color: #059669;
}

.side-comment-item .comment-header {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.side-comment-item .comment-header span[class*="red"]:not(.comment-number) {
    color: #c53030;
}

.side-comment-item .comment-header span[class*="yellow"]:not(.comment-number) {
    color: #d97706;
}

.side-comment-item .comment-header span[class*="green"]:not(.comment-number) {
    color: #059669;
}

.side-comment-item .comment-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #c53030;
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: bold;
}

.side-comment-item .comment-number.yellow {
    background: #d97706;
    color: white;
}

.side-comment-item .comment-number.green {
    background: #059669;
    color: white;
}

.side-comment-item .comment-color-label {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: rgba(197, 48, 48, 0.1);
}

.side-comment-item .comment-color-label.yellow {
    background: rgba(217, 119, 6, 0.1);
}

.side-comment-item .comment-color-label.green {
    background: rgba(5, 150, 105, 0.1);
}

.side-comment-item .comment-text {
    font-size: 0.8rem;
    color: #742a2a;
    font-family: "KaiTi", "STKaiti", serif;
    line-height: 1.4;
}

.side-comment-item.yellow .comment-text {
    color: #92400e;
}

.side-comment-item.green .comment-text {
    color: #065f46;
}

.side-comment-item .delete-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: #c53030;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.side-comment-item.yellow .delete-btn {
    color: #d97706;
}

.side-comment-item.green .delete-btn {
    color: #059669;
}

.side-comment-item:hover .delete-btn {
    opacity: 1;
}

/* Custom comment input */
.custom-comment {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--gray-300);
}

.custom-comment textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.8rem;
    resize: none;
    font-family: inherit;
}

.custom-comment textarea:focus {
    outline: none;
    border-color: #c53030;
}

.add-comment-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: white;
    color: #c53030;
    border: 1px solid #c53030;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-comment-btn:hover {
    background: #fff5f5;
}

.custom-comment-header {
    padding: 0.5rem;
}

.custom-comment-btn {
    width: 100%;
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #c53030 0%, #e53e3e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(197, 48, 48, 0.3);
}

.custom-comment-btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #c53030 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(197, 48, 48, 0.4);
}

.custom-comment-btn span {
    font-size: 1rem;
}

/* Annotation number marker on character */
.annotation-marker {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #c53030;
    color: white;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.15s;
}

.annotation-marker:hover {
    transform: scale(1.2);
}

.annotation-marker.yellow {
    background: #d97706;
    color: white;
}

.annotation-marker.green {
    background: #059669;
    color: white;
}

/* Character cell with annotation */
.char-cell.has-annotation {
    position: relative;
    background: rgba(197, 48, 48, 0.1);
    border-color: #c53030;
}

/* Selected range */
.char-cell.selected:not(.has-annotation) {
    background: rgba(197, 48, 48, 0.2);
    border-color: #c53030;
}

/* Red pen annotation style */
.red-pen-annotation {
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    font-family: "KaiTi", "STKaiti", serif;
    font-size: 12px;
    color: #c53030;
    background: transparent;
    border: none;
    padding: 4px 2px;
    cursor: pointer;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.char-row:hover .red-pen-annotation {
    opacity: 1;
}

/* Comment Templates */
.comment-templates {
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
}

.templates-header {
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.templates-header:hover {
    background: var(--gray-100);
}

.toggle-templates {
    border: none;
    background: none;
    color: var(--gray-500);
    cursor: pointer;
    font-size: 0.7rem;
}

.templates-body {
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.template-category {
    margin-bottom: 0.5rem;
}

.template-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.template-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.template-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray-600);
}

.template-btn:hover {
    border-color: #c53030;
    color: #c53030;
    background: #fff5f5;
}

/* Grading Panel */
.grading-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

/* Evaluation Panel */
.evaluation-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.eval-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.eval-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.eval-body {
    padding: 1rem;
}

/* Score Details */
.score-details {
    margin-bottom: 1rem;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.score-label {
    width: 40px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.score-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-value {
    width: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    text-align: right;
}

.score-total {
    text-align: center;
    margin: 0.75rem 0;
    padding: 0.5rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: var(--radius);
}

.score-total span:first-child {
    font-size: 2rem;
    font-weight: 700;
    color: #d97706;
}

.score-total .unit {
    font-size: 0.9rem;
    color: #92400e;
}

.essay-title-display {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.essay-title-display .label {
    color: var(--gray-500);
}

.essay-title-display .value {
    color: var(--gray-800);
    font-weight: 500;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stars {
    display: flex;
    gap: 0.25rem;
}

.star {
    font-size: 1.5rem;
    color: var(--gray-300);
}

.star.filled {
    color: #fbbf24;
}

.score-value {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.score-value span:first-child {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.score-value .unit {
    font-size: 1rem;
    color: var(--gray-500);
}

.overall-comment {
    background: var(--gray-50);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--gray-700);
    line-height: 1.6;
}

/* Summary Panel */
.summary-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
    max-height: 200px;
    display: flex;
    flex-direction: column;
}

.summary-panel .panel-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
}

.summary-panel .panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.toggle-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: none;
    background: none;
    color: var(--gray-500);
    cursor: pointer;
}

.summary-panel .panel-body {
    padding: 0.75rem 1rem;
    overflow-y: auto;
    flex: 1;
}

.summary-list {
    list-style: none;
}

.summary-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item p {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-top: 0.25rem;
}

/* Detail Panel */
.detail-panel {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel .panel-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
}

.detail-panel .panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    border-color: var(--primary);
}

.tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.detail-panel .panel-body {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item {
    padding: 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.detail-item:hover {
    background: var(--gray-50);
}

.detail-item.error {
    border-left-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.detail-item.suggest {
    border-left-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.detail-item.content {
    border-left-color: var(--purple);
    background: rgba(139, 92, 246, 0.05);
}

.detail-item.praise {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.detail-number {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.error .detail-number {
    background: var(--danger);
    color: white;
}

.suggest .detail-number {
    background: var(--primary);
    color: white;
}

.content .detail-number {
    background: var(--purple);
    color: white;
}

.praise .detail-number {
    background: var(--success);
    color: white;
}

.detail-content {
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.detail-suggestion {
    font-size: 0.8rem;
    color: var(--gray-500);
    padding-left: 1.75rem;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.tag.suggest {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.tag.content {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

.tag.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

/* Buttons */
.btn-primary {
    padding: 0.6rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-secondary {
    padding: 0.6rem 1.25rem;
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--gray-400);
    background: var(--gray-50);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-500);
}

.empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Compare Tip */
.compare-tip {
    text-align: center;
    padding: 1rem;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.compare-tip p {
    margin: 0;
}

/* History Comparison */
.history-comparison {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.comparison-header h3 {
    font-size: 1rem;
    color: var(--gray-800);
    margin: 0;
}

.comparison-body {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.comparison-record {
    flex: 1;
    min-width: 250px;
    max-width: 350px;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.comparison-date {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--gray-300);
}

.comparison-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.comparison-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: white;
    border-radius: 4px;
    font-size: 0.8rem;
}

.comparison-score-item .label {
    color: var(--gray-500);
}

.comparison-score-item .value {
    font-weight: 600;
    color: var(--gray-800);
}

.comparison-arrow {
    font-size: 1.5rem;
    color: var(--gray-400);
    align-self: center;
}

.comparison-summary {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.9rem;
    color: #065f46;
}
    font-size: 0.9rem;
    color: #065f46;
}

.compare-tip {
    text-align: center;
    padding: 1rem;
    background: #fffbeb;
    border-radius: var(--radius);
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.history-actions .btn-primary {
    background: var(--primary);
}
.history-page,
.help-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
}

.history-page .main-content,
.help-page .main-content {
    padding: 0;
}

.history-container,
.help-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    min-height: 500px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.history-header h2 {
    font-size: 1.1rem;
    color: var(--gray-800);
    margin: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.history-item.comparison-selectable {
    border: 2px solid var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.history-item.comparison-selectable:hover {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary);
}

.history-item.selected-for-compare {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.history-info {
    flex: 1;
}

.history-info h4 {
    font-size: 0.95rem;
    color: var(--gray-800);
    margin: 0 0 0.25rem 0;
}

.history-meta {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.history-score {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.score-badge {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.score-badge span {
    font-size: 1.1rem;
}

.score-badge .score-label {
    font-size: 0.6rem;
    font-weight: normal;
    opacity: 0.9;
}

.score-badge.high {
    background: linear-gradient(135deg, #10b981, #059669);
}

.score-badge.medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.score-badge.low {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Help Page */
.help-container h2 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section h3 {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.help-section ol,
.help-section ul {
    padding-left: 1.5rem;
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.8;
}

.help-section li {
    margin-bottom: 0.5rem;
}

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

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 50%;
}

.close-btn:hover {
    background: var(--gray-100);
}

.modal-body {
    padding: 1.25rem;
}

.setting-group {
    margin-bottom: 1.25rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group > label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio,
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray-600);
    cursor: pointer;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

.modal-footer .btn-primary {
    padding: 0.5rem 1.5rem;
}

/* Comment Modal */
.comment-modal {
    max-width: 450px;
}

.comment-modal .modal-body {
    padding: 1rem;
}

.selected-range-display {
    background: #fef3c7;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
    margin-bottom: 0.75rem;
}

.selected-range-display span {
    font-weight: 600;
}

.color-selector {
    margin-bottom: 0.75rem;
}

.color-label {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.color-options {
    display: flex;
    gap: 0.75rem;
}

.color-option {
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option input:checked + .color-badge {
    border-color: var(--gray-800);
    transform: scale(1.05);
}

.color-badge.red {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.color-badge.yellow {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.color-badge.green {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.color-badge.red.selected {
    background: #dc2626;
    color: white;
}

.color-badge.yellow.selected {
    background: #d97706;
    color: white;
}

.color-badge.green.selected {
    background: #059669;
    color: white;
}

.comment-modal textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.comment-modal textarea:focus {
    outline: none;
    border-color: #c53030;
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.1);
}

.comment-modal .modal-footer {
    display: flex;
    gap: 0.75rem;
}

.comment-modal .btn-primary {
    background: linear-gradient(135deg, #c53030, #e53e3e);
}

.comment-modal .btn-primary:hover {
    background: linear-gradient(135deg, #9b2c2c, #c53030);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: var(--gray-800);
    color: white;
    border-radius: var(--radius);
    font-size: 0.9rem;
    z-index: 1001;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .grading-page {
        height: auto;
    }
    
    .essay-panel {
        min-height: 500px;
    }
    
    .grading-panel {
        max-height: 600px;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 0 1rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .title-input {
        width: 120px;
    }
    
    .char-cell {
        width: 24px;
        height: 28px;
        font-size: 12px;
    }
    
    .history-container,
    .help-container {
        padding: 1rem;
    }
    
    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .comparison-body {
        flex-direction: column;
        align-items: center;
    }
    
    .comparison-record {
        width: 100%;
        max-width: 100%;
    }
    
    .comparison-arrow {
        transform: rotate(90deg);
    }
    
    .history-item {
        padding: 0.75rem;
    }
    
    .score-badge {
        width: 44px;
        height: 44px;
    }
}
