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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    margin-bottom: 20px;
    color: #222;
}

.controls {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

#testText {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

#testText:focus {
    outline: none;
    border-color: #0066cc;
}

.font-size-control {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.font-size-control label {
    font-weight: 500;
}

#fontSize {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.kerning-control {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kerning-control label {
    font-weight: 500;
}

#letterSpacing {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.filter-controls {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-controls label {
    font-weight: 500;
    margin-right: 5px;
}

.tag-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-filter {
    padding: 6px 14px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #555;
}

.tag-filter:hover {
    border-color: #0066cc;
    color: #0066cc;
}

.tag-filter.active {
    background: #0066cc;
    border-color: #0066cc;
    color: white;
}

.sub-tag-filter {
    padding: 4px 12px;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #666;
}

.sub-tag-filter:hover {
    border-color: #0066cc;
    color: #0066cc;
}

.sub-tag-filter.active {
    background: #e6f2ff;
    border-color: #0066cc;
    color: #0066cc;
}

.sub-tags-container {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e5e5;
    display: none;
}

.sub-tags-container.show {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.sub-tags-label {
    font-size: 13px;
    color: #666;
    margin-right: 5px;
}

.font-count {
    margin-left: auto;
    color: #666;
    font-size: 14px;
}

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

.font-item {
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e5e5e5;
    transition: background 0.2s;
    position: relative;
}

.font-item:hover {
    background: #f0f0f0;
}

.font-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.font-name {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    flex: 1;
}

.font-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.edit-tags-btn {
    padding: 6px 12px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.edit-tags-btn:hover {
    background: #e5e5e5;
}

.download-btn {
    padding: 6px 12px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    text-decoration: none;
}

.download-btn:hover {
    background: #0052a3;
}

.font-tags-display {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-badge {
    padding: 3px 8px;
    background: #e6f2ff;
    color: #0066cc;
    border-radius: 12px;
    font-size: 12px;
}

.sub-tag-badge {
    padding: 3px 8px;
    background: #f0f0f0;
    color: #666;
    border-radius: 12px;
    font-size: 12px;
}

.tag-editor {
    margin-top: 10px;
    padding: 15px;
    background: white;
    border: 2px solid #0066cc;
    border-radius: 6px;
    display: none;
}

.tag-editor.show {
    display: block;
}

.tag-editor-section {
    margin-bottom: 12px;
}

.tag-editor-section:last-child {
    margin-bottom: 0;
}

.tag-editor-label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    display: block;
}

.tag-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.tag-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.save-tags-btn, .cancel-tags-btn {
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    border: none;
}

.save-tags-btn {
    background: #0066cc;
    color: white;
}

.save-tags-btn:hover {
    background: #0052a3;
}

.cancel-tags-btn {
    background: #f0f0f0;
    color: #333;
}

.cancel-tags-btn:hover {
    background: #e0e0e0;
}

.export-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.export-btn:hover {
    background: #218838;
}

.font-sample {
    font-size: 32px;
    color: #222;
    word-wrap: break-word;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    .font-sample {
        font-size: 24px;
    }
}