
:root {
    --color-red: #c73c1d;
    --color-blue: #1e5a96;
    --color-green: #2d7a4d;
    --color-yellow: #d4a574;
    --color-black: #2c2c2c;
    --color-white: #f5f5f5;
    --color-bg: #f9f7f3;
    --color-text: #1a1a1a;
    --color-border: #d0c5bb;
}

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

body {
    font-family: 'Noto Serif SC', 'Noto Serif TC', serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 20px;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--color-red);
}

.subtitle {
    font-size: 1.1em;
    color: var(--color-text);
    margin-bottom: 10px;
}

.description {
    max-width: 600px;
    margin: 15px auto;
    font-size: 0.95em;
    color: #555;
    font-style: italic;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-bottom: 30px;
}

.grid-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#poem-grid {
    display: grid;
    grid-template-columns: repeat(29, 1fr);
    gap: 2px;
    margin-bottom: 20px;
}
.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    border: 1px solid rgba(0,0,0,0.1);
    background-color: rgba(255,255,255,0.8);
}

.grid-cell[data-row="15"][data-col="15"] {
    font-size: 1em;
    font-weight: bolder;
    background-color: rgba(199, 60, 29, 0.1);
    border: 2px solid var(--color-red);
}
.grid-cell:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.grid-cell.color-red {
    background-color: rgba(199, 60, 29, 0.1);
    color: var(--color-red);
    border-color: rgba(199, 60, 29, 0.3);
}
.grid-cell.color-blue {
    background-color: rgba(30, 90, 150, 0.1);
    color: var(--color-blue);
    border-color: rgba(30, 90, 150, 0.3);
}
.grid-cell.color-green {
    background-color: rgba(45, 122, 77, 0.1);
    color: var(--color-green);
    border-color: rgba(45, 122, 77, 0.3);
}
.grid-cell.color-yellow {
    background-color: rgba(212, 165, 116, 0.1);
    color: var(--color-yellow);
    border-color: rgba(212, 165, 116, 0.3);
}
.grid-cell.color-black {
    background-color: rgba(44, 44, 44, 0.1);
    color: var(--color-black);
    border-color: rgba(44, 44, 44, 0.3);
}
.grid-cell.selected {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(199, 60, 29, 0.3);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-panel {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-panel h3 {
    color: var(--color-red);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.char-display {
    text-align: center;
    margin-bottom: 15px;
}

.char-large {
    font-size: 4em;
    margin: 15px 0;
    color: var(--color-red);
    font-weight: bold;
}

.info-row {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.label {
    font-weight: bold;
    color: #666;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.value {
    margin-top: 5px;
    font-size: 1em;
    color: var(--color-text);
}

.controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: #a02f1a;
    box-shadow: 0 2px 8px rgba(199, 60, 29, 0.3);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: var(--color-text);
}

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

.reading-methods {
    display: grid;
    gap: 8px;
}

.reading-badge {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border-left: 3px solid var(--color-red);
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px;
}

.reading-badge:hover {
    background-color: #e8e8e8;
    border-left-color: var(--color-blue);
}

.poem-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.poem-section h2 {
    color: var(--color-red);
    margin-bottom: 15px;
    font-size: 1.3em;
}

#constructed-poem {
    background-color: #f9f7f3;
    padding: 15px;
    border-radius: 5px;
    min-height: 60px;
    font-size: 1.2em;
    line-height: 1.8;
    color: var(--color-text);
    text-align: center;
    border: 1px dashed var(--color-border);
    word-spacing: 0.5em;
}

.empty-poem {
    color: #999;
    font-style: italic;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--color-red);
}

.stat-label {
    font-size: 0.8em;
    color: #666;
    text-transform: uppercase;
}

.legend {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 15px;
    background-color: #f9f7f3;
    border-radius: 5px;
    margin-bottom: 20px;
}

.legend-item {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.85em;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin: 0 auto 5px;
}

.info-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f7f3;
    border-left: 3px solid var(--color-red);
    border-radius: 3px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .legend {
        grid-template-columns: repeat(3, 1fr);
    }
}
