/* Explore Page */
#explore-page {
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden !important;
    min-height: 0;
}

.explore-container {
    width: 100%;
    max-width: 1200px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

.explore-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.explore-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #fafafa;
    flex: 1;
}

.search-input {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #27272a;
    background: #0f0f11;
    color: #fafafa;
    font-size: 14px;
    outline: none;
    width: 200px;
}

.search-input:focus {
    border-color: #3f3f46;
}

.search-input::placeholder {
    color: #52525b;
}

.pinyin-chart-wrapper {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #1c1c1f;
    border-radius: 12px;
    background: #0a0a0c;
}

/* Pinyin Chart Grid */
.pinyin-chart {
    display: grid;
    gap: 1px;
    background: #1c1c1f;
    min-width: fit-content;
}

.chart-row {
    display: contents;
}

.chart-cell {
    background: #0f0f11;
    padding: 8px 4px;
    text-align: center;
    font-size: 12px;
    color: #71717a;
    min-width: 44px;
    position: relative;
}

.chart-cell.header {
    background: #18181b;
    color: #a1a1aa;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 2;
}

.chart-cell.row-header {
    background: #18181b;
    color: #a1a1aa;
    font-weight: 500;
    position: sticky;
    left: 0;
    z-index: 1;
}

.chart-cell.corner {
    background: #18181b;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 3;
}

.chart-cell.clickable {
    cursor: pointer;
    color: #a1a1aa;
    transition: all 0.1s ease;
}

.chart-cell.clickable:hover {
    background: #1c1c1f;
    color: #fafafa;
}

.chart-cell.clickable.active {
    background: #27272a;
    color: #fafafa;
}

.chart-cell.empty {
    color: #27272a;
}

.chart-cell.highlight {
    background: #1c1c1f;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #52525b;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* Tone Picker Popover */
.tone-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    display: none;
}

.tone-picker-overlay.visible {
    display: block;
}

.tone-picker {
    position: absolute;
    background: #1c1c1f;
    border: 1px solid #3f3f46;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 251;
}

.tone-picker::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #3f3f46;
}

.tone-picker::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #1c1c1f;
}

/* Arrow pointing down when picker is above */
.tone-picker.above::before {
    top: auto;
    bottom: -6px;
    border-bottom: none;
    border-top: 6px solid #3f3f46;
}

.tone-picker.above::after {
    top: auto;
    bottom: -5px;
    border-bottom: none;
    border-top: 5px solid #1c1c1f;
}

.tone-picker-title,
.tone-picker-subtitle {
    display: none;
}

.tone-picker-buttons {
    display: flex;
    gap: 4px;
}

.tone-picker-btn {
    padding: 8px 12px;
    background: #27272a;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #fafafa;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 44px;
}

.tone-picker-btn:hover {
    background: #3f3f46;
}

.tone-picker-btn.playing {
    background: #3f3f46;
    border-color: #52525b;
}

.tone-picker-mark {
    font-size: 16px;
    font-weight: 500;
}

.tone-picker-num {
    font-size: 9px;
    color: #71717a;
    text-transform: uppercase;
}

.tone-picker-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tone-picker-btn:disabled:hover {
    background: #27272a;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .explore-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .explore-header h2 {
        order: -1;
    }

    .search-input {
        width: 100%;
    }

    .chart-cell {
        font-size: 10px;
        padding: 6px 2px;
        min-width: 32px;
    }

    .chart-cell.row-header,
    .chart-cell.corner {
        min-width: 36px;
    }
}
